Json Schema to TypeScript conversion in static way. Based on draft 2019-09 core and validation.
const schema = {
type: "object";
properties: {
names: {
type: "array";
items: {type: "string"};
};
};
required: ["names"];
} as const;
type ValidatedType = ParseJsonSchema<typeof schema>;
// type ValidatedType = {names: string[]};
- primitive types
- array
- items
- array schema items (typed tuple)
- additionalItems
- object
- properties
- additionalProperties
- enum
- allOf (unneeded?)
- anyOf
- oneOf