npm

Need private packages and team management tools?Check out npm Orgs. »

jsonschema-to-interface

1.0.5 • Public • Published

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

Keywords

none

install

npm i jsonschema-to-interface

Downloadsweekly downloads

23

version

1.0.5

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability