Merge pull request #3965 from ButterflyNetwork/swift-enum

[Swift] Add / as enum separator
This commit is contained in:
wing328 2016-10-12 15:59:15 +08:00 committed by GitHub
commit acfd2578dc
2 changed files with 7 additions and 2 deletions

View File

@ -396,8 +396,8 @@ public class SwiftCodegen extends DefaultCodegen implements CodegenConfig {
return value;
}
char[] separators = {'-', '_', ' ', ':'};
return WordUtils.capitalizeFully(StringUtils.lowerCase(value), separators).replaceAll("[-_ :]", "");
char[] separators = {'-', '_', ' ', ':', '/'};
return WordUtils.capitalizeFully(StringUtils.lowerCase(value), separators).replaceAll("[-_ :/]", "");
}

View File

@ -49,6 +49,11 @@ public class SwiftCodegenTest {
Assert.assertEquals(swiftCodegen.toSwiftyEnumName("entry_name"), "EntryName");
}
@Test
public void testSlash() throws Exception {
Assert.assertEquals(swiftCodegen.toSwiftyEnumName("application/x-tar"), "ApplicationXTar");
}
@Test(description = "returns NSData when response format is binary")
public void binaryDataTest() {
final Swagger model = new SwaggerParser().read("src/test/resources/2_0/binaryDataTest.json");