├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── benchmark_test.go ├── cmd └── jsschema │ └── jsschema.go ├── default.go ├── errors.go ├── interface.go ├── marshal.go ├── marshal_test.go ├── primitives.go ├── schema.go ├── schema_example_test.go ├── schema_test.go ├── test ├── allof.json ├── allof_fail001.json ├── allof_fail002.json ├── allof_pass.json ├── anyof.json ├── anyof_fail.json ├── anyof_pass001.json ├── anyof_pass002.json ├── array.json ├── array_fail001.json ├── array_pass001.json ├── array_pass002.json ├── arraylength.json ├── arraylength_fail001.json ├── arraylength_fail002.json ├── arraylength_fail003.json ├── arraylength_pass001.json ├── arraylength_pass002.json ├── arraytuple.json ├── arraytuple_disallow_additional.json ├── arraytuple_disallow_additional_fail001.json ├── arraytuple_disallow_additional_pass001.json ├── arraytuple_disallow_additional_pass002.json ├── arraytuple_fail001.json ├── arraytuple_fail002.json ├── arraytuple_pass001.json ├── arraytuple_pass002.json ├── arraytuple_pass003.json ├── arrayunique.json ├── arrayunique_fail001.json ├── arrayunique_pass001.json ├── arrayunique_pass002.json ├── boolean.json ├── boolean_fail001.json ├── boolean_fail002.json ├── boolean_pass001.json ├── boolean_pass002.json ├── business.json ├── business_fail.json ├── business_pass.json ├── definitions.json ├── integer.json ├── integer_fail001.json ├── integer_fail002.json ├── integer_pass001.json ├── integer_pass002.json ├── not.json ├── not_fail.json ├── not_pass001.json ├── not_pass002.json ├── null.json ├── null_fail001.json ├── null_fail002.json ├── null_fail003.json ├── null_pass001.json ├── numrange.json ├── numrange_exclmax.json ├── numrange_exclmax_fail001.json ├── numrange_exclmax_fail002.json ├── numrange_exclmax_fail003.json ├── numrange_exclmax_pass001.json ├── numrange_exclmax_pass002.json ├── numrange_exclmax_pass003.json ├── numrange_pass001.json ├── numrange_pass002.json ├── objectpatterns.json ├── objectpatterns_fail001.json ├── objectpatterns_fail002.json ├── objectpatterns_fail003.json ├── objectpatterns_pass001.json ├── objectpropdepend.json ├── objectpropdepend_fail001.json ├── objectpropdepend_pass001.json ├── objectpropdepend_pass002.json ├── objectpropdepend_pass003.json ├── objectproprequired.json ├── objectproprequired_fail001.json ├── objectproprequired_pass001.json ├── objectproprequired_pass002.json ├── objectpropsize.json ├── objectpropsize_fail001.json ├── objectpropsize_fail002.json ├── objectpropsize_fail003.json ├── objectpropsize_pass001.json ├── objectpropsize_pass002.json ├── oneof.json ├── oneof_fail.json ├── oneof_pass001.json ├── oneof_pass002.json ├── qiita.json ├── schema.json ├── strlen.json ├── strlen_fail001.json ├── strlen_pass.json ├── strpattern.json ├── strpattern_fail001.json ├── strpattern_fail002.json ├── strpattern_pass001.json └── strpattern_pass002.json └── validator └── validator.go /.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/.gitignore -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/.travis.yml -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/LICENSE -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/README.md -------------------------------------------------------------------------------- /benchmark_test.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/benchmark_test.go -------------------------------------------------------------------------------- /cmd/jsschema/jsschema.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/cmd/jsschema/jsschema.go -------------------------------------------------------------------------------- /default.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/default.go -------------------------------------------------------------------------------- /errors.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/errors.go -------------------------------------------------------------------------------- /interface.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/interface.go -------------------------------------------------------------------------------- /marshal.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/marshal.go -------------------------------------------------------------------------------- /marshal_test.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/marshal_test.go -------------------------------------------------------------------------------- /primitives.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/primitives.go -------------------------------------------------------------------------------- /schema.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/schema.go -------------------------------------------------------------------------------- /schema_example_test.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/schema_example_test.go -------------------------------------------------------------------------------- /schema_test.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/schema_test.go -------------------------------------------------------------------------------- /test/allof.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/allof.json -------------------------------------------------------------------------------- /test/allof_fail001.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": 10 3 | } 4 | -------------------------------------------------------------------------------- /test/allof_fail002.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": 9 3 | } 4 | -------------------------------------------------------------------------------- /test/allof_pass.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": 15 3 | } 4 | -------------------------------------------------------------------------------- /test/anyof.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/anyof.json -------------------------------------------------------------------------------- /test/anyof_fail.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/anyof_fail.json -------------------------------------------------------------------------------- /test/anyof_pass001.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": "Hello" 3 | } -------------------------------------------------------------------------------- /test/anyof_pass002.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": 42 3 | } -------------------------------------------------------------------------------- /test/array.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/array.json -------------------------------------------------------------------------------- /test/array_fail001.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": {"Not": "an array"} 3 | } -------------------------------------------------------------------------------- /test/array_pass001.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": [1, 2, 3, 4, 5] 3 | } -------------------------------------------------------------------------------- /test/array_pass002.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/array_pass002.json -------------------------------------------------------------------------------- /test/arraylength.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/arraylength.json -------------------------------------------------------------------------------- /test/arraylength_fail001.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": [] 3 | } -------------------------------------------------------------------------------- /test/arraylength_fail002.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": [1] 3 | } 4 | -------------------------------------------------------------------------------- /test/arraylength_fail003.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": [1, 2, 3, 4] 3 | } -------------------------------------------------------------------------------- /test/arraylength_pass001.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": [1, 2] 3 | } -------------------------------------------------------------------------------- /test/arraylength_pass002.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": [1, 2, 3] 3 | } -------------------------------------------------------------------------------- /test/arraytuple.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/arraytuple.json -------------------------------------------------------------------------------- /test/arraytuple_disallow_additional.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/arraytuple_disallow_additional.json -------------------------------------------------------------------------------- /test/arraytuple_disallow_additional_fail001.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/arraytuple_disallow_additional_fail001.json -------------------------------------------------------------------------------- /test/arraytuple_disallow_additional_pass001.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/arraytuple_disallow_additional_pass001.json -------------------------------------------------------------------------------- /test/arraytuple_disallow_additional_pass002.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": [1600, "Pennsylvania", "Avenue"] 3 | } -------------------------------------------------------------------------------- /test/arraytuple_fail001.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": [24, "Sussex", "Drive"] 3 | } 4 | -------------------------------------------------------------------------------- /test/arraytuple_fail002.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": ["Palais de l'Élysée"] 3 | } -------------------------------------------------------------------------------- /test/arraytuple_pass001.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/arraytuple_pass001.json -------------------------------------------------------------------------------- /test/arraytuple_pass002.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": [10, "Downing", "Street"] 3 | } -------------------------------------------------------------------------------- /test/arraytuple_pass003.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/arraytuple_pass003.json -------------------------------------------------------------------------------- /test/arrayunique.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/arrayunique.json -------------------------------------------------------------------------------- /test/arrayunique_fail001.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/arrayunique_fail001.json -------------------------------------------------------------------------------- /test/arrayunique_pass001.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": [1, 2, 3, 4, 5] 3 | } 4 | -------------------------------------------------------------------------------- /test/arrayunique_pass002.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": [] 3 | } 4 | -------------------------------------------------------------------------------- /test/boolean.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/boolean.json -------------------------------------------------------------------------------- /test/boolean_fail001.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": "true" 3 | } 4 | -------------------------------------------------------------------------------- /test/boolean_fail002.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": 0 3 | } 4 | -------------------------------------------------------------------------------- /test/boolean_pass001.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": true 3 | } 4 | -------------------------------------------------------------------------------- /test/boolean_pass002.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": false 3 | } 4 | -------------------------------------------------------------------------------- /test/business.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/business.json -------------------------------------------------------------------------------- /test/business_fail.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/business_fail.json -------------------------------------------------------------------------------- /test/business_pass.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/business_pass.json -------------------------------------------------------------------------------- /test/definitions.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/definitions.json -------------------------------------------------------------------------------- /test/integer.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/integer.json -------------------------------------------------------------------------------- /test/integer_fail001.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": 3.1415926 3 | } -------------------------------------------------------------------------------- /test/integer_fail002.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": "42" 3 | } -------------------------------------------------------------------------------- /test/integer_pass001.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": 42 3 | } -------------------------------------------------------------------------------- /test/integer_pass002.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": -1 3 | } -------------------------------------------------------------------------------- /test/not.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/not.json -------------------------------------------------------------------------------- /test/not_fail.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": "Hello, World!" 3 | } -------------------------------------------------------------------------------- /test/not_pass001.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": 42 3 | } -------------------------------------------------------------------------------- /test/not_pass002.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": { "Hello": "World" } 3 | } -------------------------------------------------------------------------------- /test/null.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/null.json -------------------------------------------------------------------------------- /test/null_fail001.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": false 3 | } 4 | -------------------------------------------------------------------------------- /test/null_fail002.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": 0 3 | } 4 | -------------------------------------------------------------------------------- /test/null_fail003.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": "" 3 | } 4 | -------------------------------------------------------------------------------- /test/null_pass001.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": null 3 | } 4 | -------------------------------------------------------------------------------- /test/numrange.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/numrange.json -------------------------------------------------------------------------------- /test/numrange_exclmax.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/numrange_exclmax.json -------------------------------------------------------------------------------- /test/numrange_exclmax_fail001.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": -1 3 | } -------------------------------------------------------------------------------- /test/numrange_exclmax_fail002.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": 100 3 | } -------------------------------------------------------------------------------- /test/numrange_exclmax_fail003.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": 101 3 | } -------------------------------------------------------------------------------- /test/numrange_exclmax_pass001.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": 0 3 | } -------------------------------------------------------------------------------- /test/numrange_exclmax_pass002.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": 10 3 | } -------------------------------------------------------------------------------- /test/numrange_exclmax_pass003.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": 99 3 | } -------------------------------------------------------------------------------- /test/numrange_pass001.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": 2 3 | } 4 | -------------------------------------------------------------------------------- /test/numrange_pass002.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": 2.2360679775 3 | } 4 | -------------------------------------------------------------------------------- /test/objectpatterns.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/objectpatterns.json -------------------------------------------------------------------------------- /test/objectpatterns_fail001.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/objectpatterns_fail001.json -------------------------------------------------------------------------------- /test/objectpatterns_fail002.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/objectpatterns_fail002.json -------------------------------------------------------------------------------- /test/objectpatterns_fail003.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/objectpatterns_fail003.json -------------------------------------------------------------------------------- /test/objectpatterns_pass001.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/objectpatterns_pass001.json -------------------------------------------------------------------------------- /test/objectpropdepend.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/objectpropdepend.json -------------------------------------------------------------------------------- /test/objectpropdepend_fail001.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/objectpropdepend_fail001.json -------------------------------------------------------------------------------- /test/objectpropdepend_pass001.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/objectpropdepend_pass001.json -------------------------------------------------------------------------------- /test/objectpropdepend_pass002.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "John Doe" 3 | } -------------------------------------------------------------------------------- /test/objectpropdepend_pass003.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/objectpropdepend_pass003.json -------------------------------------------------------------------------------- /test/objectproprequired.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/objectproprequired.json -------------------------------------------------------------------------------- /test/objectproprequired_fail001.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/objectproprequired_fail001.json -------------------------------------------------------------------------------- /test/objectproprequired_pass001.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/objectproprequired_pass001.json -------------------------------------------------------------------------------- /test/objectproprequired_pass002.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/objectproprequired_pass002.json -------------------------------------------------------------------------------- /test/objectpropsize.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/objectpropsize.json -------------------------------------------------------------------------------- /test/objectpropsize_fail001.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": {} 3 | } -------------------------------------------------------------------------------- /test/objectpropsize_fail002.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": { "a": 0 } 3 | } -------------------------------------------------------------------------------- /test/objectpropsize_fail003.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/objectpropsize_fail003.json -------------------------------------------------------------------------------- /test/objectpropsize_pass001.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/objectpropsize_pass001.json -------------------------------------------------------------------------------- /test/objectpropsize_pass002.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/objectpropsize_pass002.json -------------------------------------------------------------------------------- /test/oneof.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/oneof.json -------------------------------------------------------------------------------- /test/oneof_fail.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": 15 3 | } -------------------------------------------------------------------------------- /test/oneof_pass001.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": 10 3 | } -------------------------------------------------------------------------------- /test/oneof_pass002.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": 9 3 | } -------------------------------------------------------------------------------- /test/qiita.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/qiita.json -------------------------------------------------------------------------------- /test/schema.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/schema.json -------------------------------------------------------------------------------- /test/strlen.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/strlen.json -------------------------------------------------------------------------------- /test/strlen_fail001.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": "hello, world!" 3 | } -------------------------------------------------------------------------------- /test/strlen_pass.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/strlen_pass.json -------------------------------------------------------------------------------- /test/strpattern.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/test/strpattern.json -------------------------------------------------------------------------------- /test/strpattern_fail001.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": "(888)555-1212 ext. 532" 3 | } -------------------------------------------------------------------------------- /test/strpattern_fail002.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": "(800)FLOWERS" 3 | } -------------------------------------------------------------------------------- /test/strpattern_pass001.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": "555-1212" 3 | } -------------------------------------------------------------------------------- /test/strpattern_pass002.json: -------------------------------------------------------------------------------- 1 | { 2 | "payload": "(888)555-1212" 3 | } -------------------------------------------------------------------------------- /validator/validator.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lestrrat-go/jsschema/HEAD/validator/validator.go --------------------------------------------------------------------------------