commit | b8c4da1f2f890e1b6da8d27373047b34eb647b62 | [log] [tgz] |
---|---|---|
author | Tim Olsen <tim.olsen@10gen.com> | Fri Sep 06 09:46:22 2013 -0400 |
committer | Tim Olsen <tim.olsen@10gen.com> | Fri Sep 06 09:46:22 2013 -0400 |
tree | 9051589a15b72a01dc6e0965b0f97b877544a6c1 | |
parent | 9f9dce7f304cd3c0b93472e8028d71da0e1cafd7 [diff] | |
parent | edb822b0ef26fb71646442d572fa6c3309e73897 [diff] |
Merge remote-tracking branch 'sigu-399/master' into patternProperties-are-not-additionalProperties Conflicts: validation.go
An implementation of JSON Schema, based on IETF's draft v4 - Go language
Functional, two features are missing : dependencies as schemas and id(s) as scope for references
Test phase : Passed 97% of Json Schema Test Suite
Internal improvements/refactoring in progress, anyway the interface will not change
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("/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
https://github.com/sigu-399/gojsonpointer
https://github.com/sigu-399/gojsonreference
gojsonschema uses the following test suite :