Add test cases to cover different collection formats (#3640)

* add test cases to cover different collection format

* add space params to retrofit 1.x

* add space params to retrofit 2.x

* rename url to localVarUrl

* fix exception in haskell servant
This commit is contained in:
William Cheng
2019-08-15 11:09:12 +08:00
committed by GitHub
parent 286cdfdfa2
commit c3535cf9ca
185 changed files with 8369 additions and 190 deletions

View File

@@ -504,3 +504,28 @@ instance Consumes TestJsonFormData MimeFormUrlEncoded
instance Produces TestJsonFormData MimeNoContent
-- *** testQueryParameterCollectionFormat
-- | @PUT \/fake\/test-query-paramters@
--
-- To test the collection format in query parameters
--
testQueryParameterCollectionFormat
:: Pipe -- ^ "pipe"
-> Ioutil -- ^ "ioutil"
-> Http -- ^ "http"
-> Url -- ^ "url"
-> Context -- ^ "context"
-> OpenAPIPetstoreRequest TestQueryParameterCollectionFormat MimeNoContent NoContent MimeNoContent
testQueryParameterCollectionFormat (Pipe pipe) (Ioutil ioutil) (Http http) (Url url) (Context context) =
_mkRequest "PUT" ["/fake/test-query-paramters"]
`setQuery` toQueryColl CommaSeparated ("pipe", Just pipe)
`setQuery` toQueryColl CommaSeparated ("ioutil", Just ioutil)
`setQuery` toQueryColl SpaceSeparated ("http", Just http)
`setQuery` toQueryColl CommaSeparated ("url", Just url)
`setQuery` toQueryColl MultiParamArray ("context", Just context)
data TestQueryParameterCollectionFormat
instance Produces TestQueryParameterCollectionFormat MimeNoContent

View File

@@ -93,6 +93,9 @@ newtype Byte = Byte { unByte :: ByteArray } deriving (P.Eq, P.Show)
-- ** Callback
newtype Callback = Callback { unCallback :: Text } deriving (P.Eq, P.Show)
-- ** Context
newtype Context = Context { unContext :: [Text] } deriving (P.Eq, P.Show)
-- ** EnumFormString
newtype EnumFormString = EnumFormString { unEnumFormString :: E'EnumFormString } deriving (P.Eq, P.Show)
@@ -120,6 +123,9 @@ newtype EnumQueryStringArray = EnumQueryStringArray { unEnumQueryStringArray ::
-- ** File2
newtype File2 = File2 { unFile2 :: FilePath } deriving (P.Eq, P.Show)
-- ** Http
newtype Http = Http { unHttp :: [Text] } deriving (P.Eq, P.Show)
-- ** Int32
newtype Int32 = Int32 { unInt32 :: Int } deriving (P.Eq, P.Show)
@@ -129,6 +135,9 @@ newtype Int64 = Int64 { unInt64 :: Integer } deriving (P.Eq, P.Show)
-- ** Int64Group
newtype Int64Group = Int64Group { unInt64Group :: Integer } deriving (P.Eq, P.Show)
-- ** Ioutil
newtype Ioutil = Ioutil { unIoutil :: [Text] } deriving (P.Eq, P.Show)
-- ** Name2
newtype Name2 = Name2 { unName2 :: Text } deriving (P.Eq, P.Show)
@@ -180,6 +189,9 @@ newtype PatternWithoutDelimiter = PatternWithoutDelimiter { unPatternWithoutDeli
-- ** PetId
newtype PetId = PetId { unPetId :: Integer } deriving (P.Eq, P.Show)
-- ** Pipe
newtype Pipe = Pipe { unPipe :: [Text] } deriving (P.Eq, P.Show)
-- ** Query
newtype Query = Query { unQuery :: Text } deriving (P.Eq, P.Show)
@@ -207,6 +219,9 @@ newtype StringGroup = StringGroup { unStringGroup :: Int } deriving (P.Eq, P.Sho
-- ** Tags
newtype Tags = Tags { unTags :: [Text] } deriving (P.Eq, P.Show)
-- ** Url
newtype Url = Url { unUrl :: [Text] } deriving (P.Eq, P.Show)
-- ** Username
newtype Username = Username { unUsername :: Text } deriving (P.Eq, P.Show)