forked from loafle/openapi-generator-original
[haskell-http-client] regen samples (#492)
This commit is contained in:
committed by
William Cheng
parent
a14e757059
commit
79fafda012
@@ -157,6 +157,52 @@ instance Consumes FakeOuterStringSerialize MimeJSON
|
||||
instance MimeType mtype => Produces FakeOuterStringSerialize mtype
|
||||
|
||||
|
||||
-- *** testBodyWithFileSchema
|
||||
|
||||
-- | @PUT \/fake\/body-with-file-schema@
|
||||
--
|
||||
-- For this test, the body for this request much reference a schema named `File`.
|
||||
--
|
||||
testBodyWithFileSchema
|
||||
:: (Consumes TestBodyWithFileSchema MimeJSON, MimeRender MimeJSON FileSchemaTestClass)
|
||||
=> FileSchemaTestClass -- ^ "fileSchemaTestClass"
|
||||
-> OpenAPIPetstoreRequest TestBodyWithFileSchema MimeJSON NoContent MimeNoContent
|
||||
testBodyWithFileSchema fileSchemaTestClass =
|
||||
_mkRequest "PUT" ["/fake/body-with-file-schema"]
|
||||
`setBodyParam` fileSchemaTestClass
|
||||
|
||||
data TestBodyWithFileSchema
|
||||
instance HasBodyParam TestBodyWithFileSchema FileSchemaTestClass
|
||||
|
||||
-- | @application/json@
|
||||
instance Consumes TestBodyWithFileSchema MimeJSON
|
||||
|
||||
instance Produces TestBodyWithFileSchema MimeNoContent
|
||||
|
||||
|
||||
-- *** testBodyWithQueryParams
|
||||
|
||||
-- | @PUT \/fake\/body-with-query-params@
|
||||
--
|
||||
testBodyWithQueryParams
|
||||
:: (Consumes TestBodyWithQueryParams MimeJSON, MimeRender MimeJSON User)
|
||||
=> User -- ^ "user"
|
||||
-> Query -- ^ "query"
|
||||
-> OpenAPIPetstoreRequest TestBodyWithQueryParams MimeJSON NoContent MimeNoContent
|
||||
testBodyWithQueryParams user (Query query) =
|
||||
_mkRequest "PUT" ["/fake/body-with-query-params"]
|
||||
`setBodyParam` user
|
||||
`setQuery` toQuery ("query", Just query)
|
||||
|
||||
data TestBodyWithQueryParams
|
||||
instance HasBodyParam TestBodyWithQueryParams User
|
||||
|
||||
-- | @application/json@
|
||||
instance Consumes TestBodyWithQueryParams MimeJSON
|
||||
|
||||
instance Produces TestBodyWithQueryParams MimeNoContent
|
||||
|
||||
|
||||
-- *** testClientModel
|
||||
|
||||
-- | @PATCH \/fake@
|
||||
|
||||
@@ -282,8 +282,8 @@ instance HasOptionalParam UploadFile AdditionalMetadata where
|
||||
req `_addMultiFormPart` NH.partLBS "additionalMetadata" (mimeRender' MimeMultipartFormData xs)
|
||||
|
||||
-- | /Optional Param/ "file" - file to upload
|
||||
instance HasOptionalParam UploadFile File where
|
||||
applyOptionalParam req (File xs) =
|
||||
instance HasOptionalParam UploadFile File2 where
|
||||
applyOptionalParam req (File2 xs) =
|
||||
req `_addMultiFormPart` NH.partFileSource "file" xs
|
||||
|
||||
-- | @multipart/form-data@
|
||||
@@ -292,3 +292,35 @@ instance Consumes UploadFile MimeMultipartFormData
|
||||
-- | @application/json@
|
||||
instance Produces UploadFile MimeJSON
|
||||
|
||||
|
||||
-- *** uploadFileWithRequiredFile
|
||||
|
||||
-- | @POST \/fake\/{petId}\/uploadImageWithRequiredFile@
|
||||
--
|
||||
-- uploads an image (required)
|
||||
--
|
||||
-- AuthMethod: 'AuthOAuthPetstoreAuth'
|
||||
--
|
||||
uploadFileWithRequiredFile
|
||||
:: (Consumes UploadFileWithRequiredFile MimeMultipartFormData)
|
||||
=> File2 -- ^ "file" - file to upload
|
||||
-> PetId -- ^ "petId" - ID of pet to update
|
||||
-> OpenAPIPetstoreRequest UploadFileWithRequiredFile MimeMultipartFormData ApiResponse MimeJSON
|
||||
uploadFileWithRequiredFile (File2 file) (PetId petId) =
|
||||
_mkRequest "POST" ["/fake/",toPath petId,"/uploadImageWithRequiredFile"]
|
||||
`_hasAuthType` (P.Proxy :: P.Proxy AuthOAuthPetstoreAuth)
|
||||
`_addMultiFormPart` NH.partFileSource "file" file
|
||||
|
||||
data UploadFileWithRequiredFile
|
||||
|
||||
-- | /Optional Param/ "additionalMetadata" - Additional data to pass to server
|
||||
instance HasOptionalParam UploadFileWithRequiredFile AdditionalMetadata where
|
||||
applyOptionalParam req (AdditionalMetadata xs) =
|
||||
req `_addMultiFormPart` NH.partLBS "additionalMetadata" (mimeRender' MimeMultipartFormData xs)
|
||||
|
||||
-- | @multipart/form-data@
|
||||
instance Consumes UploadFileWithRequiredFile MimeMultipartFormData
|
||||
|
||||
-- | @application/json@
|
||||
instance Produces UploadFileWithRequiredFile MimeJSON
|
||||
|
||||
|
||||
@@ -111,8 +111,8 @@ newtype EnumQueryString = EnumQueryString { unEnumQueryString :: E'EnumFormStrin
|
||||
-- ** EnumQueryStringArray
|
||||
newtype EnumQueryStringArray = EnumQueryStringArray { unEnumQueryStringArray :: [E'EnumFormStringArray] } deriving (P.Eq, P.Show)
|
||||
|
||||
-- ** File
|
||||
newtype File = File { unFile :: FilePath } deriving (P.Eq, P.Show)
|
||||
-- ** File2
|
||||
newtype File2 = File2 { unFile2 :: FilePath } deriving (P.Eq, P.Show)
|
||||
|
||||
-- ** Int32
|
||||
newtype Int32 = Int32 { unInt32 :: Int } deriving (P.Eq, P.Show)
|
||||
@@ -168,6 +168,9 @@ newtype PatternWithoutDelimiter = PatternWithoutDelimiter { unPatternWithoutDeli
|
||||
-- ** PetId
|
||||
newtype PetId = PetId { unPetId :: Integer } deriving (P.Eq, P.Show)
|
||||
|
||||
-- ** Query
|
||||
newtype Query = Query { unQuery :: Text } deriving (P.Eq, P.Show)
|
||||
|
||||
-- ** RequestBody
|
||||
newtype RequestBody = RequestBody { unRequestBody :: (Map.Map String Text) } deriving (P.Eq, P.Show, A.ToJSON)
|
||||
|
||||
@@ -698,6 +701,67 @@ mkEnumTest enumTestEnumStringRequired =
|
||||
, enumTestOuterEnum = Nothing
|
||||
}
|
||||
|
||||
-- ** File
|
||||
-- | File
|
||||
-- Must be named `File` for test.
|
||||
data File = File
|
||||
{ fileSourceUri :: !(Maybe Text) -- ^ "sourceURI" - Test capitalization
|
||||
} deriving (P.Show, P.Eq, P.Typeable)
|
||||
|
||||
-- | FromJSON File
|
||||
instance A.FromJSON File where
|
||||
parseJSON = A.withObject "File" $ \o ->
|
||||
File
|
||||
<$> (o .:? "sourceURI")
|
||||
|
||||
-- | ToJSON File
|
||||
instance A.ToJSON File where
|
||||
toJSON File {..} =
|
||||
_omitNulls
|
||||
[ "sourceURI" .= fileSourceUri
|
||||
]
|
||||
|
||||
|
||||
-- | Construct a value of type 'File' (by applying it's required fields, if any)
|
||||
mkFile
|
||||
:: File
|
||||
mkFile =
|
||||
File
|
||||
{ fileSourceUri = Nothing
|
||||
}
|
||||
|
||||
-- ** FileSchemaTestClass
|
||||
-- | FileSchemaTestClass
|
||||
data FileSchemaTestClass = FileSchemaTestClass
|
||||
{ fileSchemaTestClassFile :: !(Maybe File) -- ^ "file"
|
||||
, fileSchemaTestClassFiles :: !(Maybe [File]) -- ^ "files"
|
||||
} deriving (P.Show, P.Eq, P.Typeable)
|
||||
|
||||
-- | FromJSON FileSchemaTestClass
|
||||
instance A.FromJSON FileSchemaTestClass where
|
||||
parseJSON = A.withObject "FileSchemaTestClass" $ \o ->
|
||||
FileSchemaTestClass
|
||||
<$> (o .:? "file")
|
||||
<*> (o .:? "files")
|
||||
|
||||
-- | ToJSON FileSchemaTestClass
|
||||
instance A.ToJSON FileSchemaTestClass where
|
||||
toJSON FileSchemaTestClass {..} =
|
||||
_omitNulls
|
||||
[ "file" .= fileSchemaTestClassFile
|
||||
, "files" .= fileSchemaTestClassFiles
|
||||
]
|
||||
|
||||
|
||||
-- | Construct a value of type 'FileSchemaTestClass' (by applying it's required fields, if any)
|
||||
mkFileSchemaTestClass
|
||||
:: FileSchemaTestClass
|
||||
mkFileSchemaTestClass =
|
||||
FileSchemaTestClass
|
||||
{ fileSchemaTestClassFile = Nothing
|
||||
, fileSchemaTestClassFiles = Nothing
|
||||
}
|
||||
|
||||
-- ** FormatTest
|
||||
-- | FormatTest
|
||||
data FormatTest = FormatTest
|
||||
@@ -815,6 +879,8 @@ mkHasOnlyReadOnly =
|
||||
data MapTest = MapTest
|
||||
{ mapTestMapMapOfString :: !(Maybe (Map.Map String (Map.Map String Text))) -- ^ "map_map_of_string"
|
||||
, mapTestMapOfEnumString :: !(Maybe (Map.Map String E'Inner)) -- ^ "map_of_enum_string"
|
||||
, mapTestDirectMap :: !(Maybe (Map.Map String Bool)) -- ^ "direct_map"
|
||||
, mapTestIndirectMap :: !(Maybe StringBooleanMap) -- ^ "indirect_map"
|
||||
} deriving (P.Show, P.Eq, P.Typeable)
|
||||
|
||||
-- | FromJSON MapTest
|
||||
@@ -823,6 +889,8 @@ instance A.FromJSON MapTest where
|
||||
MapTest
|
||||
<$> (o .:? "map_map_of_string")
|
||||
<*> (o .:? "map_of_enum_string")
|
||||
<*> (o .:? "direct_map")
|
||||
<*> (o .:? "indirect_map")
|
||||
|
||||
-- | ToJSON MapTest
|
||||
instance A.ToJSON MapTest where
|
||||
@@ -830,6 +898,8 @@ instance A.ToJSON MapTest where
|
||||
_omitNulls
|
||||
[ "map_map_of_string" .= mapTestMapMapOfString
|
||||
, "map_of_enum_string" .= mapTestMapOfEnumString
|
||||
, "direct_map" .= mapTestDirectMap
|
||||
, "indirect_map" .= mapTestIndirectMap
|
||||
]
|
||||
|
||||
|
||||
@@ -840,6 +910,8 @@ mkMapTest =
|
||||
MapTest
|
||||
{ mapTestMapMapOfString = Nothing
|
||||
, mapTestMapOfEnumString = Nothing
|
||||
, mapTestDirectMap = Nothing
|
||||
, mapTestIndirectMap = Nothing
|
||||
}
|
||||
|
||||
-- ** MixedPropertiesAndAdditionalPropertiesClass
|
||||
@@ -1232,6 +1304,34 @@ mkSpecialModelName =
|
||||
{ specialModelNameSpecialPropertyName = Nothing
|
||||
}
|
||||
|
||||
-- ** StringBooleanMap
|
||||
-- | StringBooleanMap
|
||||
data StringBooleanMap = StringBooleanMap
|
||||
{
|
||||
} deriving (P.Show, P.Eq, P.Typeable)
|
||||
|
||||
-- | FromJSON StringBooleanMap
|
||||
instance A.FromJSON StringBooleanMap where
|
||||
parseJSON = A.withObject "StringBooleanMap" $ \o ->
|
||||
pure StringBooleanMap
|
||||
|
||||
|
||||
-- | ToJSON StringBooleanMap
|
||||
instance A.ToJSON StringBooleanMap where
|
||||
toJSON StringBooleanMap =
|
||||
_omitNulls
|
||||
[
|
||||
]
|
||||
|
||||
|
||||
-- | Construct a value of type 'StringBooleanMap' (by applying it's required fields, if any)
|
||||
mkStringBooleanMap
|
||||
:: StringBooleanMap
|
||||
mkStringBooleanMap =
|
||||
StringBooleanMap
|
||||
{
|
||||
}
|
||||
|
||||
-- ** Tag
|
||||
-- | Tag
|
||||
data Tag = Tag
|
||||
|
||||
@@ -275,6 +275,29 @@ enumTestOuterEnumL f EnumTest{..} = (\enumTestOuterEnum -> EnumTest { enumTestOu
|
||||
|
||||
|
||||
|
||||
-- * File
|
||||
|
||||
-- | 'fileSourceUri' Lens
|
||||
fileSourceUriL :: Lens_' File (Maybe Text)
|
||||
fileSourceUriL f File{..} = (\fileSourceUri -> File { fileSourceUri, ..} ) <$> f fileSourceUri
|
||||
{-# INLINE fileSourceUriL #-}
|
||||
|
||||
|
||||
|
||||
-- * FileSchemaTestClass
|
||||
|
||||
-- | 'fileSchemaTestClassFile' Lens
|
||||
fileSchemaTestClassFileL :: Lens_' FileSchemaTestClass (Maybe File)
|
||||
fileSchemaTestClassFileL f FileSchemaTestClass{..} = (\fileSchemaTestClassFile -> FileSchemaTestClass { fileSchemaTestClassFile, ..} ) <$> f fileSchemaTestClassFile
|
||||
{-# INLINE fileSchemaTestClassFileL #-}
|
||||
|
||||
-- | 'fileSchemaTestClassFiles' Lens
|
||||
fileSchemaTestClassFilesL :: Lens_' FileSchemaTestClass (Maybe [File])
|
||||
fileSchemaTestClassFilesL f FileSchemaTestClass{..} = (\fileSchemaTestClassFiles -> FileSchemaTestClass { fileSchemaTestClassFiles, ..} ) <$> f fileSchemaTestClassFiles
|
||||
{-# INLINE fileSchemaTestClassFilesL #-}
|
||||
|
||||
|
||||
|
||||
-- * FormatTest
|
||||
|
||||
-- | 'formatTestInteger' Lens
|
||||
@@ -370,6 +393,16 @@ mapTestMapOfEnumStringL :: Lens_' MapTest (Maybe (Map.Map String E'Inner))
|
||||
mapTestMapOfEnumStringL f MapTest{..} = (\mapTestMapOfEnumString -> MapTest { mapTestMapOfEnumString, ..} ) <$> f mapTestMapOfEnumString
|
||||
{-# INLINE mapTestMapOfEnumStringL #-}
|
||||
|
||||
-- | 'mapTestDirectMap' Lens
|
||||
mapTestDirectMapL :: Lens_' MapTest (Maybe (Map.Map String Bool))
|
||||
mapTestDirectMapL f MapTest{..} = (\mapTestDirectMap -> MapTest { mapTestDirectMap, ..} ) <$> f mapTestDirectMap
|
||||
{-# INLINE mapTestDirectMapL #-}
|
||||
|
||||
-- | 'mapTestIndirectMap' Lens
|
||||
mapTestIndirectMapL :: Lens_' MapTest (Maybe StringBooleanMap)
|
||||
mapTestIndirectMapL f MapTest{..} = (\mapTestIndirectMap -> MapTest { mapTestIndirectMap, ..} ) <$> f mapTestIndirectMap
|
||||
{-# INLINE mapTestIndirectMapL #-}
|
||||
|
||||
|
||||
|
||||
-- * MixedPropertiesAndAdditionalPropertiesClass
|
||||
@@ -570,6 +603,10 @@ specialModelNameSpecialPropertyNameL f SpecialModelName{..} = (\specialModelName
|
||||
|
||||
|
||||
|
||||
-- * StringBooleanMap
|
||||
|
||||
|
||||
|
||||
-- * Tag
|
||||
|
||||
-- | 'tagId' Lens
|
||||
|
||||
Reference in New Issue
Block a user