Closed birdsarah closed 10 years ago
I was under the impression that items
keyword in the schema implies the array type.
http://json-schema.org/latest/json-schema-validation.html#anchor37
But jsonschema
seems to think otherwise. This doesn't produce a validation error...
>>> jsonschema.validate({'b':'b'}, {'items':[{'a':'a'}]})
I guess you're right that jsonmerge should play safe and add an explicit type
keyword.
Yeah jsonschema only fails, as expected, if the type keyword is there - that could be a limitation of jsonschema of course.
Type isn't a required field, not sure why - https://github.com/json-schema/json-schema/blob/master/draft-04/schema. And I see what you mean about the documentation.
https://github.com/zaggino/z-schema#notypeless - has a strictmode that enforces noTypeless. When you use this validator without no typeless, you see the same behavior as jsonschema though so I'm getting the sense that missing the array type is insufficient (which I know you already agreed to, was just doing my homework!!)
Fixed. Thanks.
I can see that this is tricky, otherwise would have fixed it myself, but I think we should have array type on version.