Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type API = [Thing]
- data Thing
- data APINode = APINode {}
- newtype TypeName = TypeName {}
- newtype FieldName = FieldName {
- _FieldName :: Text
- type MDComment = String
- type Prefix = CI String
- data Spec
- data SpecNewtype = SpecNewtype {}
- data SpecRecord = SpecRecord {}
- data FieldType = FieldType {}
- data SpecUnion = SpecUnion {}
- data SpecEnum = SpecEnum {}
- type Conversion = Maybe (FieldName, FieldName)
- data APIType
- data DefaultValue
- data BasicType
- data Filter
- data IntRange = IntRange {}
- data UTCRange = UTCRange {}
- data RegEx = RegEx {}
- newtype Binary = Binary {}
- defaultValueAsJsValue :: DefaultValue -> Value
- mkRegEx :: Text -> RegEx
- inIntRange :: Int -> IntRange -> Bool
- inUTCRange :: UTCTime -> UTCRange -> Bool
- base64ToBinary :: Text -> Either String Binary
Documentation
an API spec is made up of a list of type/element specs, each specifying a Haskell type and JSON wrappers
Specifies an individual element/type of the API
TypeName must contain a valid Haskell type constructor
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)
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
type/element specs are either simple type isomorphisms of basic JSON types, records, unions or enumerated types
data SpecNewtype Source #
SpecNewtype elements are isomorphisms of string, inetgers or booleans
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.
FieldType | |
|
SpecUnion is your classsic union type
SpecEnum is your classic enumerated type
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.
Type is either a list, Maybe, a named element of the API or a basic type
data DefaultValue Source #
A default value for a field
the basic JSON types (N.B., no floating point numbers, yet)
Binary data is represented in JSON format as a base64-encoded string