Skip to content

Commit

Permalink
Fix for ENUM that works only by merging PR swagger-api/swagger-codege…
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio Bilello committed Oct 11, 2021
1 parent 08aeb6b commit ccd3e0e
Show file tree
Hide file tree
Showing 5 changed files with 1,280 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,33 @@ public void testGeneratorService_notNullJacksonAnnotationJava_True() throws IOEx
}
}

@Test(description = "test generator service with java enum parameters in type")
public void testGeneratorService_WithEnumParametersType() throws IOException {

String path = getTmpFolder().getAbsolutePath();
GenerationRequest request = new GenerationRequest();
request
.codegenVersion(GenerationRequest.CodegenVersion.V3)
.type(GenerationRequest.Type.CLIENT)
.lang("java")
.spec(loadSpecAsNode("3_0_0/issue-11166/issue-11166.yaml", true, false))
.options(
new Options()
.outputDir(path)
);

List<File> files = new GeneratorService().generationRequest(request).generate();
Assert.assertFalse(files.isEmpty());
for (File f: files) {
String relPath = f.getAbsolutePath().substring(path.length());
if ("/src/main/java/io/swagger/client/model/ResponseCreateMeetingSettings.java".equals(relPath)) {
String fileContent = FileUtils.readFileToString(f);
Assert.assertTrue(fileContent.contains("public static ApprovalTypeEnum fromValue(Integer input)"));
Assert.assertTrue(fileContent.contains("b.value.equals(input)"));
}
}
}

@Test(description = "test generator service with java")
public void testGeneratorService_notNullJacksonAnnotationJava_False() throws IOException {

Expand Down

0 comments on commit ccd3e0e

Please sign in to comment.