Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.Validator.Draft4.Object
Contents
- maxProperties :: Int -> HashMap Text Value -> Maybe (Fail ())
- minProperties :: Int -> HashMap Text Value -> Maybe (Fail ())
- newtype Required = Required {
- _unRequired :: Set Text
- required :: Required -> HashMap Text Value -> Maybe (Fail ())
- data Dependency schema
- = SchemaDependency schema
- | PropertyDependency (Set Text)
- data DependencyInvalid err
- dependencies :: forall err schema. (schema -> Value -> [Fail err]) -> HashMap Text (Dependency schema) -> HashMap Text Value -> [Fail (DependencyInvalid err)]
- newtype Remaining = Remaining {}
- data PropertiesInvalid err
- = PropertiesInvalid err
- | PropPatternInvalid err
- | PropAdditionalInvalid (AdditionalPropertiesInvalid err)
- properties :: forall err schema. (schema -> Value -> [Fail err]) -> Maybe (HashMap Text schema) -> Maybe (AdditionalProperties schema) -> HashMap Text schema -> HashMap Text Value -> [Fail (PropertiesInvalid err)]
- data PatternPropertiesInvalid err
- patternProperties :: forall err schema. (schema -> Value -> [Fail err]) -> Bool -> Maybe (AdditionalProperties schema) -> HashMap Text schema -> HashMap Text Value -> [Fail (PatternPropertiesInvalid err)]
- patternAndUnmatched :: forall err schema. (schema -> Value -> [Fail err]) -> HashMap Text schema -> HashMap Text Value -> ([Fail err], Remaining)
- data AdditionalProperties schema
- data AdditionalPropertiesInvalid err
- = APBoolInvalid
- | APObjectInvalid err
- additionalProperties :: forall err schema. (schema -> Value -> [Fail err]) -> Bool -> AdditionalProperties schema -> HashMap Text Value -> [Fail (AdditionalPropertiesInvalid err)]
- additionalPropertiesBool :: Bool -> HashMap Text Value -> [Fail ()]
- additionalPropertiesObject :: forall err schema. (schema -> Value -> [Fail err]) -> schema -> HashMap Text Value -> [Fail err]
maxProperties
maxProperties :: Int -> HashMap Text Value -> Maybe (Fail ()) Source #
The spec requires "maxProperties"
to be non-negative.
minProperties
minProperties :: Int -> HashMap Text Value -> Maybe (Fail ()) Source #
The spec requires "minProperties"
to be non-negative.
required
From the spec:
The value of this keyword MUST be an array. This array MUST have at least one element. Elements of this array MUST be strings, and MUST be unique.
We don't enfore that Required
has at least one element in the
haskell code, but we do in the FromJSON
instance.
Constructors
Required | |
Fields
|
dependencies
data Dependency schema Source #
Constructors
SchemaDependency schema | |
PropertyDependency (Set Text) |
Instances
Eq schema => Eq (Dependency schema) Source # | |
Show schema => Show (Dependency schema) Source # | |
Arbitrary schema => Arbitrary (Dependency schema) Source # | |
FromJSON schema => FromJSON (Dependency schema) Source # | |
ToJSON schema => ToJSON (Dependency schema) Source # | |
data DependencyInvalid err Source #
Constructors
SchemaDependencyInvalid err | |
PropertyDependencyInvalid |
Instances
Eq err => Eq (DependencyInvalid err) Source # | |
Show err => Show (DependencyInvalid err) Source # | |
dependencies :: forall err schema. (schema -> Value -> [Fail err]) -> HashMap Text (Dependency schema) -> HashMap Text Value -> [Fail (DependencyInvalid err)] Source #
From the spec: http://json-schema.org/latest/json-schema-validation.html#anchor70
This keyword's value MUST be an object. Each value of this object MUST be either an object or an array. If the value is an object, it MUST be a valid JSON Schema. This is called a schema dependency. If the value is an array, it MUST have at least one element. Each element MUST be a string, and elements in the array MUST be unique. This is called a property dependency.
For internal use.
Constructors
Remaining | |
Fields |
properties
data PropertiesInvalid err Source #
Constructors
PropertiesInvalid err | |
PropPatternInvalid err | |
PropAdditionalInvalid (AdditionalPropertiesInvalid err) |
Instances
Eq err => Eq (PropertiesInvalid err) Source # | |
Show err => Show (PropertiesInvalid err) Source # | |
properties :: forall err schema. (schema -> Value -> [Fail err]) -> Maybe (HashMap Text schema) -> Maybe (AdditionalProperties schema) -> HashMap Text schema -> HashMap Text Value -> [Fail (PropertiesInvalid err)] Source #
In order of what's tried: "properties"
, "patternProperties"
,
"additionalProperties"
.
patternProperties
data PatternPropertiesInvalid err Source #
Constructors
PPInvalid err | |
PPAdditionalPropertiesInvalid (AdditionalPropertiesInvalid err) |
Instances
Eq err => Eq (PatternPropertiesInvalid err) Source # | |
Show err => Show (PatternPropertiesInvalid err) Source # | |
patternProperties :: forall err schema. (schema -> Value -> [Fail err]) -> Bool -> Maybe (AdditionalProperties schema) -> HashMap Text schema -> HashMap Text Value -> [Fail (PatternPropertiesInvalid err)] Source #
patternAndUnmatched :: forall err schema. (schema -> Value -> [Fail err]) -> HashMap Text schema -> HashMap Text Value -> ([Fail err], Remaining) Source #
additionalProperties
data AdditionalProperties schema Source #
Constructors
AdditionalPropertiesBool Bool | |
AdditionalPropertiesObject schema |
Instances
Eq schema => Eq (AdditionalProperties schema) Source # | |
Show schema => Show (AdditionalProperties schema) Source # | |
Arbitrary schema => Arbitrary (AdditionalProperties schema) Source # | |
FromJSON schema => FromJSON (AdditionalProperties schema) Source # | |
ToJSON schema => ToJSON (AdditionalProperties schema) Source # | |
data AdditionalPropertiesInvalid err Source #
Constructors
APBoolInvalid | |
APObjectInvalid err |
Instances
Eq err => Eq (AdditionalPropertiesInvalid err) Source # | |
Show err => Show (AdditionalPropertiesInvalid err) Source # | |
additionalProperties :: forall err schema. (schema -> Value -> [Fail err]) -> Bool -> AdditionalProperties schema -> HashMap Text Value -> [Fail (AdditionalPropertiesInvalid err)] Source #