OpenAPITools / OpenAPITools/openapi-generator
[BUG] [JAX-RS - Jersey 3] Missing generated securitySchemes annotations on operation
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Inspect modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/api.mustache, then run the documented jaxrs-jersey generation command with the provided OpenAPI YAML. Compare the generated operation annotation with the expected security requirement; done means the api_key SecurityRequirement appears for the operation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100