Clarification needed: Why is an enum required to have at least one item?
arrkaye opened this issue · 2 comments
arrkaye commented
And conversely, why is it invalid when a enum is [].
This is causing an issue for us when we generate schema's dynamically and there is an option that is meant to be unpopulated/empty.
Thanks.
handrews commented
@arrkaye Starting with draft-06, the requirement is "SHOULD have at least one element" (in draft-04 it was "MUST have at least one element"). SHOULD is a weaker requirement than MUST, and means that while it's not advised to have an empty array, it is legal. If you are using draft-06 or later and this is not working, then you should file an issue with the maintainer of your validator. If you're still using draft-04, I recommend finding a validator that supports a more recent draft.