Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.Swagger.Internal.AesonUtils
Contents
- 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
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
Methods
swaggerAesonOptions :: proxy a -> SwaggerAesonOptions #
aesonDefaults :: proxy a -> POP Maybe (Code a) #
Instances
data SwaggerAesonOptions #
Arguments
:: String | prefix |
-> SwaggerAesonOptions |
saoAdditionalPairs :: Lens' SwaggerAesonOptions [(Text, Value)] #