Reputation: 15054
I'm just learning jsonschema
. It's not clear to me what the difference is between items
and properties
. Can someone please explain?
Upvotes: 7
Views: 2468
Reputation: 12335
items
is for validating arrays, properties
is for validating objects.
The value of items
must be a JSON Schema object or an array JSON Schema objects (let's ignore if it's an array for now). The array that the items
key word is applicable to, passes validation if all items in that array validate against the schema.
The value of properties
must be an object. Each value in the object must be a json schema. The schemas in the object are applied to the instance object when the keys match.
Upvotes: 6