Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,12 @@ public void processOpts() {
super.processOpts();

if (SPRING_HTTP_INTERFACE.equals(library)) {
if (documentationProvider != null) {
additionalProperties.remove(documentationProvider.getPropertyName());
}
if (annotationLibrary != null) {
additionalProperties.remove(annotationLibrary.getPropertyName());
}
documentationProvider = DocumentationProvider.NONE;
annotationLibrary = AnnotationLibrary.NONE;
useJakartaEe = true;
Expand Down Expand Up @@ -491,7 +497,7 @@ public void processOpts() {
convertPropertyToBooleanAndWriteBack(RETURN_SUCCESS_CODE, this::setReturnSuccessCode);
convertPropertyToBooleanAndWriteBack(USE_SWAGGER_UI, this::setUseSwaggerUI);
convertPropertyToBooleanAndWriteBack(USE_SEALED, this::setUseSealed);
if (getDocumentationProvider().equals(DocumentationProvider.NONE)) {
if (DocumentationProvider.NONE.equals(getDocumentationProvider())) {
this.setUseSwaggerUI(false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6592,7 +6592,6 @@ public void shouldImportJackson3JsonDeserializeForUniqueItemsWhenJackson3Set() t
codegen.setOpenAPI(openAPI);
codegen.setOutputDir(output.getAbsolutePath());


codegen.additionalProperties().put(SpringCodegen.USE_SPRING_BOOT4, "true");
codegen.additionalProperties().put(SpringCodegen.USE_JACKSON_3, "true");
codegen.additionalProperties().put(SpringCodegen.OPENAPI_NULLABLE, "false");
Expand All @@ -6611,4 +6610,31 @@ public void shouldImportJackson3JsonDeserializeForUniqueItemsWhenJackson3Set() t
.hasImports("tools.jackson.databind.annotation.JsonDeserialize");
}

@Test
public void shouldNotHaveDocumentationAnnotationWhenUsingLibrarySpringHttpInterface() throws IOException {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
output.deleteOnExit();
String outputPath = output.getAbsolutePath().replace('\\', '/');

final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/petstore-echo.yaml");
final SpringCodegen codegen = new SpringCodegen();
codegen.setOpenAPI(openAPI);
codegen.setOutputDir(output.getAbsolutePath());
codegen.setLibrary(SPRING_HTTP_INTERFACE);
codegen.setAnnotationLibrary(AnnotationLibrary.SWAGGER2);
codegen.setDocumentationProvider(DocumentationProvider.SPRINGDOC);

ClientOptInput input = new ClientOptInput();
input.openAPI(openAPI);
input.config(codegen);

DefaultGenerator generator = new DefaultGenerator();
generator.setGenerateMetadata(false); // skip metadata generation

Map<String, File> files = generator.opts(input).generate().stream()
.collect(Collectors.toMap(File::getName, Function.identity()));

JavaFileAssert.assertThat(Paths.get(outputPath + "/src/main/java/org/openapitools/api/PetApi.java"))
.assertMethod("addPet").assertParameter("pet").assertParameterAnnotations().doesNotContainWithName("Parameter");
}
}
Loading