jsonschema - what is the difference between properties and patternProperties in json schema? -
for following json string :
{ "abc" : 123, "def" : 345 }
the following schema considers valid :
{ "$schema": "http://json-schema.org/draft-03/schema#", "title": "my schema", "description": "blah", "type": "object", "patternproperties": { ".+": { "type": "number" } } }
however, changing the patternproperties properties still considers valid. then, difference between these 2 tags?
for schema above properties should number. data invalid:
{ a: 'a' }
if replace patternproperties properties property '.+' should number. other properties can anything. invalid:
{ '.+': 'a' }
this valid:
{ a: 'a' }
Comments
Post a Comment