Skip to content

Meta-schema for enum should allow empty and non-unique arrays #717

Closed
@Zac-HD

Description

@Zac-HD

Currently, the meta-schemas for (at least) drafts 3, 4, 6, and 7 contain the following:

"enum": {
"type": "array",
"items": true,
"minItems": 1,
"uniqueItems": true
},

However, the prose specification says:

The value of this [i.e. the "enum"] keyword MUST be an array.
This array SHOULD have at least one element. Elements in the array SHOULD be unique.

Validation therefore ought to allow schema authors to use empty or non-unique arrays, because the RFC 2119 definition of SHOULD explicitly permits ignoring such clauses after considering the circumstances. Alternatively, the specification could replace SHOULD with MUST for the relevant constraints.

Possibly related to #618? First reported at python-jsonschema/jsonschema#529, via hypothesis-jsonschema.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions