Fix dataTypeWithEnum for array of form parameters (#354)

* fix datatypewithenum for array of form parameters

* add test cases to cover dataTypeWithEnum, enumName in Ruby
This commit is contained in:
William Cheng 2018-05-08 20:55:49 +08:00 committed by GitHub
parent 0d20f75afc
commit 13f084e7b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 1 deletions

View File

@ -4092,6 +4092,7 @@ public class DefaultCodegen implements CodegenConfig {
codegenParameter.isListContainer = true;
codegenParameter.description = s.getDescription();
codegenParameter.dataType = getTypeDeclaration(s);
codegenParameter.datatypeWithEnum = codegenParameter.dataType.replace(codegenParameter.baseType, codegenParameter.enumName);
//TODO fix collectformat for form parameters
//collectionFormat = getCollectionFormat(s);
// default to csv:

View File

@ -152,6 +152,8 @@ public class RubyClientCodegenTest {
Assert.assertEquals(op.formParams.size(), 2);
CodegenParameter fp = op.formParams.get(0);
Assert.assertEquals(fp.dataType, "Array<String>");
Assert.assertEquals(fp.datatypeWithEnum, "Array<ENUM_FORM_STRING_ARRAY>");
Assert.assertEquals(fp.enumName, "ENUM_FORM_STRING_ARRAY");
}
@Test(description = "test example value for body parameter")

View File

@ -92,7 +92,7 @@ newtype Callback = Callback { unCallback :: Text } deriving (P.Eq, P.Show)
newtype EnumFormString = EnumFormString { unEnumFormString :: E'EnumFormString } deriving (P.Eq, P.Show)
-- ** EnumFormStringArray
newtype EnumFormStringArray = EnumFormStringArray { unEnumFormStringArray :: E'EnumFormStringArray } deriving (P.Eq, P.Show)
newtype EnumFormStringArray = EnumFormStringArray { unEnumFormStringArray :: [E'EnumFormStringArray] } deriving (P.Eq, P.Show)
-- ** EnumHeaderString
newtype EnumHeaderString = EnumHeaderString { unEnumHeaderString :: E'EnumFormString } deriving (P.Eq, P.Show)