module JSONSchema.Draft4.Failure where
import Import
import JSONSchema.Draft4.Schema (Schema)
import qualified JSONSchema.Validator.Draft4 as VAL
data Invalid = Invalid
{ _invalidSchema :: Schema
, _invalidInstance :: Value
, _invalidFailures :: NonEmpty ValidatorFailure
} deriving (Eq, Show)
data ValidatorFailure
= FailureMultipleOf VAL.MultipleOfInvalid
| FailureMaximum VAL.MaximumInvalid
| FailureMinimum VAL.MinimumInvalid
| FailureMaxLength VAL.MaxLengthInvalid
| FailureMinLength VAL.MinLengthInvalid
| FailurePattern VAL.PatternInvalid
| FailureMaxItems VAL.MaxItemsInvalid
| FailureMinItems VAL.MinItemsInvalid
| FailureUniqueItems VAL.UniqueItemsInvalid
| FailureItems (VAL.ItemsInvalid ValidatorFailure)
| FailureAdditionalItems (VAL.AdditionalItemsInvalid ValidatorFailure)
| FailureMaxProperties VAL.MaxPropertiesInvalid
| FailureMinProperties VAL.MinPropertiesInvalid
| FailureRequired VAL.RequiredInvalid
| FailureDependencies (VAL.DependenciesInvalid ValidatorFailure)
| FailurePropertiesRelated (VAL.PropertiesRelatedInvalid ValidatorFailure)
| FailureRef (VAL.RefInvalid ValidatorFailure)
| FailureEnum VAL.EnumInvalid
| FailureType VAL.TypeValidatorInvalid
| FailureAllOf (VAL.AllOfInvalid ValidatorFailure)
| FailureAnyOf (VAL.AnyOfInvalid ValidatorFailure)
| FailureOneOf (VAL.OneOfInvalid ValidatorFailure)
| FailureNot VAL.NotValidatorInvalid
deriving (Eq, Show)
newtype SchemaInvalid
= SchemaInvalid {
_unSchemaInvalid :: NonEmpty (Maybe Text, NonEmpty ValidatorFailure) }
deriving (Eq, Show)