Skip to content

2020-12 Schema: Tuples and Backwards Compatibility #335

Answered by gregsdennis
mlcohen asked this question in Q&A
Discussion options

You must be logged in to vote

You're correct, because additionalItems isn't a keyword anymore, this isn't a compatible change from 2019-09 to 2020-12. None of those schemas you posted are valid for 2020-12.

However, the split of the array form of items to prefixItems provides the same functionality.

The following are now what you'll need to record the same requirements.

// Open tuple
{
  "prefixItems": [
    { "$ref": "#/$defs/foo" },
    { "$ref": "#/$defs/bar" }
  ]
}

// Closed tuple
{
  "prefixItems": [
    { "$ref": "#/$defs/foo" },
    { "$ref": "#/$defs/bar" }
  ],
  "items": false
}

// Tuple with constrained additional items
{
  "prefixItems": [
    { "$ref": "#/$defs/foo" },
    { "$ref": "#/$defs/bar" }
  ],

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@gregsdennis
Comment options

@mlcohen
Comment options

@Relequestual
Comment options

@jdesrosiers
Comment options

Answer selected by mlcohen
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants