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

Endpoint where the request body is an extended class is not generated in swagger.json #4775

Open
igiguere opened this issue Nov 8, 2024 · 0 comments

Comments

@igiguere
Copy link

igiguere commented Nov 8, 2024

Please refer to the attached sample maven project and result swagger.json.

swagger.json
sample-webapp.zip

Description

Class ExtendedResource extends AbstractResource (which implements ResourceInterface).

Class ExtendedResource defines 3 REST commands, on the same endpoint "sample/extended": GET, PUT, POST

The PUT and POST endpoints have request body of type ExtendedData. Class ExtendedData extends AbstractData.

In the resulting swagger.json, only GET is generated for resource "/sample/extended" :
"/sample/extended" : { "get" : { "tags" : [ "extended data resource" ], "description" : "Retrieve extended data.", "operationId" : "get", "responses" : { "200" : { "description" : "Normal response", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/extendedData" } }, "application/xml" : { "schema" : { "$ref" : "#/components/schemas/extendedData" } } } } } } }

Notes

If either the request body class or the resource class is not an extended class, then all REST commands are generated in swagger.json, as shown by the examples using class SimpleData, and class SimpleResource.

See also the fixed bug: #3694

Swagger Version

    <dependency>
        <groupId>io.swagger.core.v3</groupId>
        <artifactId>swagger-core-jakarta</artifactId>
        <version>2.2.25</version>
    </dependency>

Other dependencies versions : refer to pom.xml in the attached project.

To Reproduce

  • Unzip sample-webapp.zip
  • Run : mvn clean package
  • Observe the resulting swagger.json in target/sample-webapp-0.0.1-SNAPSHOT/swagger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant