jsonmodels

0.1.0 • Public • Published

Json Model

Model Json is a simple declarative way of specifying models. The library converts the models in to json-schema.

Simple types

There are three types you dan can define in Json Model.

{
  "var1" : "boolean",
  "var2" : "integer",
  "var3" : "string"
}

Optional types

Every field can be made optional by adding a question mark at the end.

{
  "var1" : "string?"
}

Definitions

Definitions are used reuse sub models.

{
  "var1" : "$def1",
  "$def1" : {
    "var2": "string"
  }
}

Definitions optional

Definitions can also be used as optional

{
  "var1" : "$def1?",
  "$def1" : {
    "var2": "string?"
  }
}

Arrays

{
  "arr1" : ["string"]
}

Arrays with Definitions

{
  "arr1" : ["$def1"],
  "$def1":{
    "var1" : "string"
  }
}

/jsonmodels/

    Package Sidebar

    Install

    npm i jsonmodels

    Weekly Downloads

    3

    Version

    0.1.0

    License

    ISC

    Unpacked Size

    16.9 kB

    Total Files

    11

    Last publish

    Collaborators

    • wilmveel