Skip to content
This is just a convenient cli watch and compile JSONSchemas to TypeScript interfaces.
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples
.editorconfig
.gitignore
.prettierrc.json
LICENSE
README.md
index.js
package.json

README.md

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

You can’t perform that action at this time.