schema-in-js

0.1.2 • Public • Published

schema-in-js

Build Status Coverage Downloads Downloads npm version dependencies dev dependencies License

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

Readme

Keywords

none

Package Sidebar

Install

npm i schema-in-js

Weekly Downloads

0

Version

0.1.2

License

MIT

Last publish

Collaborators

  • yanghuabei