This repository was archived by the owner on Nov 3, 2023. It is now read-only.
Include additionalItems
schema example
#22
Labels
additionalItems
schema example
#22
Michael Zub wrote:
Thank you for great "Understanding JSON Schema" site and book. It is very helpful and easy to understand and should be recommended to everyone working with JSON Schema.
As a reader I have a minor remark on "additionalItems" keyword description. On page 26 you have wrote:
"The additionalItems keyword controls whether it’s valid to have additional items in the array beyond what is defined in the schema. Here, we’ll reuse the example schema above, but set additionalItems to false, which has the effect of disallowing extra items in the array."
According to this one can assume that "additionalItems" can be only boolean flag, but there is a case when "additionalItems" can be schema that describes additional array items (very similar as "additionalProperties" works).
As example, schema {"items":[{}],"additionalItems":{"type":"integer"}} won't validate next JSON: [null,2,3,"foo"]. If this data is put into the validator (for example http://json-schema-validator.herokuapp.com/index.jsp) the error will be "instance type (string) does not match any allowed primitive type (allowed: ["integer"])".
The example from above is taken from JSON Schema Test Suite - https://github.com/json-schema/JSON-Schema-Test-Suite
I think it will be great if similar case is added to your book.
Regards,
Micheal Zub
The text was updated successfully, but these errors were encountered: