Skip to content

Omitted prefixItems vs empty #1480

Closed
@notEthan

Description

@notEthan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions