json-schema-org/json-schema-org.github.io

minItems bug in "getting-started-step-by-step"

karolzlot opened this issue · 3 comments

Page: https://json-schema.org/learn/getting-started-step-by-step

Tags are nice but they aren't required to be present.

The minItems validation keyword is used to make sure there is at least one item in the array.

Those two statements are excluding themselves, this should be fixed. I'm not sure which way is desired.

These two statements aren't mutually exclusive.

The first says that the object doesn't need to have a tags property.

The second says that if there's a tags property, it needs at least one item.

Together, they imply that the object can't have an empty tags array.

Agreed, the schema is correct.

If we wanted to require that there are tags, then we'd add "tags" to the existing "required": [...] keyword. What the schema is saying right now is "the property "tags" doesn't have to exist at all. But if it is present, it needs to be an array with at least one item."

Ok, I'm surprised with this, but it sounds correct. Thank you for explanation.