Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG][JAVA][JAXRS-SPEC] Multiple javadoc @return tags generated #20537

Open
miroch41 opened this issue Jan 24, 2025 · 0 comments
Open

[BUG][JAVA][JAXRS-SPEC] Multiple javadoc @return tags generated #20537

miroch41 opened this issue Jan 24, 2025 · 0 comments

Comments

@miroch41
Copy link

miroch41 commented Jan 24, 2025

Description

Generator jaxrs-spec generates invalid javadoc: It generates multiple @return tags: one for each possible response of the operation call. However, this is invalid (javadoc complains), since only a single instance of @return tag is expected.

openapi-generator version

open-api-generator-maven-plugin 7.11.0

OpenAPI declaration file content or url

The issue is reproducible with any OpenAPI declaration file declaring at least 2 responses for an operation, e.g.

https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator-gradle-plugin/samples/local-spec/petstore-v3.0.yaml

generates multiple @return tags for any method in PetsApi.java

Generation Details

Use the following spec in pom.xml

    <build>
        <plugins>
            <plugin>
                <groupId>org.openapitools</groupId>
                <artifactId>openapi-generator-maven-plugin</artifactId>
                <version>7.11.0</version>
                <executions>
                    <execution>
                        <id>multipleResponses</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator-gradle-plugin/samples/local-spec/petstore-v3.0.yaml</inputSpec>
                            <output>${project.build.directory}/generated-sources/cxf-rest/multiple-responses</output>
                            <generatorName>jaxrs-spec</generatorName>
                            <configOptions>
                                <apiPackage>com.multipleresponses.service</apiPackage>
                                <modelPackage>com.multipleresponses.data</modelPackage>
                                <sourceFolder>.</sourceFolder>
                                <useSwaggerAnnotations>false</useSwaggerAnnotations>
                                <generatePom>false</generatePom>
                                <interfaceOnly>true</interfaceOnly>
                                <useBeanValidation>true</useBeanValidation>
                                <useTags>true</useTags>
                                <dateLibrary>java8</dateLibrary>
                                <openApiSpecFileLocation />
                                <legacyDiscriminatorBehavior>false</legacyDiscriminatorBehavior>
                                <useJakartaEe>true</useJakartaEe>
                            </configOptions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
Steps to reproduce

Run mvn generate-sources

Related issues/PRs
Suggest a fix

Multiple responses should be covered by a single @return tag (e.g. as a list).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant