bcherny/json-schema-to-typescript
Vedi su GitHubCannot pass JSONSchema7 schema to compile as it requires JSONSchema4
Open
#359 aperta il 23 dic 2020
enhancementhelp wantedin discussion
Metriche repository
- Star
- (3302 star)
- Metriche merge PR
- (Nessuna PR mergiata in 30 g)
Descrizione
Currently the types are using JSONSchema4 as the type for schema, which means TypeScript won't let you pass objects of type JSONSchema7 due to type differences.
Specifically, exclusiveMaximum & exclusiveMinimum are typed as boolean | undefined in JSONSchema4, but as number | undefined in JSONSchema7. (there probably are more differences - I've not compared the two further than that).
I think the right type to use would be a union of the different schemas supported, i.e JSONSchema7 | JSONSchema4.