js-json-schema

0.0.9 • Public • Published

js-json-schema

JS to JSON schema generator

 var Address = function(){};
 Address.prototype.attributes = ["addressLine1", "addressLine2", "city", "postcode:Integer", "country"];
 
 var User = function(){};
 User.prototype.attributes = ["name", "email", "password", "address:Address", "active:enum Active,Inactive"];
 User.prototype.extend = {};
 User.prototype.extend.staffUser = ["staffId", "department"];
 User.prototype.extend.member = ["memberId"];
 
 var types = {User:User, Address:Address};

using top down approach

 require('js-json-schema').topdown.generate({schemaDir:'td-schema', ext:'.schema.json'});

using bottom up approach

 require('js-json-schema').bottomup.generate({schemaDir:'bu-schema', ext:'.schema.json'});

Package Sidebar

Install

npm i js-json-schema

Weekly Downloads

1

Version

0.0.9

License

BSD-2-Clause

Last publish

Collaborators

  • skhatri