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

Openapi endpoint generating values for @Context arguments #4498

Open
gssbzn opened this issue Oct 17, 2023 · 0 comments
Open

Openapi endpoint generating values for @Context arguments #4498

gssbzn opened this issue Oct 17, 2023 · 0 comments

Comments

@gssbzn
Copy link
Contributor

gssbzn commented Oct 17, 2023

This is an issue we've been seeing for a while now and we haven't figured out what or when it broke since it is only impacting "packaged" versions of our app and we are not able to reproduce locally so debugging has been a bit complicated

This is what we know so far, we have an endpoint annotated as

  @GET
  @Produces({MediaType.APPLICATION_JSON})
  @Operation(
      summary = "Return the status of the system")
 public Response getSystemStatus(
      @Context final HttpServletRequest pRequest) final Boolean pEnvelope) {
// not important
}

which is generating the following spec

paths:
  /api/public/v1.0:
    get:
      description: This resource returns information about the MongoDB application
        along with API key meta data.
      operationId: getSystemStatus
      requestBody:
        content:
          '*/*':
            schema:
              $ref: '#/components/schemas/HttpServletRequest'
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SystemStatus'
          description: OK

For some reason HttpServletRequest is being documented even tho is annotated with @Context and in theory should be ignored by default.
We are only seeing this on our "live" envs and not locally
We are also seeing this for multiple classes annotated with @Context but not all and the only thing they have in common is they are all GET operations and they get documented as part of the request body
So far I have managed to see that when io.swagger.v3.jaxrs2.Reader is called the param is already there and being added but I'm uncertain if the pram should've been filtered in a previous class/method

I'm happy to try and add a filter for this case but I'm currently uncertain what the best class/filter would be to achieve this fix

Some additional info
Java version: 17.0.8.1+1
swagger-core version 2.2.16 (and managed to reproduce up to 2.2.10)

altro3 added a commit to altro3/micronaut-openapi that referenced this issue Sep 1, 2024
altro3 added a commit to altro3/micronaut-openapi that referenced this issue Sep 4, 2024
graemerocher pushed a commit to micronaut-projects/micronaut-openapi that referenced this issue Sep 4, 2024
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