Safe Haskell | None |
---|---|
Language | Haskell2010 |
Turn the validation functions into actual Validator
s.
This is frankly a lot of busywork. It can perhaps be moved into the validator modules themselves once we're sure this is the right design.
- run :: FromJSON b => (a -> b -> Maybe c) -> Maybe a -> Value -> [c]
- noEmbedded :: a -> ([b], [b])
- multipleOfValidator :: Validator a (Maybe MultipleOf) MultipleOfInvalid
- maximumValidator :: Validator a (Maybe Maximum) MaximumInvalid
- minimumValidator :: Validator a (Maybe Minimum) MinimumInvalid
- maxLengthValidator :: Validator a (Maybe MaxLength) MaxLengthInvalid
- minLengthValidator :: Validator a (Maybe MinLength) MinLengthInvalid
- patternValidator :: Validator a (Maybe PatternValidator) PatternInvalid
- maxItemsValidator :: Validator a (Maybe MaxItems) MaxItemsInvalid
- minItemsValidator :: Validator a (Maybe MinItems) MinItemsInvalid
- uniqueItemsValidator :: Validator a (Maybe UniqueItems) UniqueItemsInvalid
- itemsRelatedValidator :: (schema -> Value -> [err]) -> Validator schema (ItemsRelated schema) (ItemsRelatedInvalid err)
- maxPropertiesValidator :: Validator a (Maybe MaxProperties) MaxPropertiesInvalid
- minPropertiesValidator :: Validator a (Maybe MinProperties) MinPropertiesInvalid
- requiredValidator :: Validator a (Maybe Required) RequiredInvalid
- dependenciesValidator :: (schema -> Value -> [err]) -> Validator schema (Maybe (DependenciesValidator schema)) (DependenciesInvalid err)
- propertiesRelatedValidator :: (schema -> Value -> [err]) -> Validator schema (PropertiesRelated schema) (PropertiesRelatedInvalid err)
- newtype Definitions schema = Definitions {
- _unDefinitions :: HashMap Text schema
- definitionsEmbedded :: Validator schema (Maybe (Definitions schema)) err
- refValidator :: (FromJSON schema, ToJSON schema) => (Text -> Maybe schema) -> (BaseURI -> schema -> BaseURI) -> (VisitedSchemas -> Scope schema -> schema -> Value -> [err]) -> VisitedSchemas -> Scope schema -> Validator a (Maybe Ref) (RefInvalid err)
- enumValidator :: Validator a (Maybe EnumValidator) EnumInvalid
- typeValidator :: Validator a (Maybe TypeContext) TypeValidatorInvalid
- allOfValidator :: (schema -> Value -> [err]) -> Validator schema (Maybe (AllOf schema)) (AllOfInvalid err)
- anyOfValidator :: (schema -> Value -> [err]) -> Validator schema (Maybe (AnyOf schema)) (AnyOfInvalid err)
- oneOfValidator :: ToJSON schema => (schema -> Value -> [err]) -> Validator schema (Maybe (OneOf schema)) (OneOfInvalid err)
- notValidator :: ToJSON schema => (schema -> Value -> [err]) -> Validator schema (Maybe (NotValidator schema)) NotValidatorInvalid
Documentation
run :: FromJSON b => (a -> b -> Maybe c) -> Maybe a -> Value -> [c] Source #
For internal use.
Take a validation function, a possibly existing validator, and some data. If the validator is exists and can validate the type of data we have, attempt to do so and return any failures.
noEmbedded :: a -> ([b], [b]) Source #
For internal use.
Numbers
Strings
Arrays
itemsRelatedValidator :: (schema -> Value -> [err]) -> Validator schema (ItemsRelated schema) (ItemsRelatedInvalid err) Source #
Objects
dependenciesValidator :: (schema -> Value -> [err]) -> Validator schema (Maybe (DependenciesValidator schema)) (DependenciesInvalid err) Source #
propertiesRelatedValidator :: (schema -> Value -> [err]) -> Validator schema (PropertiesRelated schema) (PropertiesRelatedInvalid err) Source #
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 #
Any
refValidator :: (FromJSON schema, ToJSON schema) => (Text -> Maybe schema) -> (BaseURI -> schema -> BaseURI) -> (VisitedSchemas -> Scope schema -> schema -> Value -> [err]) -> VisitedSchemas -> Scope schema -> Validator a (Maybe Ref) (RefInvalid err) Source #
allOfValidator :: (schema -> Value -> [err]) -> Validator schema (Maybe (AllOf schema)) (AllOfInvalid err) Source #
anyOfValidator :: (schema -> Value -> [err]) -> Validator schema (Maybe (AnyOf schema)) (AnyOfInvalid err) Source #
oneOfValidator :: ToJSON schema => (schema -> Value -> [err]) -> Validator schema (Maybe (OneOf schema)) (OneOfInvalid err) Source #
notValidator :: ToJSON schema => (schema -> Value -> [err]) -> Validator schema (Maybe (NotValidator schema)) NotValidatorInvalid Source #