项目作者: aptible

项目描述 :
Build and validate JSON Schema documents
高级语言: JavaScript
项目地址: git://github.com/aptible/ember-json-schema-document.git
创建时间: 2015-10-12T17:26:03Z
项目社区:https://github.com/aptible/ember-json-schema-document

开源协议:MIT License

下载


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

  1. var schema = new Schema(jsonBlob);
  2. var document = schema.buildDocument();
  3. item = document.addItem();
  4. item.set('description', 'Headquarters');
  5. item.set('streetAddress', '155 Water St');
  6. document.dump();
  7. [{
  8. "description": "Headquarters",
  9. "streetAddress": "155 Water St"
  10. }]

Building an object-based Document

  1. var schema = new Schema(jsonBlob);
  2. var document = schema.buildDocument();
  3. document.set('description', 'Headquarters');
  4. document.set('streetAddress', '155 Water St');
  5. document.dump();
  6. {
  7. "description": "Headquarters",
  8. "streetAddress": "155 Water St"
  9. }

Loading a schema by URL

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

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/.