-
Notifications
You must be signed in to change notification settings - Fork 4
AS3 JSON Schema Validator
License
raulbajales/Frigga
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Frigga - AS3 JSON Schema Validator ================================== Take a look to the spec here: http://tools.ietf.org/html/draft-zyp-json-schema-03 It's a work in progress. It supports most of the "Core Schema Definition", including: type properties items minimum maximum exclusiveMinimum exclusiveMaximum minItems maxItems pattern minLength maxLength enum default title description format id Usage example: -------------- var anObject : Object = { id : "shoe 123", name : "Shoes", price : -20 }; var schema : Object = { name : "Product", description : "Product definition", type : "object", properties : { id : { type : "number", description : "Product identifier" }, name : { description : "Name of the product", type : "string" }, price : { type : "number", minimum : 0 } } }; var frigga : Frigga = Frigga.forSchema(this.schema); var report : FriggaReport = frigga.validate(this.anObject); trace("Is valid? " + report.isValid()); trace(report.getMessagesAsString()); ... and here is the output: Is valid? false errors (message | property | actualValue): number is out of range | price | -20 invalid type on property | id | string To see more examples take a look to the unit tests: https://github.com/raulbajales/Frigga/tree/master/src/test/actionscript/json/frigga/ TBD: ---- - Add support for "tuple typing" - Add a repository of schemas to handle schema composition by reference (noy it handles schema composition inline) - Add support for "Hyper Schema" - Add support for the following parts of the "Core Schema Definition": patternProxperties additionalProperties additionalItems required dependencies uniqueItems divisibleBy disallow extends $ref $schema
About
AS3 JSON Schema Validator
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published