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] [JAX-RS - Jersey 3] Missing generated securitySchemes annotations on operation #17776

Open
5 of 6 tasks
nbreuil opened this issue Feb 2, 2024 · 1 comment
Open
5 of 6 tasks

Comments

@nbreuil
Copy link
Contributor

nbreuil commented Feb 2, 2024

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

SecurityRequirements are not generated on API operation with JAX-RS / Jersey 3

My generated file :

@jakarta.ws.rs.GET
    @Operation(summary = "test jersey3", description = "", responses = {
            @ApiResponse(responseCode = "200", description = "successful operation", content = 
                @Content(schema = @Schema(implementation = Void.class))),
            }, tags={  }) 
    public Response petGet(@Context SecurityContext securityContext)
    throws NotFoundException {
        return delegate.petGet(securityContext);
    }

File I expect :

@jakarta.ws.rs.GET
    @Operation(summary = "test jersey3", description = "", responses = {
            @ApiResponse(responseCode = "200", description = "successful operation", content = 
                @Content(schema = @Schema(implementation = Void.class))),
            }, security = {
        @SecurityRequirement(name = "api_key")    }, tags={  }) 
    public Response petGet(@Context SecurityContext securityContext)
    throws NotFoundException {
        return delegate.petGet(securityContext);
    }
openapi-generator version

7.2.0 & master

OpenAPI declaration file content or url
openapi: 3.0.3
info:
  title: Jersey 3 security example
  version: 1.0.0
paths:
  /pet:
    get:
      summary: test jersey3
      responses:
        '200':
          description: successful operation
      security:
        - api_key: []
components:
  securitySchemes:
    api_key:
      type: apiKey
      name: api_key
      in: header
Generation Details
  • maven
  • openjdk-18
   <generatorName>jaxrs-jersey</generatorName>
   <library>jersey3</library>

or

java -jar openapi-generator-cli-7.2.0.jar generate -g jaxrs-jersey -i api.yaml --library jersey3
Steps to reproduce

Generate sources

Related issues/PRs

None

Suggest a fix

This file might be concerned, it doesn't include security parameters : api.mustache

@nbreuil
Copy link
Contributor Author

nbreuil commented Feb 3, 2024

PR here : #17778

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