commit | 0f9dc83d67ae5242f50e4502d5e277eb41ab74fc | [log] [tgz] |
---|---|---|
author | sigu-399 <sigu.399@gmail.com> | Fri Jun 21 17:09:11 2013 +0800 |
committer | sigu-399 <sigu.399@gmail.com> | Fri Jun 21 17:09:11 2013 +0800 |
tree | 5633faafc6269dac993e34b9ba15fbfdf975e5d6 | |
parent | 0572d9ddb7fdaf0a23ff54db5fc88eada0477334 [diff] |
now handles patternProperties validation
An implementation of JSON Schema, based on IETF's draft v4 - Go language
Working, but not all keyword are yet implemented.
What is missing : definitions, dependencies, full coverage of items, additionalItems
Testing / debugging / improvements in progress ( 71% of Json Schema Test Suite )
package main import ( "github.com/sigu-399/gojsonschema" "fmt" ) func main() { schema, err := gojsonschema.NewJsonSchemaDocument("http://myhost/bla/schema1.json") // OR //schema, err := gojsonschema.NewJsonSchemaDocument("file:///home/me/myschemas/schema1.json") if err != nil { panic(err.Error()) } jsonToValidate, err := gojsonschema.GetHttpJson("http://myotherhost/blu/extract56.json") // OR //jsonToValidate, err := gojsonschema.GetFileJson("file:///home/billy/hotels.json") if err != nil { panic(err.Error()) } validationResult := schema.Validate(jsonToValidate) fmt.Printf("IsValid %v\n", validationResult.IsValid()) fmt.Printf("%v\n", validationResult.GetErrorMessages()) }
###Website http://json-schema.org
###Schema Core http://json-schema.org/latest/json-schema-core.html
###Schema Validation http://json-schema.org/latest/json-schema-validation.html