Safe Haskell | None |
---|---|
Language | Haskell2010 |
Turn the validation functions into actual Validator
s.
From this point on they know how to parse themselves from JSON and also know how to extract subschemas embedded within themselves.
- run :: FromJSON b => (a -> b -> [c]) -> Maybe a -> Value -> [c]
- noEmbedded :: a -> ([b], [b])
- newtype MultipleOf = MultipleOf {}
- multipleOf :: Validator a (Maybe MultipleOf) ()
- data MaximumContext = MaximumContext Bool Scientific
- maximumVal :: Validator a (Maybe MaximumContext) MaximumInvalid
- data MinimumContext = MinimumContext Bool Scientific
- minimumVal :: Validator a (Maybe MinimumContext) MinimumInvalid
- newtype MaxLength = MaxLength {
- _unMaxLength :: Int
- maxLength :: Validator a (Maybe MaxLength) ()
- newtype MinLength = MinLength {
- _unMinLength :: Int
- minLength :: Validator a (Maybe MinLength) ()
- newtype PatternVal = PatternVal {}
- patternVal :: Validator a (Maybe PatternVal) ()
- newtype MaxItems = MaxItems {
- _unMaxItems :: Int
- maxItems :: Validator a (Maybe MaxItems) ()
- newtype MinItems = MinItems {
- _unMinItems :: Int
- minItems :: Validator a (Maybe MinItems) ()
- newtype UniqueItems = UniqueItems {}
- uniqueItems :: Validator a (Maybe UniqueItems) ()
- data ItemsContext schema = ItemsContext (Maybe (AdditionalItems schema)) (Items schema)
- items :: (schema -> Value -> [Fail err]) -> Validator schema (Maybe (ItemsContext schema)) (ItemsInvalid err)
- newtype AdditionalItemsContext schema = AdditionalItemsContext {
- _unAdditionalItemsContext :: AdditionalItems schema
- additionalItemsEmbedded :: Validator schema (Maybe (AdditionalItemsContext schema)) err
- newtype Definitions schema = Definitions {
- _unDefinitions :: HashMap Text schema
- definitionsEmbedded :: Validator schema (Maybe (Definitions schema)) err
- newtype MaxProperties = MaxProperties {}
- maxProperties :: Validator a (Maybe MaxProperties) ()
- newtype MinProperties = MinProperties {}
- minProperties :: Validator a (Maybe MinProperties) ()
- newtype RequiredContext = RequiredContext {}
- required :: Validator a (Maybe RequiredContext) ()
- newtype DependenciesContext schema = DependenciesContext {
- _unDependenciesContext :: HashMap Text (Dependency schema)
- dependencies :: (schema -> Value -> [Fail err]) -> Validator schema (Maybe (DependenciesContext schema)) (DependencyInvalid err)
- data PropertiesContext schema = PropertiesContext (Maybe (HashMap Text schema)) (Maybe (AdditionalProperties schema)) (HashMap Text schema)
- properties :: (schema -> Value -> [Fail err]) -> Validator schema (Maybe (PropertiesContext schema)) (PropertiesInvalid err)
- data PatternPropertiesContext schema = PatternPropertiesContext Bool (Maybe (AdditionalProperties schema)) (HashMap Text schema)
- patternProperties :: (schema -> Value -> [Fail err]) -> Validator schema (Maybe (PatternPropertiesContext schema)) (PatternPropertiesInvalid err)
- data AdditionalPropertiesContext schema = AdditionalPropertiesContext Bool (AdditionalProperties schema)
- additionalProperties :: (schema -> Value -> [Fail err]) -> Validator schema (Maybe (AdditionalPropertiesContext schema)) (AdditionalPropertiesInvalid err)
- newtype Ref = Ref {}
- ref :: (FromJSON schema, ToJSON schema) => VisitedSchemas -> Maybe Text -> (Maybe Text -> Maybe schema) -> (VisitedSchemas -> Maybe Text -> schema -> Value -> [Fail err]) -> Validator a (Maybe Ref) (RefInvalid err)
- newtype EnumContext = EnumContext {}
- enumVal :: Validator a (Maybe EnumContext) ()
- newtype TypeContext = TypeContext {}
- typeVal :: Validator a (Maybe TypeContext) ()
- newtype AllOf schema = AllOf {}
- allOf :: (schema -> Value -> [Fail err]) -> Validator schema (Maybe (AllOf schema)) err
- newtype AnyOf schema = AnyOf {}
- anyOf :: ToJSON schema => (schema -> Value -> [Fail err]) -> Validator schema (Maybe (AnyOf schema)) ()
- newtype OneOf schema = OneOf {}
- oneOf :: ToJSON schema => (schema -> Value -> [Fail err]) -> Validator schema (Maybe (OneOf schema)) ()
- newtype NotVal schema = NotVal {
- _unNotVal :: schema
- notVal :: ToJSON schema => (schema -> Value -> [Fail err]) -> Validator schema (Maybe (NotVal schema)) ()
Documentation
noEmbedded :: a -> ([b], [b]) Source #
For internal use.
Numbers
newtype MultipleOf Source #
multipleOf :: Validator a (Maybe MultipleOf) () Source #
data MaximumContext Source #
data MinimumContext Source #
Strings
newtype PatternVal Source #
patternVal :: Validator a (Maybe PatternVal) () Source #
Arrays
newtype UniqueItems Source #
uniqueItems :: Validator a (Maybe UniqueItems) () Source #
data ItemsContext schema Source #
ItemsContext (Maybe (AdditionalItems schema)) (Items schema) |
Eq schema => Eq (ItemsContext schema) Source # | |
Show schema => Show (ItemsContext schema) Source # | |
FromJSON schema => FromJSON (ItemsContext schema) Source # | |
items :: (schema -> Value -> [Fail err]) -> Validator schema (Maybe (ItemsContext schema)) (ItemsInvalid err) Source #
newtype AdditionalItemsContext schema Source #
Eq schema => Eq (AdditionalItemsContext schema) Source # | |
Show schema => Show (AdditionalItemsContext schema) Source # | |
FromJSON schema => FromJSON (AdditionalItemsContext schema) Source # | |
additionalItemsEmbedded :: Validator schema (Maybe (AdditionalItemsContext schema)) err Source #
Since items
will always take care of validating additionalItems
as well, the actual validation side of additionalItemsEmbedded
is
disabled.
newtype Definitions schema Source #
Definitions | |
|
Eq schema => Eq (Definitions schema) Source # | |
Show schema => Show (Definitions schema) Source # | |
FromJSON schema => FromJSON (Definitions schema) Source # | |
definitionsEmbedded :: Validator schema (Maybe (Definitions schema)) err Source #
Placing this here since it's similar to "additionalItems"
.
in that its validator doesn't run.
TODO: Add tests to the language agnostic test suite for both
"additionalItems"
and this.
Objects
newtype MaxProperties Source #
maxProperties :: Validator a (Maybe MaxProperties) () Source #
newtype MinProperties Source #
minProperties :: Validator a (Maybe MinProperties) () Source #
newtype RequiredContext Source #
newtype DependenciesContext schema Source #
DependenciesContext | |
|
Eq schema => Eq (DependenciesContext schema) Source # | |
Show schema => Show (DependenciesContext schema) Source # | |
FromJSON schema => FromJSON (DependenciesContext schema) Source # | |
dependencies :: (schema -> Value -> [Fail err]) -> Validator schema (Maybe (DependenciesContext schema)) (DependencyInvalid err) Source #
data PropertiesContext schema Source #
PropertiesContext (Maybe (HashMap Text schema)) (Maybe (AdditionalProperties schema)) (HashMap Text schema) |
Eq schema => Eq (PropertiesContext schema) Source # | |
Show schema => Show (PropertiesContext schema) Source # | |
FromJSON schema => FromJSON (PropertiesContext schema) Source # | |
properties :: (schema -> Value -> [Fail err]) -> Validator schema (Maybe (PropertiesContext schema)) (PropertiesInvalid err) Source #
data PatternPropertiesContext schema Source #
The first argument is whether the validator should be run.
If "properties"
exists it will be parsed to False
.
PatternPropertiesContext Bool (Maybe (AdditionalProperties schema)) (HashMap Text schema) |
Eq schema => Eq (PatternPropertiesContext schema) Source # | |
Show schema => Show (PatternPropertiesContext schema) Source # | |
FromJSON schema => FromJSON (PatternPropertiesContext schema) Source # | |
patternProperties :: (schema -> Value -> [Fail err]) -> Validator schema (Maybe (PatternPropertiesContext schema)) (PatternPropertiesInvalid err) Source #
data AdditionalPropertiesContext schema Source #
The first argument is whether the validator should be run.
If "properties"
or "patternProperties"
exist it will be parsed
to False
.
Eq schema => Eq (AdditionalPropertiesContext schema) Source # | |
Show schema => Show (AdditionalPropertiesContext schema) Source # | |
FromJSON schema => FromJSON (AdditionalPropertiesContext schema) Source # | |
additionalProperties :: (schema -> Value -> [Fail err]) -> Validator schema (Maybe (AdditionalPropertiesContext schema)) (AdditionalPropertiesInvalid err) Source #
Any
ref :: (FromJSON schema, ToJSON schema) => VisitedSchemas -> Maybe Text -> (Maybe Text -> Maybe schema) -> (VisitedSchemas -> Maybe Text -> schema -> Value -> [Fail err]) -> Validator a (Maybe Ref) (RefInvalid err) Source #
newtype EnumContext Source #
newtype TypeContext Source #
anyOf :: ToJSON schema => (schema -> Value -> [Fail err]) -> Validator schema (Maybe (AnyOf schema)) () Source #
oneOf :: ToJSON schema => (schema -> Value -> [Fail err]) -> Validator schema (Maybe (OneOf schema)) () Source #