swagger2-2.1.4.1: Swagger 2.0 data model

Safe Haskell | None
Language | Haskell2010

Data.Swagger.Internal.AesonUtils

Contents

- Generic functions
- Options

Synopsis

- class AesonDefaultValue a where
- sopSwaggerGenericToJSON :: forall a xs. (HasDatatypeInfo a, HasSwaggerAesonOptions a, All2 ToJSON (Code a), All2 Eq (Code a), Code a ~ '[xs]) => a -> Value
- sopSwaggerGenericToEncoding :: forall a xs. (HasDatatypeInfo a, HasSwaggerAesonOptions a, All2 ToJSON (Code a), All2 Eq (Code a), Code a ~ '[xs]) => a -> Encoding
- sopSwaggerGenericToJSONWithOpts :: forall a xs. (Generic a, All2 AesonDefaultValue (Code a), HasDatatypeInfo a, All2 ToJSON (Code a), All2 Eq (Code a), Code a ~ '[xs]) => SwaggerAesonOptions -> a -> Value
- sopSwaggerGenericParseJSON :: forall a xs. (HasDatatypeInfo a, HasSwaggerAesonOptions a, All2 FromJSON (Code a), All2 Eq (Code a), Code a ~ '[xs]) => Value -> Parser a
- class (Generic a, All2 AesonDefaultValue (Code a)) => HasSwaggerAesonOptions a where
- data SwaggerAesonOptions
- mkSwaggerAesonOptions :: String -> SwaggerAesonOptions
- saoPrefix :: Lens' SwaggerAesonOptions String
- saoAdditionalPairs :: Lens' SwaggerAesonOptions [(Text, Value)]
- saoSubObject :: Lens' SwaggerAesonOptions (Maybe String)

# Generic functions

class AesonDefaultValue a where #

Methods

defaultValue :: Maybe a #

Instances

AesonDefaultValue Text # |
Methods defaultValue :: Maybe Text #
AesonDefaultValue SecuritySchemeType # |
Methods defaultValue :: Maybe SecuritySchemeType #
AesonDefaultValue OAuth2Flow # |
Methods defaultValue :: Maybe OAuth2Flow #
AesonDefaultValue Responses # |
Methods defaultValue :: Maybe Responses #
AesonDefaultValue ParamLocation # |
Methods defaultValue :: Maybe ParamLocation #
AesonDefaultValue ParamAnySchema # |
Methods defaultValue :: Maybe ParamAnySchema #
AesonDefaultValue MimeList # |
Methods defaultValue :: Maybe MimeList #
AesonDefaultValue Info # |
Methods defaultValue :: Maybe Info #
AesonDefaultValue [a] # |
Methods defaultValue :: Maybe [a] #
AesonDefaultValue (Maybe a) # |
Methods defaultValue :: Maybe (Maybe a) #
AesonDefaultValue (Set a) # |
Methods defaultValue :: Maybe (Set a) #
AesonDefaultValue (ParamSchema s) # |
Methods defaultValue :: Maybe (ParamSchema s) #
AesonDefaultValue (SwaggerType a) # |
Methods defaultValue :: Maybe (SwaggerType a) #
AesonDefaultValue (InsOrdHashMap k v) # |
Methods defaultValue :: Maybe (InsOrdHashMap k v) #

sopSwaggerGenericToJSON :: forall a xs. (HasDatatypeInfo a, HasSwaggerAesonOptions a, All2 ToJSON (Code a), All2 Eq (Code a), Code a ~ '[xs]) => a -> Value #

Generic serialisation for swagger records.

Features

- omits nulls, empty objects and empty arrays (configurable)
- possible to add fields
- possible to merge sub-object

sopSwaggerGenericToEncoding :: forall a xs. (HasDatatypeInfo a, HasSwaggerAesonOptions a, All2 ToJSON (Code a), All2 Eq (Code a), Code a ~ '[xs]) => a -> Encoding #

sopSwaggerGenericToJSONWithOpts :: forall a xs. (Generic a, All2 AesonDefaultValue (Code a), HasDatatypeInfo a, All2 ToJSON (Code a), All2 Eq (Code a), Code a ~ '[xs]) => SwaggerAesonOptions -> a -> Value #

- TODO:* This is only used by ToJSON (ParamSchema SwaggerKindSchema)

Also uses default `aesonDefaults`

sopSwaggerGenericParseJSON :: forall a xs. (HasDatatypeInfo a, HasSwaggerAesonOptions a, All2 FromJSON (Code a), All2 Eq (Code a), Code a ~ '[xs]) => Value -> Parser a #

# Options

class (Generic a, All2 AesonDefaultValue (Code a)) => HasSwaggerAesonOptions a where #

Minimal complete definition

swaggerAesonOptions

Methods

swaggerAesonOptions :: proxy a -> SwaggerAesonOptions #

aesonDefaults :: proxy a -> POP Maybe (Code a) #

Instances

HasSwaggerAesonOptions SecurityScheme # |
Methods swaggerAesonOptions :: proxy SecurityScheme -> SwaggerAesonOptions # aesonDefaults :: proxy SecurityScheme -> POP * Maybe (Code SecurityScheme) #
HasSwaggerAesonOptions OAuth2Params # |
Methods swaggerAesonOptions :: proxy OAuth2Params -> SwaggerAesonOptions # aesonDefaults :: proxy OAuth2Params -> POP * Maybe (Code OAuth2Params) #
HasSwaggerAesonOptions Header # |
Methods swaggerAesonOptions :: proxy Header -> SwaggerAesonOptions # aesonDefaults :: proxy Header -> POP * Maybe (Code Header) #
HasSwaggerAesonOptions Response # |
Methods swaggerAesonOptions :: proxy Response -> SwaggerAesonOptions # aesonDefaults :: proxy Response -> POP * Maybe (Code Response) #
HasSwaggerAesonOptions Responses # |
Methods swaggerAesonOptions :: proxy Responses -> SwaggerAesonOptions # aesonDefaults :: proxy Responses -> POP * Maybe (Code Responses) #
HasSwaggerAesonOptions Schema # |
Methods swaggerAesonOptions :: proxy Schema -> SwaggerAesonOptions # aesonDefaults :: proxy Schema -> POP * Maybe (Code Schema) #
HasSwaggerAesonOptions ParamOtherSchema # |
Methods swaggerAesonOptions :: proxy ParamOtherSchema -> SwaggerAesonOptions # aesonDefaults :: proxy ParamOtherSchema -> POP * Maybe (Code ParamOtherSchema) #
HasSwaggerAesonOptions Param # |
Methods swaggerAesonOptions :: proxy Param -> SwaggerAesonOptions # aesonDefaults :: proxy Param -> POP * Maybe (Code Param) #
HasSwaggerAesonOptions Operation # |
Methods swaggerAesonOptions :: proxy Operation -> SwaggerAesonOptions # aesonDefaults :: proxy Operation -> POP * Maybe (Code Operation) #
HasSwaggerAesonOptions PathItem # |
Methods swaggerAesonOptions :: proxy PathItem -> SwaggerAesonOptions # aesonDefaults :: proxy PathItem -> POP * Maybe (Code PathItem) #
HasSwaggerAesonOptions Swagger # |
Methods swaggerAesonOptions :: proxy Swagger -> SwaggerAesonOptions # aesonDefaults :: proxy Swagger -> POP * Maybe (Code Swagger) #
HasSwaggerAesonOptions (ParamSchema (SwaggerKindNormal * t)) # |
Methods swaggerAesonOptions :: proxy (ParamSchema (SwaggerKindNormal * t)) -> SwaggerAesonOptions # aesonDefaults :: proxy (ParamSchema (SwaggerKindNormal * t)) -> POP * Maybe (Code (ParamSchema (SwaggerKindNormal * t))) #
HasSwaggerAesonOptions (ParamSchema (SwaggerKindParamOtherSchema *)) # |
Methods swaggerAesonOptions :: proxy (ParamSchema (SwaggerKindParamOtherSchema *)) -> SwaggerAesonOptions # aesonDefaults :: proxy (ParamSchema (SwaggerKindParamOtherSchema *)) -> POP * Maybe (Code (ParamSchema (SwaggerKindParamOtherSchema *))) #
HasSwaggerAesonOptions (ParamSchema (SwaggerKindSchema *)) # |
Methods swaggerAesonOptions :: proxy (ParamSchema (SwaggerKindSchema *)) -> SwaggerAesonOptions # aesonDefaults :: proxy (ParamSchema (SwaggerKindSchema *)) -> POP * Maybe (Code (ParamSchema (SwaggerKindSchema *))) #

data SwaggerAesonOptions #

mkSwaggerAesonOptions #

Arguments

:: String | prefix
-> SwaggerAesonOptions |

saoPrefix :: Lens' SwaggerAesonOptions String #

saoAdditionalPairs :: Lens' SwaggerAesonOptions [(Text, Value)] #

saoSubObject :: Lens' SwaggerAesonOptions (Maybe String) #