json-schema-org / JSON-Schema-Test-Suite

A language agnostic test suite for the JSON Schema specifications
MIT License
625 stars 209 forks source link

Perhaps add test for `"type": []` #673

Closed aha79 closed 1 year ago

aha79 commented 1 year ago

In types.json there are many tests, but none for "type" being an empty array. According to the spec this seems allowed

if the value of "type" is an array, then an instance validates successfully if its type matches any of the types indicated by the strings in the array

So "type": [] should be the same as the false schema.

Julian commented 1 year ago

Such a schema isn't valid under the 2020 dialect's metaschema (specifically https://json-schema.org/draft/2020-12/meta/validation) which contains a minItems: 1.

(And the same is true for earlier versions IIRC offhand).

aha79 commented 1 year ago

Okay, but then meta/validation and the spec are out-of-sync. Perhaps the spec should say "non-empty array" or similar. But presently it doesnt. (But that is not a problem of the test-suite)

Julian commented 1 year ago

Yep I'd bring that up in the spec repo!