fge / json-schema-validator-demo

Webapp demonstrating JSON Schema validation hosted on Heroku

Home Page:http://json-schema-validator.herokuapp.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Validator doesn't check that the names of the properties are unique within an object

3alster opened this issue · comments

From http://www.ietf.org/rfc/rfc4627.txt

2.2. Objects

An object structure is represented as a pair of curly brackets
surrounding zero or more name/value pairs (or members). A name is a
string. A single colon comes after each name, separating the name
from the value. A single comma separates a value from a following
name. The names within an object SHOULD be unique.

This is normal: this is not the role of JSON Schema to check that, but the role of the JSON parser.

Note that the behaviour is undefined in this case. Jackson chooses to ignore duplicate keys. Other parsers would choose to throw an error. Others will even, yes, create an array with the different values of the keys. None of this is illegal.

As such data is malformed JSON to begin with anyway, it means the source is unreliable...

Thank you for the explanation.