aeson-match-qq-1.7.0: Declarative JSON matchers.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Aeson.Match.QQ.Internal.Match

Synopsis

Documentation

match Source #

Arguments

:: Matcher Value 
-> Value 
-> Either (NonEmpty Error) (HashMap Text Value)

Either a non-empty list of errors, or a mapping from named _holes to their values.

Test if a Matcher matches a Value.

data Error Source #

Various errors that can happen when a matcher tries to match a Value.

Constructors

Mismatch Mismatch

The type of the value is correct, but the value itself is wrong

Mistype TypeMismatch

The type of the value is wrong

MissingPathElem MissingPathElem

The request path is missing in the value

ExtraArrayValues ExtraArrayValues

Unexpected extra values in an array

ExtraObjectValues ExtraObjectValues

Unexpected extra key-value pairs in an object

Instances

Instances details
ToJSON Error Source # 
Instance details

Defined in Aeson.Match.QQ.Internal.Match

Show Error Source # 
Instance details

Defined in Aeson.Match.QQ.Internal.Match

Methods

showsPrec :: Int -> Error -> ShowS #

show :: Error -> String #

showList :: [Error] -> ShowS #

Eq Error Source # 
Instance details

Defined in Aeson.Match.QQ.Internal.Match

Methods

(==) :: Error -> Error -> Bool #

(/=) :: Error -> Error -> Bool #

Pretty Error Source # 
Instance details

Defined in Aeson.Match.QQ.Internal.Match

data TypeMismatch Source #

This error type covers the case where the type of the value does not match.

Constructors

MkTypeMismatch 

data Mismatch Source #

This error type covers the case where the type matches but the value does not.

Constructors

MkMismatch 

Fields

data ExtraArrayValues Source #

Unless an permissive matcher is used, any extra values in an array missing in the matcher will trigger this error.

Constructors

MkExtraArrayValues 

Fields

data ExtraObjectValues Source #

Unless an permissive matcher is used, any extra key-value pairs in an object missing in the matcher will trigger this error.

Constructors

MkExtraObjectValues 

Fields

newtype Path Source #

A path is a list of path elements.

Constructors

Path 

Fields

Instances

Instances details
ToJSON Path Source # 
Instance details

Defined in Aeson.Match.QQ.Internal.Match

IsList Path Source # 
Instance details

Defined in Aeson.Match.QQ.Internal.Match

Associated Types

type Item Path #

Methods

fromList :: [Item Path] -> Path #

fromListN :: Int -> [Item Path] -> Path #

toList :: Path -> [Item Path] #

Show Path Source # 
Instance details

Defined in Aeson.Match.QQ.Internal.Match

Methods

showsPrec :: Int -> Path -> ShowS #

show :: Path -> String #

showList :: [Path] -> ShowS #

Eq Path Source # 
Instance details

Defined in Aeson.Match.QQ.Internal.Match

Methods

(==) :: Path -> Path -> Bool #

(/=) :: Path -> Path -> Bool #

Pretty Path Source # 
Instance details

Defined in Aeson.Match.QQ.Internal.Match

type Item Path Source # 
Instance details

Defined in Aeson.Match.QQ.Internal.Match

data PathElem Source #

A path element is either a key lookup in an object, or an index lookup in an array.

Constructors

Key Text 
Idx Int