forked from loafle/openapi-generator-original
Add an option to skip "form" model generation (#700)
* add option to generate all models * update doc * rename option to skipFormModel * update petstore samples * Update doc * Update samples
This commit is contained in:
@@ -73,7 +73,7 @@ fakeOuterBooleanSerialize _ =
|
||||
data FakeOuterBooleanSerialize
|
||||
|
||||
-- | /Body Param/ "body" - Input boolean as post body
|
||||
instance HasBodyParam FakeOuterBooleanSerialize BodyBool
|
||||
instance HasBodyParam FakeOuterBooleanSerialize Body8
|
||||
|
||||
-- | @application/json@
|
||||
instance Consumes FakeOuterBooleanSerialize MimeJSON
|
||||
@@ -123,7 +123,7 @@ fakeOuterNumberSerialize _ =
|
||||
data FakeOuterNumberSerialize
|
||||
|
||||
-- | /Body Param/ "body" - Input number as post body
|
||||
instance HasBodyParam FakeOuterNumberSerialize Body
|
||||
instance HasBodyParam FakeOuterNumberSerialize Body6
|
||||
|
||||
-- | @application/json@
|
||||
instance Consumes FakeOuterNumberSerialize MimeJSON
|
||||
@@ -148,7 +148,7 @@ fakeOuterStringSerialize _ =
|
||||
data FakeOuterStringSerialize
|
||||
|
||||
-- | /Body Param/ "body" - Input string as post body
|
||||
instance HasBodyParam FakeOuterStringSerialize BodyText
|
||||
instance HasBodyParam FakeOuterStringSerialize Body7
|
||||
|
||||
-- | @application/json@
|
||||
instance Consumes FakeOuterStringSerialize MimeJSON
|
||||
|
||||
@@ -72,14 +72,14 @@ newtype AdditionalMetadata = AdditionalMetadata { unAdditionalMetadata :: Text }
|
||||
-- ** ApiKey
|
||||
newtype ApiKey = ApiKey { unApiKey :: Text } deriving (P.Eq, P.Show)
|
||||
|
||||
-- ** Body
|
||||
newtype Body = Body { unBody :: Double } deriving (P.Eq, P.Show, A.ToJSON)
|
||||
-- ** Body6
|
||||
newtype Body6 = Body6 { unBody6 :: Double } deriving (P.Eq, P.Show, A.ToJSON)
|
||||
|
||||
-- ** BodyBool
|
||||
newtype BodyBool = BodyBool { unBodyBool :: Bool } deriving (P.Eq, P.Show, A.ToJSON)
|
||||
-- ** Body7
|
||||
newtype Body7 = Body7 { unBody7 :: Text } deriving (P.Eq, P.Show, A.ToJSON)
|
||||
|
||||
-- ** BodyText
|
||||
newtype BodyText = BodyText { unBodyText :: Text } deriving (P.Eq, P.Show, A.ToJSON)
|
||||
-- ** Body8
|
||||
newtype Body8 = Body8 { unBody8 :: Bool } deriving (P.Eq, P.Show, A.ToJSON)
|
||||
|
||||
-- ** Byte
|
||||
newtype Byte = Byte { unByte :: ByteArray } deriving (P.Eq, P.Show)
|
||||
@@ -416,6 +416,253 @@ mkArrayTest =
|
||||
, arrayTestArrayArrayOfModel = Nothing
|
||||
}
|
||||
|
||||
-- ** Body
|
||||
-- | Body
|
||||
data Body = Body
|
||||
{ bodyName :: !(Maybe Text) -- ^ "name" - Updated name of the pet
|
||||
, bodyStatus :: !(Maybe Text) -- ^ "status" - Updated status of the pet
|
||||
} deriving (P.Show, P.Eq, P.Typeable)
|
||||
|
||||
-- | FromJSON Body
|
||||
instance A.FromJSON Body where
|
||||
parseJSON = A.withObject "Body" $ \o ->
|
||||
Body
|
||||
<$> (o .:? "name")
|
||||
<*> (o .:? "status")
|
||||
|
||||
-- | ToJSON Body
|
||||
instance A.ToJSON Body where
|
||||
toJSON Body {..} =
|
||||
_omitNulls
|
||||
[ "name" .= bodyName
|
||||
, "status" .= bodyStatus
|
||||
]
|
||||
|
||||
|
||||
-- | Construct a value of type 'Body' (by applying it's required fields, if any)
|
||||
mkBody
|
||||
:: Body
|
||||
mkBody =
|
||||
Body
|
||||
{ bodyName = Nothing
|
||||
, bodyStatus = Nothing
|
||||
}
|
||||
|
||||
-- ** Body1
|
||||
-- | Body1
|
||||
data Body1 = Body1
|
||||
{ body1AdditionalMetadata :: !(Maybe Text) -- ^ "additionalMetadata" - Additional data to pass to server
|
||||
, body1File :: !(Maybe FilePath) -- ^ "file" - file to upload
|
||||
} deriving (P.Show, P.Eq, P.Typeable)
|
||||
|
||||
-- | FromJSON Body1
|
||||
instance A.FromJSON Body1 where
|
||||
parseJSON = A.withObject "Body1" $ \o ->
|
||||
Body1
|
||||
<$> (o .:? "additionalMetadata")
|
||||
<*> (o .:? "file")
|
||||
|
||||
-- | ToJSON Body1
|
||||
instance A.ToJSON Body1 where
|
||||
toJSON Body1 {..} =
|
||||
_omitNulls
|
||||
[ "additionalMetadata" .= body1AdditionalMetadata
|
||||
, "file" .= body1File
|
||||
]
|
||||
|
||||
|
||||
-- | Construct a value of type 'Body1' (by applying it's required fields, if any)
|
||||
mkBody1
|
||||
:: Body1
|
||||
mkBody1 =
|
||||
Body1
|
||||
{ body1AdditionalMetadata = Nothing
|
||||
, body1File = Nothing
|
||||
}
|
||||
|
||||
-- ** Body2
|
||||
-- | Body2
|
||||
data Body2 = Body2
|
||||
{ body2EnumFormStringArray :: !(Maybe [E'EnumFormStringArray]) -- ^ "enum_form_string_array" - Form parameter enum test (string array)
|
||||
, body2EnumFormString :: !(Maybe E'EnumFormString) -- ^ "enum_form_string" - Form parameter enum test (string)
|
||||
} deriving (P.Show, P.Eq, P.Typeable)
|
||||
|
||||
-- | FromJSON Body2
|
||||
instance A.FromJSON Body2 where
|
||||
parseJSON = A.withObject "Body2" $ \o ->
|
||||
Body2
|
||||
<$> (o .:? "enum_form_string_array")
|
||||
<*> (o .:? "enum_form_string")
|
||||
|
||||
-- | ToJSON Body2
|
||||
instance A.ToJSON Body2 where
|
||||
toJSON Body2 {..} =
|
||||
_omitNulls
|
||||
[ "enum_form_string_array" .= body2EnumFormStringArray
|
||||
, "enum_form_string" .= body2EnumFormString
|
||||
]
|
||||
|
||||
|
||||
-- | Construct a value of type 'Body2' (by applying it's required fields, if any)
|
||||
mkBody2
|
||||
:: Body2
|
||||
mkBody2 =
|
||||
Body2
|
||||
{ body2EnumFormStringArray = Nothing
|
||||
, body2EnumFormString = Nothing
|
||||
}
|
||||
|
||||
-- ** Body3
|
||||
-- | Body3
|
||||
data Body3 = Body3
|
||||
{ body3Integer :: !(Maybe Int) -- ^ "integer" - None
|
||||
, body3Int32 :: !(Maybe Int) -- ^ "int32" - None
|
||||
, body3Int64 :: !(Maybe Integer) -- ^ "int64" - None
|
||||
, body3Number :: !(Double) -- ^ /Required/ "number" - None
|
||||
, body3Float :: !(Maybe Float) -- ^ "float" - None
|
||||
, body3Double :: !(Double) -- ^ /Required/ "double" - None
|
||||
, body3String :: !(Maybe Text) -- ^ "string" - None
|
||||
, body3PatternWithoutDelimiter :: !(Text) -- ^ /Required/ "pattern_without_delimiter" - None
|
||||
, body3Byte :: !(ByteArray) -- ^ /Required/ "byte" - None
|
||||
, body3Binary :: !(Maybe FilePath) -- ^ "binary" - None
|
||||
, body3Date :: !(Maybe Date) -- ^ "date" - None
|
||||
, body3DateTime :: !(Maybe DateTime) -- ^ "dateTime" - None
|
||||
, body3Password :: !(Maybe Text) -- ^ "password" - None
|
||||
, body3Callback :: !(Maybe Text) -- ^ "callback" - None
|
||||
} deriving (P.Show, P.Eq, P.Typeable)
|
||||
|
||||
-- | FromJSON Body3
|
||||
instance A.FromJSON Body3 where
|
||||
parseJSON = A.withObject "Body3" $ \o ->
|
||||
Body3
|
||||
<$> (o .:? "integer")
|
||||
<*> (o .:? "int32")
|
||||
<*> (o .:? "int64")
|
||||
<*> (o .: "number")
|
||||
<*> (o .:? "float")
|
||||
<*> (o .: "double")
|
||||
<*> (o .:? "string")
|
||||
<*> (o .: "pattern_without_delimiter")
|
||||
<*> (o .: "byte")
|
||||
<*> (o .:? "binary")
|
||||
<*> (o .:? "date")
|
||||
<*> (o .:? "dateTime")
|
||||
<*> (o .:? "password")
|
||||
<*> (o .:? "callback")
|
||||
|
||||
-- | ToJSON Body3
|
||||
instance A.ToJSON Body3 where
|
||||
toJSON Body3 {..} =
|
||||
_omitNulls
|
||||
[ "integer" .= body3Integer
|
||||
, "int32" .= body3Int32
|
||||
, "int64" .= body3Int64
|
||||
, "number" .= body3Number
|
||||
, "float" .= body3Float
|
||||
, "double" .= body3Double
|
||||
, "string" .= body3String
|
||||
, "pattern_without_delimiter" .= body3PatternWithoutDelimiter
|
||||
, "byte" .= body3Byte
|
||||
, "binary" .= body3Binary
|
||||
, "date" .= body3Date
|
||||
, "dateTime" .= body3DateTime
|
||||
, "password" .= body3Password
|
||||
, "callback" .= body3Callback
|
||||
]
|
||||
|
||||
|
||||
-- | Construct a value of type 'Body3' (by applying it's required fields, if any)
|
||||
mkBody3
|
||||
:: Double -- ^ 'body3Number': None
|
||||
-> Double -- ^ 'body3Double': None
|
||||
-> Text -- ^ 'body3PatternWithoutDelimiter': None
|
||||
-> ByteArray -- ^ 'body3Byte': None
|
||||
-> Body3
|
||||
mkBody3 body3Number body3Double body3PatternWithoutDelimiter body3Byte =
|
||||
Body3
|
||||
{ body3Integer = Nothing
|
||||
, body3Int32 = Nothing
|
||||
, body3Int64 = Nothing
|
||||
, body3Number
|
||||
, body3Float = Nothing
|
||||
, body3Double
|
||||
, body3String = Nothing
|
||||
, body3PatternWithoutDelimiter
|
||||
, body3Byte
|
||||
, body3Binary = Nothing
|
||||
, body3Date = Nothing
|
||||
, body3DateTime = Nothing
|
||||
, body3Password = Nothing
|
||||
, body3Callback = Nothing
|
||||
}
|
||||
|
||||
-- ** Body4
|
||||
-- | Body4
|
||||
data Body4 = Body4
|
||||
{ body4Param :: !(Text) -- ^ /Required/ "param" - field1
|
||||
, body4Param2 :: !(Text) -- ^ /Required/ "param2" - field2
|
||||
} deriving (P.Show, P.Eq, P.Typeable)
|
||||
|
||||
-- | FromJSON Body4
|
||||
instance A.FromJSON Body4 where
|
||||
parseJSON = A.withObject "Body4" $ \o ->
|
||||
Body4
|
||||
<$> (o .: "param")
|
||||
<*> (o .: "param2")
|
||||
|
||||
-- | ToJSON Body4
|
||||
instance A.ToJSON Body4 where
|
||||
toJSON Body4 {..} =
|
||||
_omitNulls
|
||||
[ "param" .= body4Param
|
||||
, "param2" .= body4Param2
|
||||
]
|
||||
|
||||
|
||||
-- | Construct a value of type 'Body4' (by applying it's required fields, if any)
|
||||
mkBody4
|
||||
:: Text -- ^ 'body4Param': field1
|
||||
-> Text -- ^ 'body4Param2': field2
|
||||
-> Body4
|
||||
mkBody4 body4Param body4Param2 =
|
||||
Body4
|
||||
{ body4Param
|
||||
, body4Param2
|
||||
}
|
||||
|
||||
-- ** Body5
|
||||
-- | Body5
|
||||
data Body5 = Body5
|
||||
{ body5AdditionalMetadata :: !(Maybe Text) -- ^ "additionalMetadata" - Additional data to pass to server
|
||||
, body5RequiredFile :: !(FilePath) -- ^ /Required/ "requiredFile" - file to upload
|
||||
} deriving (P.Show, P.Eq, P.Typeable)
|
||||
|
||||
-- | FromJSON Body5
|
||||
instance A.FromJSON Body5 where
|
||||
parseJSON = A.withObject "Body5" $ \o ->
|
||||
Body5
|
||||
<$> (o .:? "additionalMetadata")
|
||||
<*> (o .: "requiredFile")
|
||||
|
||||
-- | ToJSON Body5
|
||||
instance A.ToJSON Body5 where
|
||||
toJSON Body5 {..} =
|
||||
_omitNulls
|
||||
[ "additionalMetadata" .= body5AdditionalMetadata
|
||||
, "requiredFile" .= body5RequiredFile
|
||||
]
|
||||
|
||||
|
||||
-- | Construct a value of type 'Body5' (by applying it's required fields, if any)
|
||||
mkBody5
|
||||
:: FilePath -- ^ 'body5RequiredFile': file to upload
|
||||
-> Body5
|
||||
mkBody5 body5RequiredFile =
|
||||
Body5
|
||||
{ body5AdditionalMetadata = Nothing
|
||||
, body5RequiredFile
|
||||
}
|
||||
|
||||
-- ** Capitalization
|
||||
-- | Capitalization
|
||||
data Capitalization = Capitalization
|
||||
|
||||
@@ -124,6 +124,150 @@ arrayTestArrayArrayOfModelL f ArrayTest{..} = (\arrayTestArrayArrayOfModel -> Ar
|
||||
|
||||
|
||||
|
||||
-- * Body
|
||||
|
||||
-- | 'bodyName' Lens
|
||||
bodyNameL :: Lens_' Body (Maybe Text)
|
||||
bodyNameL f Body{..} = (\bodyName -> Body { bodyName, ..} ) <$> f bodyName
|
||||
{-# INLINE bodyNameL #-}
|
||||
|
||||
-- | 'bodyStatus' Lens
|
||||
bodyStatusL :: Lens_' Body (Maybe Text)
|
||||
bodyStatusL f Body{..} = (\bodyStatus -> Body { bodyStatus, ..} ) <$> f bodyStatus
|
||||
{-# INLINE bodyStatusL #-}
|
||||
|
||||
|
||||
|
||||
-- * Body1
|
||||
|
||||
-- | 'body1AdditionalMetadata' Lens
|
||||
body1AdditionalMetadataL :: Lens_' Body1 (Maybe Text)
|
||||
body1AdditionalMetadataL f Body1{..} = (\body1AdditionalMetadata -> Body1 { body1AdditionalMetadata, ..} ) <$> f body1AdditionalMetadata
|
||||
{-# INLINE body1AdditionalMetadataL #-}
|
||||
|
||||
-- | 'body1File' Lens
|
||||
body1FileL :: Lens_' Body1 (Maybe FilePath)
|
||||
body1FileL f Body1{..} = (\body1File -> Body1 { body1File, ..} ) <$> f body1File
|
||||
{-# INLINE body1FileL #-}
|
||||
|
||||
|
||||
|
||||
-- * Body2
|
||||
|
||||
-- | 'body2EnumFormStringArray' Lens
|
||||
body2EnumFormStringArrayL :: Lens_' Body2 (Maybe [E'EnumFormStringArray])
|
||||
body2EnumFormStringArrayL f Body2{..} = (\body2EnumFormStringArray -> Body2 { body2EnumFormStringArray, ..} ) <$> f body2EnumFormStringArray
|
||||
{-# INLINE body2EnumFormStringArrayL #-}
|
||||
|
||||
-- | 'body2EnumFormString' Lens
|
||||
body2EnumFormStringL :: Lens_' Body2 (Maybe E'EnumFormString)
|
||||
body2EnumFormStringL f Body2{..} = (\body2EnumFormString -> Body2 { body2EnumFormString, ..} ) <$> f body2EnumFormString
|
||||
{-# INLINE body2EnumFormStringL #-}
|
||||
|
||||
|
||||
|
||||
-- * Body3
|
||||
|
||||
-- | 'body3Integer' Lens
|
||||
body3IntegerL :: Lens_' Body3 (Maybe Int)
|
||||
body3IntegerL f Body3{..} = (\body3Integer -> Body3 { body3Integer, ..} ) <$> f body3Integer
|
||||
{-# INLINE body3IntegerL #-}
|
||||
|
||||
-- | 'body3Int32' Lens
|
||||
body3Int32L :: Lens_' Body3 (Maybe Int)
|
||||
body3Int32L f Body3{..} = (\body3Int32 -> Body3 { body3Int32, ..} ) <$> f body3Int32
|
||||
{-# INLINE body3Int32L #-}
|
||||
|
||||
-- | 'body3Int64' Lens
|
||||
body3Int64L :: Lens_' Body3 (Maybe Integer)
|
||||
body3Int64L f Body3{..} = (\body3Int64 -> Body3 { body3Int64, ..} ) <$> f body3Int64
|
||||
{-# INLINE body3Int64L #-}
|
||||
|
||||
-- | 'body3Number' Lens
|
||||
body3NumberL :: Lens_' Body3 (Double)
|
||||
body3NumberL f Body3{..} = (\body3Number -> Body3 { body3Number, ..} ) <$> f body3Number
|
||||
{-# INLINE body3NumberL #-}
|
||||
|
||||
-- | 'body3Float' Lens
|
||||
body3FloatL :: Lens_' Body3 (Maybe Float)
|
||||
body3FloatL f Body3{..} = (\body3Float -> Body3 { body3Float, ..} ) <$> f body3Float
|
||||
{-# INLINE body3FloatL #-}
|
||||
|
||||
-- | 'body3Double' Lens
|
||||
body3DoubleL :: Lens_' Body3 (Double)
|
||||
body3DoubleL f Body3{..} = (\body3Double -> Body3 { body3Double, ..} ) <$> f body3Double
|
||||
{-# INLINE body3DoubleL #-}
|
||||
|
||||
-- | 'body3String' Lens
|
||||
body3StringL :: Lens_' Body3 (Maybe Text)
|
||||
body3StringL f Body3{..} = (\body3String -> Body3 { body3String, ..} ) <$> f body3String
|
||||
{-# INLINE body3StringL #-}
|
||||
|
||||
-- | 'body3PatternWithoutDelimiter' Lens
|
||||
body3PatternWithoutDelimiterL :: Lens_' Body3 (Text)
|
||||
body3PatternWithoutDelimiterL f Body3{..} = (\body3PatternWithoutDelimiter -> Body3 { body3PatternWithoutDelimiter, ..} ) <$> f body3PatternWithoutDelimiter
|
||||
{-# INLINE body3PatternWithoutDelimiterL #-}
|
||||
|
||||
-- | 'body3Byte' Lens
|
||||
body3ByteL :: Lens_' Body3 (ByteArray)
|
||||
body3ByteL f Body3{..} = (\body3Byte -> Body3 { body3Byte, ..} ) <$> f body3Byte
|
||||
{-# INLINE body3ByteL #-}
|
||||
|
||||
-- | 'body3Binary' Lens
|
||||
body3BinaryL :: Lens_' Body3 (Maybe FilePath)
|
||||
body3BinaryL f Body3{..} = (\body3Binary -> Body3 { body3Binary, ..} ) <$> f body3Binary
|
||||
{-# INLINE body3BinaryL #-}
|
||||
|
||||
-- | 'body3Date' Lens
|
||||
body3DateL :: Lens_' Body3 (Maybe Date)
|
||||
body3DateL f Body3{..} = (\body3Date -> Body3 { body3Date, ..} ) <$> f body3Date
|
||||
{-# INLINE body3DateL #-}
|
||||
|
||||
-- | 'body3DateTime' Lens
|
||||
body3DateTimeL :: Lens_' Body3 (Maybe DateTime)
|
||||
body3DateTimeL f Body3{..} = (\body3DateTime -> Body3 { body3DateTime, ..} ) <$> f body3DateTime
|
||||
{-# INLINE body3DateTimeL #-}
|
||||
|
||||
-- | 'body3Password' Lens
|
||||
body3PasswordL :: Lens_' Body3 (Maybe Text)
|
||||
body3PasswordL f Body3{..} = (\body3Password -> Body3 { body3Password, ..} ) <$> f body3Password
|
||||
{-# INLINE body3PasswordL #-}
|
||||
|
||||
-- | 'body3Callback' Lens
|
||||
body3CallbackL :: Lens_' Body3 (Maybe Text)
|
||||
body3CallbackL f Body3{..} = (\body3Callback -> Body3 { body3Callback, ..} ) <$> f body3Callback
|
||||
{-# INLINE body3CallbackL #-}
|
||||
|
||||
|
||||
|
||||
-- * Body4
|
||||
|
||||
-- | 'body4Param' Lens
|
||||
body4ParamL :: Lens_' Body4 (Text)
|
||||
body4ParamL f Body4{..} = (\body4Param -> Body4 { body4Param, ..} ) <$> f body4Param
|
||||
{-# INLINE body4ParamL #-}
|
||||
|
||||
-- | 'body4Param2' Lens
|
||||
body4Param2L :: Lens_' Body4 (Text)
|
||||
body4Param2L f Body4{..} = (\body4Param2 -> Body4 { body4Param2, ..} ) <$> f body4Param2
|
||||
{-# INLINE body4Param2L #-}
|
||||
|
||||
|
||||
|
||||
-- * Body5
|
||||
|
||||
-- | 'body5AdditionalMetadata' Lens
|
||||
body5AdditionalMetadataL :: Lens_' Body5 (Maybe Text)
|
||||
body5AdditionalMetadataL f Body5{..} = (\body5AdditionalMetadata -> Body5 { body5AdditionalMetadata, ..} ) <$> f body5AdditionalMetadata
|
||||
{-# INLINE body5AdditionalMetadataL #-}
|
||||
|
||||
-- | 'body5RequiredFile' Lens
|
||||
body5RequiredFileL :: Lens_' Body5 (FilePath)
|
||||
body5RequiredFileL f Body5{..} = (\body5RequiredFile -> Body5 { body5RequiredFile, ..} ) <$> f body5RequiredFile
|
||||
{-# INLINE body5RequiredFileL #-}
|
||||
|
||||
|
||||
|
||||
-- * Capitalization
|
||||
|
||||
-- | 'capitalizationSmallCamel' Lens
|
||||
|
||||
Reference in New Issue
Block a user