Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Omitted prefixItems vs empty #1480

Open
notEthan opened this issue Jan 20, 2024 · 1 comment · May be fixed by #1481
Open

Omitted prefixItems vs empty #1480

notEthan opened this issue Jan 20, 2024 · 1 comment · May be fixed by #1481

Comments

@notEthan
Copy link
Contributor

The spec says of prefixItems:

The value of "prefixItems" MUST be a non-empty array of valid JSON Schemas.

Then ends with:

Omitting this keyword has the same assertion behavior as an empty array.

Specifying that an omitted prefixItems behaves the same as a value that it must not be looks wrong. Comparing to allOf/anyOf/oneOf which also must be non-empty arrays of schemas, they omit the sentence about omitting the keyword.

I'm not sure why any of these must be non-empty - sure, when empty they end up either just allowing everything (prefixItems, allOf) or nothing (anyOf, oneOf), but plenty of other keywords allow similar degenerate cases, e.g. minItems may be 0 allowing everything and enum may be empty allowing nothing. That's just an observation, not a battle I am itching to take on, and I'm sure it's all been discussed before.

Related: #975 / #1001

@notEthan
Copy link
Contributor Author

I suppose this is straightforward enough I'll fix & PR

@notEthan notEthan linked a pull request Jan 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant