ember-json-schema-document

    0.2.1 • Public • Published

    ember-json-schema-document

    The purpose of this addon is to simplify the process of creating and validating schema-based JSON documents.

    Building an array-based Document

    var schema = new Schema(jsonBlob);
    var document = schema.buildDocument();
     
    item = document.addItem();
    item.set('description', 'Headquarters');
    item.set('streetAddress', '155 Water St');
     
    document.dump();
     
    [{
      "description": "Headquarters",
      "streetAddress": "155 Water St"
    }]
     

    Building an object-based Document

    var schema = new Schema(jsonBlob);
    var document = schema.buildDocument();
     
    document.set('description', 'Headquarters');
    document.set('streetAddress', '155 Water St');
     
    document.dump();
     
    {
      "description": "Headquarters",
      "streetAddress": "155 Water St"
    }

    Loading a schema by URL

    var url = 'https://gridiron.aptible.com/schemas/workforce_locations/v0.0.3';
     
    Schema.load(url).then((schema) => {
      var document = schema.buildDocument();
      var location = document.addItem();
     
      location.set('address', '155 Water St');
    });

    Installation

    • git clone this repository
    • npm install
    • bower install

    Running

    Running Tests

    • ember test
    • ember test --server

    Building

    • ember build

    For more information on using ember-cli, visit http://www.ember-cli.com/.

    Keywords

    Install

    npm i ember-json-schema-document

    DownloadsWeekly Downloads

    9

    Version

    0.2.1

    License

    MIT

    Unpacked Size

    253 kB

    Total Files

    15

    Last publish

    Collaborators

    • ftc
    • greims
    • skylaranderson