bcherny/json-schema-to-typescript

Support `prefixItems` for tuple validation

Open

#543 opened on Jul 26, 2023

View on GitHub
 (4 comments) (4 reactions) (0 assignees)TypeScript (449 forks)github user discovery
enhancementgood first issuehelp wanted

Repository metrics

Stars
 (3,302 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

From the JSON Schema 2020-12 Release Notes:

The items and additionalItems keywords have been replaced with prefixItems and items where prefixItems has the same functionality as the array-of-schemas for of the old items and the new items keyword has the same functionality as the old additionalItems keyword.

For an example with more explanation:
https://json-schema.org/understanding-json-schema/reference/array.html#tuple-validation

As per #1 (which has a broken link by the way), here is the respective file from the official test suite:
https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft2020-12/prefixItems.json

In case there is interest in resolving this issue, I would be willing to look into the code (I've already checked the relevant parts of parsing and generation) and try to provide a pull request for it.

Contributor guide