Converts a JSON schema document to a SimpleSchema object, for use with Collection2 and AutoForm.
meteor add bshamblen:json-simple-schema
Simply load the contents of your JSON schema document from your local file system, or from a URL, and pass the parsed JSON object to the JSONSchema constructor:
var jsonSchemaDoc = JSON.parse($.ajax({
ype: 'GET',
url: 'http://example.com/path-to-json-schema-file',
async: false
}).responseText);
var jsonSchema = new JSONSchema(jsonSchemaDoc);
var simpleSchema = jsonSchema.toSimpleSchema();
This is the first iteration of this project, with minimal functionality. It currently supports base data types (including arrays), inline sub-objects and many of the validation options:
- title
- minimum
- maximum
- exclusiveMinimum
- exclusiveMaximum
- minLength
- maxLength
- enum
- minItems
- maxItems
- default
- pattern
- required
- Add support for internal
$ref
schemas, fromdefinitions
- Add support for external
$ref
schemas, from a URI.
Please feel free to contribute by sumbitting a pull request.