servant-aeson-specs-0.6.2.0: generic tests for aeson serialization in servant

Copyright(c) Plow Technologies 2016
LicenseMIT
Maintainersoenkehahn@gmail.com, mchaver@gmail.com
StabilityAlpha
Safe HaskellNone
LanguageHaskell2010

Servant.Aeson.Internal

Contents

Description

Internal module, use at your own risk.

Synopsis

Documentation

apiRoundtripSpecs :: HasGenericSpecs api => Proxy api -> Spec Source #

Allows to obtain roundtrip tests for JSON serialization for all types used in a servant api. It uses settings are not used in roundtripSpecs. There is no need to let the user pass cusomt settings. It automatically uses defaultSettings.

See also roundtripSpecs.

apiGoldenSpecs :: HasGenericSpecs api => Proxy api -> Spec Source #

Allows to obtain golden tests for JSON serialization for all types used in a servant api.

See also goldenSpecs.

apiGoldenSpecsWithSettings :: HasGenericSpecs api => Settings -> Proxy api -> Spec Source #

Same as apiGoldenSpecs, but allows custom settings.

apiSpecsWithSettings :: HasGenericSpecs api => Settings -> Proxy api -> Spec Source #

Same as apiSpecs, but allows custom settings.

usedTypes :: HasGenericSpecs api => Proxy api -> [TypeRep] Source #

Allows to retrieve a list of all used types in a servant api as TypeReps.

mkRoundtripSpecs :: HasGenericSpecs api => Settings -> Proxy api -> [TypeSpec] Source #

Make roundtrip test for all the routes in an API, remove duplicates.

class HasGenericSpecs api where Source #

Allows you to iterate over the routes of a Servant API

Minimal complete definition

collectRoundtripSpecs

Instances

(HasGenericSpecs a, HasGenericSpecs b) => HasGenericSpecs ((:<|>) a b) Source #

Match :<|>.

(MkTypeSpecs body, HasGenericSpecs api) => HasGenericSpecs ((:>) * (ReqBody contentTypes body) api) Source #

Match ReqBody and :>.

Methods

collectRoundtripSpecs :: Settings -> Proxy * ((* :> ReqBody contentTypes body) api) -> [TypeSpec] Source #

HasGenericSpecs api => HasGenericSpecs ((:>) * (QueryParam sym x) api) Source #

Match QueryParam and :>.

HasGenericSpecs api => HasGenericSpecs ((:>) * (QueryParams sym x) api) Source #

Match QueryParams and :>.

HasGenericSpecs api => HasGenericSpecs ((:>) * (QueryFlag sym) api) Source #

Match QueryFlag and :>.

HasGenericSpecs api => HasGenericSpecs ((:>) * (Header * sym x) api) Source #

Match Header and :>.

Methods

collectRoundtripSpecs :: Settings -> Proxy * ((* :> Header * sym x) api) -> [TypeSpec] Source #

HasGenericSpecs api => HasGenericSpecs ((:>) * (AuthProtect Symbol sym) api) Source #

Servant >= 0.5.0, match AuthProtect and :>.

HasGenericSpecs api => HasGenericSpecs ((:>) * (Capture sym x) api) Source #

Match Capture and :>.

Methods

collectRoundtripSpecs :: Settings -> Proxy * ((* :> Capture sym x) api) -> [TypeSpec] Source #

HasGenericSpecs api => HasGenericSpecs ((:>) Symbol path api) Source #

Match Symbol and :>.

Methods

collectRoundtripSpecs :: Settings -> Proxy * ((Symbol :> path) api) -> [TypeSpec] Source #

MkTypeSpecs response => HasGenericSpecs (Verb StdMethod method returnStatus contentTypes (Headers hs response)) Source #

Servant >= 0.5.0, pattern match on StdMethod and Headers.

Methods

collectRoundtripSpecs :: Settings -> Proxy * (Verb StdMethod method returnStatus contentTypes (Headers hs response)) -> [TypeSpec] Source #

HasGenericSpecs (Verb StdMethod method returnStatus contentTypes NoContent) Source #

Servant >= 0.5.0, pattern match on StdMethod and NoContent.

Methods

collectRoundtripSpecs :: Settings -> Proxy * (Verb StdMethod method returnStatus contentTypes NoContent) -> [TypeSpec] Source #

MkTypeSpecs response => HasGenericSpecs (Verb StdMethod method returnStatus contentTypes response) Source #

Servant >= 0.5.0, pattern match on StdMethod and response with content.

Methods

collectRoundtripSpecs :: Settings -> Proxy * (Verb StdMethod method returnStatus contentTypes response) -> [TypeSpec] Source #

http methods

combinators

data TypeSpec Source #

Data type to for holding tests and type representation of each route in a Servant API. A function can be used to pick which tests to run and return the type name for reference.

Constructors

TypeSpec 

Fields

class MkTypeSpecs a where Source #

mkTypeSpecs has to be implemented as a method of a separate class, because we want to be able to have a specialized implementation for lists.

Minimal complete definition

mkTypeSpecs

Instances

MkTypeSpecs () Source #

We trust aeson to be correct for ().

Methods

mkTypeSpecs :: Settings -> Proxy * () -> [TypeSpec] Source #

(Typeable * a, Eq a, Show a, Arbitrary a, ToJSON a, FromJSON a) => MkTypeSpecs a Source #

Test JSON Serialization for non-wrapped types.

(Eq a, Show a, Typeable * a, Arbitrary a, ToJSON a, FromJSON a) => MkTypeSpecs [a] Source #

Test JSON serialization for '[]' types.

Methods

mkTypeSpecs :: Settings -> Proxy * [a] -> [TypeSpec] Source #

(Eq a, Show a, Typeable * a, Arbitrary a, ToJSON a, FromJSON a) => MkTypeSpecs (Maybe a) Source #

Test JSON serialization for Maybe types.