api-tools-0.9.0.0: DSL for generating API boilerplate and docs
Safe HaskellNone
LanguageHaskell2010

Data.API.Tools.Example

Description

Tool for generating documentation-friendly examples

Synopsis

Documentation

class Example a where Source #

The Example class is used to generate a documentation-friendly example for each type in the model

Minimal complete definition

Nothing

Methods

example :: Gen a Source #

Generator for example values; defaults to arbitrary if not specified

default example :: Arbitrary a => Gen a Source #

Instances

Instances details
Example Bool Source # 
Instance details

Defined in Data.API.Tools.Example

Methods

example :: Gen Bool Source #

Example Int Source # 
Instance details

Defined in Data.API.Tools.Example

Methods

example :: Gen Int Source #

Example Text Source # 
Instance details

Defined in Data.API.Tools.Example

Methods

example :: Gen Text Source #

Example UTCTime Source # 
Instance details

Defined in Data.API.Tools.Example

Example Value Source # 
Instance details

Defined in Data.API.Tools.Example

Example Binary Source # 
Instance details

Defined in Data.API.Tools.Example

Example DefaultValue Source # 
Instance details

Defined in Data.API.API.Gen

Example BasicType Source # 
Instance details

Defined in Data.API.API.Gen

Example TypeRef Source # 
Instance details

Defined in Data.API.API.Gen

Example APIType Source # 
Instance details

Defined in Data.API.API.Gen

Example Field Source # 
Instance details

Defined in Data.API.API.Gen

Example Conversion Source # 
Instance details

Defined in Data.API.API.Gen

Example UTCRange Source # 
Instance details

Defined in Data.API.API.Gen

Example IntRange Source # 
Instance details

Defined in Data.API.API.Gen

Example RegularExpression Source # 
Instance details

Defined in Data.API.API.Gen

Example Filter Source # 
Instance details

Defined in Data.API.API.Gen

Example SpecNewtype Source # 
Instance details

Defined in Data.API.API.Gen

Example Spec Source # 
Instance details

Defined in Data.API.API.Gen

Methods

example :: Gen Spec Source #

Example APINode Source # 
Instance details

Defined in Data.API.API.Gen

Example a => Example [a] Source # 
Instance details

Defined in Data.API.Tools.Example

Methods

example :: Gen [a] Source #

Example a => Example (Maybe a) Source # 
Instance details

Defined in Data.API.Tools.Example

Methods

example :: Gen (Maybe a) Source #

exampleTool :: APITool Source #

Tool to generate Example instances for types generated by datatypesTool. This depends on quickCheckTool.

samplesTool :: Name -> APITool Source #

Generate a list of (type name, sample generator) pairs corresponding to each type in the API, with samples encoded as JSON. This depends on the Example instances generated by exampleTool. It generates something like this:

samples :: [(String, Gen Value)]
samples = [("Foo", fmap toJSON (example :: Gen Foo)), ... ]