aeson-schema-0.3.0.7: Haskell JSON schema validator and parser generator

Safe HaskellNone
LanguageHaskell98

Data.Aeson.Schema.Types

Synopsis

Documentation

data Pattern Source

Compiled regex and its source

Constructors

Pattern 

mkPattern :: Monad m => Text -> m Pattern Source

Compile a regex to a pattern, reporting errors with fail

data Schema ref Source

 JSON Schema (Draft 3) Core Schema Definition

Constructors

Schema 

Fields

schemaType :: [Choice2 SchemaType (Schema ref)]

List of allowed schema types

schemaProperties :: HashMap Text (Schema ref)

Subschemas for properties

schemaPatternProperties :: [(Pattern, Schema ref)]

All properties that match one of the regexes must validate against the associated schema

schemaAdditionalProperties :: Choice2 Bool (Schema ref)

Whether additional properties are allowed when the instance is an object, and if so, a schema that they have to validate against

schemaItems :: Maybe (Choice2 (Schema ref) [Schema ref])

Either a schema for all array items or a different schema for each position in the array

schemaAdditionalItems :: Choice2 Bool (Schema ref)

Whether additional items are allowed

schemaRequired :: Bool

When this schema is used in a property of another schema, this means that the property must have a value and not be undefined

schemaDependencies :: HashMap Text (Choice2 [Text] (Schema ref))

Map of dependencies (property a requires properties b and c, property a requires the instance to validate against another schema, etc.)

schemaMinimum :: Maybe Scientific

Minimum value when the instance is a number

schemaMaximum :: Maybe Scientific

Maximum value when the instance is a number

schemaExclusiveMinimum :: Bool

Whether the minimum value is exclusive (only numbers greater than the minimum are allowed)

schemaExclusiveMaximum :: Bool

Whether the maximum value is exclusive (only numbers less than the maximum are allowed)

schemaMinItems :: Int

Minimum length for arrays

schemaMaxItems :: Maybe Int

Maximum length for arrays

schemaUniqueItems :: Bool

Whether all array items must be distinct from each other

schemaPattern :: Maybe Pattern

Regex for validating strings

schemaMinLength :: Int

Minimum length for strings

schemaMaxLength :: Maybe Int

Maximum length for strings

schemaEnum :: Maybe [Value]

Allowed values for this schema

schemaEnumDescriptions :: Maybe [Text]

Extension by Google: description for the values in schemaEnum

schemaDefault :: Maybe Value

Default value if this schema is used in a property of another schema and the value is undefined

schemaTitle :: Maybe Text

Short description of the instance property

schemaDescription :: Maybe Text

Full description of the purpose of the instance property

schemaFormat :: Maybe Text

Format of strings, e.g. 'data-time', regex or email

schemaDivisibleBy :: Maybe Scientific

When the instance is a number, it must be divisible by this number with no remainder

schemaDisallow :: [Choice2 SchemaType (Schema ref)]

List of disallowed types

schemaExtends :: [Schema ref]

Base schema that the current schema inherits from

schemaId :: Maybe Text

Identifier of the current schema

schemaDRef :: Maybe ref

$ref: reference to another schema

schemaDSchema :: Maybe Text

$schema: URI of a schema that defines the format of the current schema

Instances

Functor Schema 
Foldable Schema 
Eq ref => Eq (Schema ref) 
Show ref => Show (Schema ref) 
FromJSON ref => FromJSON (Schema ref) 
(Eq ref, Lift ref) => Lift (Schema ref) 

type Graph f ref = Map ref (f ref) Source

Set of potentially mutually recursive schemas

empty :: Schema ref Source

 The empty schema accepts any JSON value.

schemaQQ :: QuasiQuoter Source

 QuasiQuoter for schemas in JSON (e.g. [schemaQQ| { "type": "number", "minimum": 0 } |])