json-schema-0.7.4.1: Types and type classes for defining JSON schemas.

Safe HaskellNone
LanguageHaskell98

Data.JSON.Schema.Validate

Synopsis

Documentation

isValid :: Schema -> Value -> Bool Source

Predicate version of validate.

validate :: Schema -> Value -> Vector ValidationError Source

Validates a value against a schema returning errors.

data ValidationError Source

Constructors

ValidationError 

Fields

path :: Vector Text

The Path to the property where the error occured, empty if the error is on the top level.

errorType :: ErrorType
 

data ErrorType Source

Constructors

Mismatch Schema Value

General type error.

BoundError Bound Scientific

Number out of bounds.

LengthBoundError LengthBound Int

String or Array out of bounds.

TupleLength Int Int

Expected and actual tuple length.

MissingRequiredField Text

A required field is missing.

ChoiceError (Vector (Vector ValidationError)) Value

All choices failed, contains the error of each branch.

NonUniqueArray (HashMap Value Int)

The elements in the array that are duplicated with the number of occurences (at least 2).