commit | 9d03a15178da31c6af2998a05f4aad92b8169726 | [log] [tgz] |
---|---|---|
author | sigu-399 <sigu.399@gmail.com> | Tue Jun 25 16:44:10 2013 +0800 |
committer | sigu-399 <sigu.399@gmail.com> | Tue Jun 25 16:44:10 2013 +0800 |
tree | 6fe9827a1c94fcf5f1a984cd1486677aa2bef990 | |
parent | a5c4a06a82609cd147fdb48877b25def246f4d1c [diff] |
small cleanup
An implementation of JSON Schema, based on IETF's draft v4 - Go language
Functional, only one feature is missing : dependencies as schemas
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("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
https://github.com/sigu-399/gojsonpointer
https://github.com/sigu-399/gojsonreference
gojsonschema uses the following test suite :