Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

jsonschema-logo-v1

NPM version NPM downloads built with typescript-lib-starter

JSONSchema to TypeScript Interface

This is a proof of concept. This is just a convenient cli to add to your package.json and watch for changes on JSONSchemas.

Usage as project dependency

Install

npm i -D jsonschema-to-interface

Add scripts to your package.json

"generate-interfaces": "generate-interfaces \"./src/**/schema.json\"",
"generate-interfaces:watch": "generate-interfaces -w \"./src/**/schema.json\""

Call generate-interfaces:watch in parallel with your dev server.

Usage as global CLI

Install

npm i -g jsonschema-to-interface

Call it from the terminal

generate-interfaces './src/**/schema.json'

or run it in watch mode:

generate-interfaces -w './src/**/schema.json'

Note on code style

If there is a .prettierrc.json in che current working dir, it will be used to style the output interface.

Options

  • -w './glob/path/**/schema.json': wathces a glob for changes
  • -o filename: set output file name. Defaults to schema "title" property or, if the "title" is missing, the input filename.

Dependencies

License

MIT

About

This is just a convenient cli watch and compile JSONSchemas to TypeScript interfaces.

Resources

License

Stars

Watchers

Forks

Packages

No packages published