bcherny/json-schema-to-typescript

Support `prefixItems` for tuple validation

Open

#543 aperta il 26 lug 2023

Vedi su GitHub
 (5 commenti) (4 reazioni) (0 assegnatari)TypeScript (449 fork)github user discovery
enhancementgood first issuehelp wanted

Metriche repository

Star
 (3302 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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.

Guida contributor