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

Data.API.Types

Synopsis

Documentation

type API = [Thing] Source #

an API spec is made up of a list of type/element specs, each specifying a Haskell type and JSON wrappers

data Thing Source #

Instances

Instances details
Eq Thing Source # 
Instance details

Defined in Data.API.Types

Methods

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

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

Show Thing Source # 
Instance details

Defined in Data.API.Types

Methods

showsPrec :: Int -> Thing -> ShowS #

show :: Thing -> String #

showList :: [Thing] -> ShowS #

ToJSON Thing Source # 
Instance details

Defined in Data.API.Types

FromJSON Thing Source # 
Instance details

Defined in Data.API.Types

NFData Thing Source # 
Instance details

Defined in Data.API.Types

Methods

rnf :: Thing -> () #

FromJSONWithErrs Thing Source #

Generate an API spec from the JSON

Instance details

Defined in Data.API.API

Lift Thing Source # 
Instance details

Defined in Data.API.Types

Methods

lift :: Thing -> Q Exp #

liftTyped :: Thing -> Q (TExp Thing) #

data APINode Source #

Specifies an individual element/type of the API

Constructors

APINode 

Fields

Instances

Instances details
Eq APINode Source # 
Instance details

Defined in Data.API.Types

Methods

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

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

Show APINode Source # 
Instance details

Defined in Data.API.Types

ToJSON APINode Source # 
Instance details

Defined in Data.API.Types

FromJSON APINode Source # 
Instance details

Defined in Data.API.Types

NFData APINode Source # 
Instance details

Defined in Data.API.Types

Methods

rnf :: APINode -> () #

Lift APINode Source # 
Instance details

Defined in Data.API.Types

Methods

lift :: APINode -> Q Exp #

liftTyped :: APINode -> Q (TExp APINode) #

newtype TypeName Source #

TypeName must contain a valid Haskell type constructor

Constructors

TypeName 

Fields

Instances

Instances details
Eq TypeName Source # 
Instance details

Defined in Data.API.Types

Ord TypeName Source # 
Instance details

Defined in Data.API.Types

Show TypeName Source # 
Instance details

Defined in Data.API.Types

IsString TypeName Source # 
Instance details

Defined in Data.API.Types

ToJSON TypeName Source # 
Instance details

Defined in Data.API.Types

FromJSON TypeName Source # 
Instance details

Defined in Data.API.Types

NFData TypeName Source # 
Instance details

Defined in Data.API.Types

Methods

rnf :: TypeName -> () #

PP TypeName Source # 
Instance details

Defined in Data.API.PP

Methods

pp :: TypeName -> String Source #

Lift TypeName Source # 
Instance details

Defined in Data.API.Types

newtype FieldName Source #

FieldName identifies recod fields and union alternatives must contain a valid identifier valid in Haskell and any API client wrappers (e.g., if Ruby wrappers are to be generated the names should easily map into Ruby)

Constructors

FieldName 

Fields

Instances

Instances details
Eq FieldName Source # 
Instance details

Defined in Data.API.Types

Ord FieldName Source # 
Instance details

Defined in Data.API.Types

Show FieldName Source # 
Instance details

Defined in Data.API.Types

IsString FieldName Source # 
Instance details

Defined in Data.API.Types

ToJSON FieldName Source # 
Instance details

Defined in Data.API.Types

FromJSON FieldName Source # 
Instance details

Defined in Data.API.Types

NFData FieldName Source # 
Instance details

Defined in Data.API.Types

Methods

rnf :: FieldName -> () #

PP FieldName Source # 
Instance details

Defined in Data.API.PP

Methods

pp :: FieldName -> String Source #

Lift FieldName Source # 
Instance details

Defined in Data.API.Types

type MDComment = String Source #

Markdown comments are represented by strings

type Prefix = CI String Source #

a distinct case-insensitive short prefix used to form unique record field names and data constructors:

  • must be a valid Haskell identifier
  • must be unique within the API

data Spec Source #

type/element specs are either simple type isomorphisms of basic JSON types, records, unions or enumerated types

Instances

Instances details
Eq Spec Source # 
Instance details

Defined in Data.API.Types

Methods

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

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

Show Spec Source # 
Instance details

Defined in Data.API.Types

Methods

showsPrec :: Int -> Spec -> ShowS #

show :: Spec -> String #

showList :: [Spec] -> ShowS #

ToJSON Spec Source # 
Instance details

Defined in Data.API.Types

FromJSON Spec Source # 
Instance details

Defined in Data.API.Types

NFData Spec Source # 
Instance details

Defined in Data.API.Types

Methods

rnf :: Spec -> () #

Lift Spec Source # 
Instance details

Defined in Data.API.Types

Methods

lift :: Spec -> Q Exp #

liftTyped :: Spec -> Q (TExp Spec) #

data SpecNewtype Source #

SpecNewtype elements are isomorphisms of string, inetgers or booleans

Constructors

SpecNewtype 

Instances

Instances details
Eq SpecNewtype Source # 
Instance details

Defined in Data.API.Types

Show SpecNewtype Source # 
Instance details

Defined in Data.API.Types

ToJSON SpecNewtype Source # 
Instance details

Defined in Data.API.Types

FromJSON SpecNewtype Source # 
Instance details

Defined in Data.API.Types

NFData SpecNewtype Source # 
Instance details

Defined in Data.API.Types

Methods

rnf :: SpecNewtype -> () #

Lift SpecNewtype Source # 
Instance details

Defined in Data.API.Types

data SpecRecord Source #

SpecRecord is your classsic product type.

Constructors

SpecRecord 

Fields

Instances

Instances details
Eq SpecRecord Source # 
Instance details

Defined in Data.API.Types

Show SpecRecord Source # 
Instance details

Defined in Data.API.Types

ToJSON SpecRecord Source # 
Instance details

Defined in Data.API.Types

FromJSON SpecRecord Source # 
Instance details

Defined in Data.API.Types

NFData SpecRecord Source # 
Instance details

Defined in Data.API.Types

Methods

rnf :: SpecRecord -> () #

Lift SpecRecord Source # 
Instance details

Defined in Data.API.Types

data FieldType Source #

In addition to the type and comment, record fields may carry a flag indicating that they are read-only, and may have a default value, which must be of a compatible type.

Instances

Instances details
Eq FieldType Source # 
Instance details

Defined in Data.API.Types

Show FieldType Source # 
Instance details

Defined in Data.API.Types

ToJSON FieldType Source # 
Instance details

Defined in Data.API.Types

FromJSON FieldType Source # 
Instance details

Defined in Data.API.Types

NFData FieldType Source # 
Instance details

Defined in Data.API.Types

Methods

rnf :: FieldType -> () #

Lift FieldType Source # 
Instance details

Defined in Data.API.Types

data SpecUnion Source #

SpecUnion is your classsic union type

Constructors

SpecUnion 

Fields

Instances

Instances details
Eq SpecUnion Source # 
Instance details

Defined in Data.API.Types

Show SpecUnion Source # 
Instance details

Defined in Data.API.Types

ToJSON SpecUnion Source # 
Instance details

Defined in Data.API.Types

FromJSON SpecUnion Source # 
Instance details

Defined in Data.API.Types

NFData SpecUnion Source # 
Instance details

Defined in Data.API.Types

Methods

rnf :: SpecUnion -> () #

Lift SpecUnion Source # 
Instance details

Defined in Data.API.Types

data SpecEnum Source #

SpecEnum is your classic enumerated type

Constructors

SpecEnum 

Fields

Instances

Instances details
Eq SpecEnum Source # 
Instance details

Defined in Data.API.Types

Show SpecEnum Source # 
Instance details

Defined in Data.API.Types

ToJSON SpecEnum Source # 
Instance details

Defined in Data.API.Types

FromJSON SpecEnum Source # 
Instance details

Defined in Data.API.Types

NFData SpecEnum Source # 
Instance details

Defined in Data.API.Types

Methods

rnf :: SpecEnum -> () #

Lift SpecEnum Source # 
Instance details

Defined in Data.API.Types

type Conversion = Maybe (FieldName, FieldName) Source #

Conversion possibly converts to an internal representation. If specified, a conversion is a pair of an injection function name and a projection function name.

data APIType Source #

Type is either a list, Maybe, a named element of the API or a basic type

Constructors

TyList APIType

list elements are types

TyMaybe APIType

Maybe elements are types

TyName TypeName

the referenced type must be defined by the API

TyBasic BasicType

a JSON string, int, bool etc.

TyJSON

a generic JSON value

Instances

Instances details
Eq APIType Source # 
Instance details

Defined in Data.API.Types

Methods

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

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

Show APIType Source # 
Instance details

Defined in Data.API.Types

IsString APIType Source #

It is sometimes helpful to write a type name directly as a string

Instance details

Defined in Data.API.Types

Methods

fromString :: String -> APIType #

ToJSON APIType Source # 
Instance details

Defined in Data.API.Types

FromJSON APIType Source # 
Instance details

Defined in Data.API.Types

NFData APIType Source # 
Instance details

Defined in Data.API.Types

Methods

rnf :: APIType -> () #

PP APIType Source # 
Instance details

Defined in Data.API.PP

Methods

pp :: APIType -> String Source #

Lift APIType Source # 
Instance details

Defined in Data.API.Types

Methods

lift :: APIType -> Q Exp #

liftTyped :: APIType -> Q (TExp APIType) #

data DefaultValue Source #

A default value for a field

Instances

Instances details
Eq DefaultValue Source # 
Instance details

Defined in Data.API.Types

Show DefaultValue Source # 
Instance details

Defined in Data.API.Types

ToJSON DefaultValue Source # 
Instance details

Defined in Data.API.Types

FromJSON DefaultValue Source # 
Instance details

Defined in Data.API.Types

NFData DefaultValue Source # 
Instance details

Defined in Data.API.Types

Methods

rnf :: DefaultValue -> () #

PP DefaultValue Source # 
Instance details

Defined in Data.API.PP

Lift DefaultValue Source # 
Instance details

Defined in Data.API.Types

data BasicType Source #

the basic JSON types (N.B., no floating point numbers, yet)

Constructors

BTstring

a JSON UTF-8 string

BTbinary

a base-64-encoded byte string

BTbool

a JSON bool

BTint

a JSON integral number

BTutc

a JSON UTC string

Instances

Instances details
Eq BasicType Source # 
Instance details

Defined in Data.API.Types

Show BasicType Source # 
Instance details

Defined in Data.API.Types

ToJSON BasicType Source # 
Instance details

Defined in Data.API.Types

FromJSON BasicType Source # 
Instance details

Defined in Data.API.Types

NFData BasicType Source # 
Instance details

Defined in Data.API.Types

Methods

rnf :: BasicType -> () #

PP BasicType Source # 
Instance details

Defined in Data.API.PP

Methods

pp :: BasicType -> String Source #

Lift BasicType Source # 
Instance details

Defined in Data.API.Types

data Filter Source #

Instances

Instances details
Eq Filter Source # 
Instance details

Defined in Data.API.Types

Methods

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

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

Show Filter Source # 
Instance details

Defined in Data.API.Types

ToJSON Filter Source # 
Instance details

Defined in Data.API.Types

FromJSON Filter Source # 
Instance details

Defined in Data.API.Types

NFData Filter Source # 
Instance details

Defined in Data.API.Types

Methods

rnf :: Filter -> () #

Lift Filter Source # 
Instance details

Defined in Data.API.Types

Methods

lift :: Filter -> Q Exp #

liftTyped :: Filter -> Q (TExp Filter) #

data IntRange Source #

Constructors

IntRange 

Fields

Instances

Instances details
Eq IntRange Source # 
Instance details

Defined in Data.API.Types

Show IntRange Source # 
Instance details

Defined in Data.API.Types

ToJSON IntRange Source # 
Instance details

Defined in Data.API.Types

FromJSON IntRange Source # 
Instance details

Defined in Data.API.Types

NFData IntRange Source # 
Instance details

Defined in Data.API.Types

Methods

rnf :: IntRange -> () #

Lift IntRange Source # 
Instance details

Defined in Data.API.Types

data UTCRange Source #

Constructors

UTCRange 

Instances

Instances details
Eq UTCRange Source # 
Instance details

Defined in Data.API.Types

Show UTCRange Source # 
Instance details

Defined in Data.API.Types

ToJSON UTCRange Source # 
Instance details

Defined in Data.API.Types

FromJSON UTCRange Source # 
Instance details

Defined in Data.API.Types

NFData UTCRange Source # 
Instance details

Defined in Data.API.Types

Methods

rnf :: UTCRange -> () #

Lift UTCRange Source # 
Instance details

Defined in Data.API.Types

data RegEx Source #

Constructors

RegEx 

Fields

Instances

Instances details
Eq RegEx Source # 
Instance details

Defined in Data.API.Types

Methods

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

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

Show RegEx Source # 
Instance details

Defined in Data.API.Types

Methods

showsPrec :: Int -> RegEx -> ShowS #

show :: RegEx -> String #

showList :: [RegEx] -> ShowS #

ToJSON RegEx Source # 
Instance details

Defined in Data.API.Types

FromJSON RegEx Source # 
Instance details

Defined in Data.API.Types

NFData RegEx Source # 
Instance details

Defined in Data.API.Types

Methods

rnf :: RegEx -> () #

Lift RegEx Source # 
Instance details

Defined in Data.API.Types

Methods

lift :: RegEx -> Q Exp #

liftTyped :: RegEx -> Q (TExp RegEx) #

newtype Binary Source #

Binary data is represented in JSON format as a base64-encoded string

Constructors

Binary 

Fields

Instances

Instances details
Eq Binary Source # 
Instance details

Defined in Data.API.Types

Methods

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

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

Ord Binary Source # 
Instance details

Defined in Data.API.Types

Show Binary Source # 
Instance details

Defined in Data.API.Types

Arbitrary Binary Source # 
Instance details

Defined in Data.API.Types

ToJSON Binary Source # 
Instance details

Defined in Data.API.Types

FromJSON Binary Source # 
Instance details

Defined in Data.API.Types

NFData Binary Source # 
Instance details

Defined in Data.API.Types

Methods

rnf :: Binary -> () #

SafeCopy Binary Source # 
Instance details

Defined in Data.API.Types

Serialise Binary Source # 
Instance details

Defined in Data.API.Types

Example Binary Source # 
Instance details

Defined in Data.API.Tools.Example

FromJSONWithErrs Binary Source # 
Instance details

Defined in Data.API.JSON

defaultValueAsJsValue :: DefaultValue -> Value Source #

Convert a default value to an Aeson Value. This differs from toJSON as it will not round-trip with fromJSON: UTC default values are turned into strings.

Orphan instances

Arbitrary Text Source # 
Instance details

Methods

arbitrary :: Gen Text #

shrink :: Text -> [Text] #

ToJSON s => ToJSON (CI s) Source # 
Instance details

Methods

toJSON :: CI s -> Value #

toEncoding :: CI s -> Encoding #

toJSONList :: [CI s] -> Value #

toEncodingList :: [CI s] -> Encoding #

FromJSON s => FromJSON (CI s) Source # 
Instance details

Methods

parseJSON :: Value -> Parser (CI s) #

parseJSONList :: Value -> Parser [CI s] #