schema-in-js
v0.1.2
Published
Write json schema fast in js.
Downloads
3
Readme
schema-in-js
Write json schema fast in js.
In Developing! Every version has breaking change!
Getting Started
Install it via npm:
npm install schema-in-js
Usage
And include in your project:
import sj from 'schema-in-js';
let schema = {
name: sj.str.length(10, 5)
};
let jsonSchema = sj.transformToJSONSchema(schema);
console.log(jsonSchema);
// output
{
type: 'object',
properties: {
name: {
type: 'string',
maxLength: 10,
minLength: 5
}
},
required: ['name']
}
License
MIT