Safe Haskell | None |
---|---|
Language | Haskell2010 |
This is generally meant to be an internal module.
It's only exposed in case you want to make your own
Spec
. If you just want to use JSON Schema Draft 4
use the preassembled draft4
instead.
This module exposes three types of functions. To describe them we'll use the properties validators as an example.
- Functions which describe how subschemas (if any)
are embedded in this validator. This is how
fetchRefs
is able to find "$refs" and "ids". - Functions that aren't followed by apostrophes have the
type
ValidatorGen
and are meant to be used in aSpec
. Examples areproperties
andadditionalProperties
. - Functions that are followed by a single apostrophe, such
as
additionalProperties'
, aren't meant to be used standalone in aSpec
. Instead they're used by other validators. For instance,additionalProperties
disables itself if the key "properties" is present to allowadditionalProperties
to handle its validation. Placing the actual meat ofadditionalProperties
inadditionalProperties'
allows for code reuse betweenproperties
andadditionalProperties
. - Functions that are followed by a double apostrophe, such
as
patternProperties''
, return an enhanced validator. It not only reports errors, but also the parts of the target data that it matches. These functions also aren't used in aSpec
instance, but are necessary helpers for actual validators in certain situations.
- noEm :: Text -> Value -> Vector RawSchema
- objEmbed :: Text -> Value -> Vector RawSchema
- arrayEmbed :: Text -> Value -> Vector RawSchema
- objOrArrayEmbed :: Text -> Value -> Vector RawSchema
- objMembersEmbed :: Text -> Value -> Vector RawSchema
- multipleOf :: ValidatorGen
- maximumVal :: ValidatorGen
- minimumVal :: ValidatorGen
- maxLength :: ValidatorGen
- minLength :: ValidatorGen
- pattern :: ValidatorGen
- items :: ValidatorGen
- additionalItems' :: ValidatorGen
- maxItems :: ValidatorGen
- minItems :: ValidatorGen
- uniqueItems :: ValidatorGen
- maxProperties :: ValidatorGen
- minProperties :: ValidatorGen
- required :: ValidatorGen
- properties :: ValidatorGen
- properties'' :: Spec -> Graph -> RawSchema -> Value -> Maybe (Value -> (Vector ValErr, Value))
- patternProperties'' :: Spec -> Graph -> RawSchema -> Value -> Maybe (Value -> (Vector ValErr, Value))
- patternProperties :: ValidatorGen
- additionalProperties' :: ValidatorGen
- additionalProperties :: ValidatorGen
- dependencies :: ValidatorGen
- enum :: ValidatorGen
- typeVal :: ValidatorGen
- allOf :: ValidatorGen
- anyOf :: ValidatorGen
- oneOf :: ValidatorGen
- notValidator :: ValidatorGen
- ref :: ValidatorGen
- noVal :: ValidatorGen
Documentation
Also covers additionalItems.
We can leave additionalItems out of the spec HashMap, since items defaults to {}, and if it isn't present additionalItems will always validate successfully.
properties'' :: Spec -> Graph -> RawSchema -> Value -> Maybe (Value -> (Vector ValErr, Value)) Source