json-schema-to-typescript
json-schema-to-typescript copied to clipboard
Comparison with `json-schema-to-ts`
Taken from the json-schema-to-ts README.md:
If you prefer to stick to them and can define your schemas in TS instead of JSON (importing JSONs
as constis not available yet), thenjson-schema-to-tsis made for you
Basically, json-schema-to-ts operates fully in TypeScript!! This is very very cool, since, this means you don't need a separate npx json-schema-to-typescript build step to compile a .schema.json file into a .ts schema TypeScript file, then a typescript step. Instead, everything runs directly from TypeScript!!!
However, this has the following downsides, which makes json-schema-to-typescript better in some cases:
json-schema-to-typescriptonly needs to run once, whilejson-schema-to-tswill need to run every time you (or any user of your library) runs TypeScripts, which is much much slower.- No TSDoc comments are generated in json-schema-to-ts, since it's pure TypeScript.
- Important: json-schema-to-ts only works with JSON Schema defined in a TypeScript file. Importing JSON schema from a
.jsonfile is not supported due to limitations in TypeScript.- This will hopefully be fixed in the future by TypeScript, please upvote https://github.com/microsoft/TypeScript/issues/32063 if you're interested!