commit | 59c4263d0e30b5521f05800fdd63bb10003f95fe | [log] [tgz] |
---|---|---|
author | sigu-399 <sigu.399@gmail.com> | Fri Sep 06 13:25:55 2013 +0800 |
committer | sigu-399 <sigu.399@gmail.com> | Fri Sep 06 13:25:55 2013 +0800 |
tree | 1c933fe06d51f85a3b55027592c11f912acbb4d0 | |
parent | ea6c572e78e488941fa382b000471adb18e0d11d [diff] | |
parent | c662ebf85c06ef3084862b3989fcc7a88b4fab93 [diff] |
Merge branch 'master' of https://github.com/sigu-399/gojsonschema 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 :