aeson-schema 0.3.0.2 → 0.3.0.3
raw patch · 3 files changed
+143/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- aeson-schema.cabal +2/−1
- examples/schema.json +137/−0
- test/Data/Aeson/Schema/Types/Tests.hs +4/−1
aeson-schema.cabal view
@@ -1,5 +1,5 @@ name: aeson-schema-version: 0.3.0.2+version: 0.3.0.3 synopsis: Haskell JSON schema validator and parser generator -- description: homepage: https://github.com/timjb/aeson-schema@@ -12,6 +12,7 @@ cabal-version: >=1.8 data-files: test/test-suite/tests/draft3/optional/*.json, test/test-suite/tests/draft3/*.json+ examples/schema.json source-repository head type: git
+ examples/schema.json view
@@ -0,0 +1,137 @@+{ + "id" : "http://json-schema.org/schema#", + "type" : ["object","string"], + "format": "uri", + + "properties" : { + "type" : { + "type" : ["string", "array"], + "items" : { + "type" : ["string", { "$ref" : "#" }] + }, + "uniqueItems" : true, + "default" : "any" + }, + + "properties" : { + "type" : "object", + "additionalProperties" : { "$ref" : "#" }, + "default" : {} + }, + + "items" : { + "type" : [{ "$ref" : "#" }, "array"], + "items" : { "$ref" : "#" }, + "default" : {} + }, + + "required" : { + "type" : "boolean", + "default" : false + }, + + "additionalProperties" : { + "type" : [{ "$ref" : "#" }, "boolean"], + "default" : {} + }, + "additionalItems" : { + "type" : [{ "$ref" : "#" }, "boolean"], + "default" : {} + }, + + "requires" : { + "type" : ["string", { "$ref" : "#" }] + }, + + "minimum" : { + "type" : "number" + }, + + "maximum" : { + "type" : "number" + }, + + "exclusiveMinimum" : { + "type" : "number" + }, + + "exclusiveMaximum" : { + "type" : "number" + }, + + "minItems" : { + "type" : "integer", + "minimum" : 0, + "default" : 0 + }, + + "maxItems" : { + "type" : "integer" + }, + + "uniqueItems" : { + "type" : "boolean", + "default" : false + }, + + "pattern" : { + "type" : "string", + "format" : "regex" + }, + + "minLength" : { + "type" : "integer", + "minimum" : 0, + "default" : 0 + }, + + "maxLength" : { + "type" : "integer" + }, + + "enum" : { + "type" : "array", + "minItems" : 1, + "uniqueItems" : true + }, + + "title" : { + "type" : "string" + }, + + "description" : { + "type" : "string" + }, + + "format" : { + "type" : "string" + }, + + "maxDecimal" : { + "type" : "number", + "minimum" : 0 + }, + + "disallow" : { + "type" : ["string", "array", { "$ref" : "#" }], + "items" : { + "type" : ["string", { "$ref" : "#" }] + }, + "uniqueItems" : true + }, + + "extends" : { + "type" : [{ "$ref" : "#" }, "array"], + "items" : { "$ref" : "#" }, + "default" : {} + } + }, + "links" : [ + { + "href" : "{id}", + "rel" : "self" + } + ], + + "default" : {} +}
test/Data/Aeson/Schema/Types/Tests.hs view
@@ -15,6 +15,8 @@ import Data.Aeson.Schema import Data.Aeson.Schema.Choice +import Paths_aeson_schema (getDataFileName)+ data TestFunctor a = TestFunctor Int a instance Functor TestFunctor where@@ -23,7 +25,8 @@ tests :: [Test] tests = [ testCase "parse schema.json" $ do- schemaBS <- L.readFile "examples/schema.json"+ schemaJson <- getDataFileName "examples/schema.json"+ schemaBS <- L.readFile schemaJson case decode schemaBS :: Maybe Value of Nothing -> HU.assertFailure "JSON syntax error" Just val -> case fromJSON val :: Result (Schema Text) of