{-# LANGUAGE RecordWildCards #-}
module Data.OpenApi.SchemaOptions where
import qualified Data.Aeson.Types as Aeson
data SchemaOptions = SchemaOptions
{
SchemaOptions -> String -> String
fieldLabelModifier :: String -> String
, SchemaOptions -> String -> String
constructorTagModifier :: String -> String
, SchemaOptions -> String -> String
datatypeNameModifier :: String -> String
, SchemaOptions -> Bool
allNullaryToStringTag :: Bool
, SchemaOptions -> Bool
unwrapUnaryRecords :: Bool
, SchemaOptions -> SumEncoding
sumEncoding :: Aeson.SumEncoding
}
defaultSchemaOptions :: SchemaOptions
defaultSchemaOptions :: SchemaOptions
defaultSchemaOptions = SchemaOptions
{ fieldLabelModifier :: String -> String
fieldLabelModifier = String -> String
forall a. a -> a
id
, constructorTagModifier :: String -> String
constructorTagModifier = String -> String
forall a. a -> a
id
, datatypeNameModifier :: String -> String
datatypeNameModifier = String -> String
forall a. a -> a
id
, allNullaryToStringTag :: Bool
allNullaryToStringTag = Bool
True
, unwrapUnaryRecords :: Bool
unwrapUnaryRecords = Bool
False
, sumEncoding :: SumEncoding
sumEncoding = SumEncoding
Aeson.defaultTaggedObject
}
fromAesonOptions :: Aeson.Options -> SchemaOptions
fromAesonOptions :: Options -> SchemaOptions
fromAesonOptions Options
opts = SchemaOptions
defaultSchemaOptions
{ fieldLabelModifier = Aeson.fieldLabelModifier opts
, constructorTagModifier = Aeson.constructorTagModifier opts
, allNullaryToStringTag = Aeson.allNullaryToStringTag opts
, unwrapUnaryRecords = Aeson.unwrapUnaryRecords opts
, sumEncoding = Aeson.sumEncoding opts
}