| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.JsonSchema.Draft4
- data Schema = Schema {
- _schemaVersion :: Maybe Text
- _schemaId :: Maybe Text
- _schemaRef :: Maybe Text
- _schemaDefinitions :: Maybe (HashMap Text Schema)
- _schemaOther :: HashMap Text Value
- _schemaMultipleOf :: Maybe Scientific
- _schemaMaximum :: Maybe Scientific
- _schemaExclusiveMaximum :: Maybe Bool
- _schemaMinimum :: Maybe Scientific
- _schemaExclusiveMinimum :: Maybe Bool
- _schemaMaxLength :: Maybe Int
- _schemaMinLength :: Maybe Int
- _schemaPattern :: Maybe Text
- _schemaMaxItems :: Maybe Int
- _schemaMinItems :: Maybe Int
- _schemaUniqueItems :: Maybe Bool
- _schemaItems :: Maybe (Items Schema)
- _schemaAdditionalItems :: Maybe (AdditionalItems Schema)
- _schemaMaxProperties :: Maybe Int
- _schemaMinProperties :: Maybe Int
- _schemaRequired :: Maybe Required
- _schemaDependencies :: Maybe (HashMap Text (Dependency Schema))
- _schemaProperties :: Maybe (HashMap Text Schema)
- _schemaPatternProperties :: Maybe (HashMap Text Schema)
- _schemaAdditionalProperties :: Maybe (AdditionalProperties Schema)
- _schemaEnum :: Maybe EnumVal
- _schemaType :: Maybe TypeVal
- _schemaAllOf :: Maybe (NonEmpty Schema)
- _schemaAnyOf :: Maybe (NonEmpty Schema)
- _schemaOneOf :: Maybe (NonEmpty Schema)
- _schemaNot :: Maybe Schema
- emptySchema :: Schema
- checkSchema :: SchemaCache Schema -> SchemaContext Schema -> Either [Failure] (Value -> [Failure])
- data SchemaContext schema = SchemaContext {}
- data SchemaCache schema = SchemaCache {
- _startingSchema :: !schema
- _cachedSchemas :: !(URISchemaMap schema)
- fetchReferencedSchemas :: URISchemaMap Schema -> SchemaContext Schema -> IO (Either Text (SchemaCache Schema))
- data Failure = Failure {}
- data ValidatorChain
- = MultipleOf
- | Maximum
- | ExclusiveMaximum
- | Minimum
- | ExclusiveMinimum
- | MaxLength
- | MinLength
- | PatternValidator
- | MaxItems
- | MinItems
- | UniqueItems
- | Items ValidatorChain
- | AdditionalItemsBool
- | AdditionalItemsObject ValidatorChain
- | MaxProperties
- | MinProperties
- | Required
- | SchemaDependency ValidatorChain
- | PropertyDependency
- | Properties ValidatorChain
- | PatternProperties ValidatorChain
- | AdditionalPropertiesBool
- | AdditionalPropertiesObject ValidatorChain
- | RefResolution
- | Ref ValidatorChain
- | Enum
- | TypeValidator
- | AllOf ValidatorChain
- | AnyOf
- | OneOf
- | NotValidator
- schemaValidity :: Schema -> [Failure]
- runValidate :: SchemaCache Schema -> SchemaContext Schema -> Value -> [Failure]
Documentation
Constructors
checkSchema :: SchemaCache Schema -> SchemaContext Schema -> Either [Failure] (Value -> [Failure]) Source
Check the validity of a schema and return a function to validate data.
Fetching tools
data SchemaContext schema Source
Constructors
| SchemaContext | |
Fields
| |
Instances
| Eq schema => Eq (SchemaContext schema) Source | |
| Show schema => Show (SchemaContext schema) Source |
data SchemaCache schema Source
Constructors
| SchemaCache | |
Fields
| |
Instances
| Eq schema => Eq (SchemaCache schema) Source | |
| Show schema => Show (SchemaCache schema) Source |
fetchReferencedSchemas :: URISchemaMap Schema -> SchemaContext Schema -> IO (Either Text (SchemaCache Schema)) Source
Failure
data ValidatorChain Source
Constructors
| MultipleOf | |
| Maximum | |
| ExclusiveMaximum | |
| Minimum | |
| ExclusiveMinimum | |
| MaxLength | |
| MinLength | |
| PatternValidator | |
| MaxItems | |
| MinItems | |
| UniqueItems | |
| Items ValidatorChain | |
| AdditionalItemsBool | |
| AdditionalItemsObject ValidatorChain | |
| MaxProperties | |
| MinProperties | |
| Required | |
| SchemaDependency ValidatorChain | |
| PropertyDependency | |
| Properties ValidatorChain | |
| PatternProperties ValidatorChain | |
| AdditionalPropertiesBool | |
| AdditionalPropertiesObject ValidatorChain | |
| RefResolution | Indicates a reference that failed to resolve. NOTE: The language agnostic test suite doesn't specify if this should cause a validation error or should allow data to pass. We choose to return a validation error. Also note that ideally we would enforce in the type system that any failing references be dealt with before valididation. Then this could be removed entirely. |
| Ref ValidatorChain | |
| Enum | |
| TypeValidator | |
| AllOf ValidatorChain | |
| AnyOf | |
| OneOf | |
| NotValidator |
Instances
Other Draft 4 things exported just in case
schemaValidity :: Schema -> [Failure] Source
In normal situations just use checkSchema, which is a combination of
schemaValidity and runValidate.
runValidate :: SchemaCache Schema -> SchemaContext Schema -> Value -> [Failure] Source
In normal situations just use checkSchema, which is a combination of
schemaValidity and runValidate.