Skip to content

Optional array items (object-like validation with order) #19

Open
@MAProsper

Description

@MAProsper

It would be useful to have a tuple validation with optional items, it could act similarly to the object's keyword properties but with forced order.

So for example if the schema mandated first the number 1 followed by 2, it could match any combination of them (missing or present) except for a 2 followed by a 1; since even though they are valid items the schemas which validated them are not in order.

This could be implemented reusing the required keyword for arrays, which could contain an array of item indices. Additionally it could also be set to true specifying all items are required (acting like tuple validation) or false marking all items as optional. If not present it can be assumed to be true for backward compatibility reasons or following the behaviour in objects false.

The exact behaviour might be better off following the result of json-schema-org/json-schema-spec#659.

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