JSON S Generator
A generator of JSON schema in TypeScript.
Inspired by the JS version json-schema-generator this generator is written in TypeScript. It is actually a beta version, in which you can pass in your JSON and the generator will give you back a draft-07 schema with validation and information data.
In further versions, there will be options to customise generation,... and more features.
For more information about JSON schemas, the official documentation is here http://json-schema.org/
Installation
npm install json-s-generator --save
Usage
Import Generator class into your typescript project, create a new instance of it.
Call getSchema by passing in your JSON model to generate a schema based on it.
; ;;;
The JSON above will produce following schema :
Test
Tests are written with Mocha and Chai. You can run them with the command.
npm run test
License
« Copyright © Daussin Alain <mowglilab@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this softwareand associated documentation files (the “Software”), to deal in the Software without restriction,including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantialportions of the Software. The Software is provided “as is”, without warranty of any kind, express or implied, including but notlimited to the warranties of merchantability, fitness for a particular purpose and noninfringement.In no event shall the authors or copyright holders be liable for any claim, damages or other liability,whether in an action of contract, tort or otherwise, arising from, out of or in connection with thesoftware or the use or other dealings in the Software. »