Building on from previous posts on a spike on JSON Schema, we will continue in this one by looking at an alternative library to the
json-schema-to-typescript the library previously explored.
book.json, add the following. It will follow a similar JSON schema we've used previously with the Book but a few changes, so are sure to copy-paste it across.
Writing out the script
index.js will look like the following:
In the above script, we are going to generate
Python output for the sake of demonstration.
Running the generator
node index.js and you will get the following output for TypeScript and Python respectively:
The Python output:
Hooray! We can cut a lot of fluff with these helpers.
Resources And Further Reading
Image credit: Alessio Rinella
Originally posted on my blog.