-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator?
- 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
Starting with OpenAPI Generator v7.17.0, when using the jaxrs-spec generator with interfaceOnly=true, the @Path annotation is no longer generated at the class level of JAX-RS interfaces. This breaks JAX-RS resource registration in frameworks like RESTEasy/Spring Boot, causing 404 errors for endpoints that worked correctly in v7.16.0.
Generator
jaxrs-spec
Configuration
<configOptions>
<interfaceOnly>true</interfaceOnly>
<useJakartaEe>true</useJakartaEe>
</configOptions>Expected Behavior (v7.16.0)
Generated interface includes @Path at class level:
@Path("/v1/opt-in")
public interface OptInApi {
@DELETE
void deleteOptInConfig();
@GET
OptInConfig getOptInConfig();
}Actual Behavior (v7.17.0)
Generated interface has NO @Path at class level:
public interface OptInApi {
@DELETE
@Path("/v1/opt-in")
void deleteOptInConfig();
@GET
@Path("/v1/opt-in")
OptInConfig getOptInConfig();
}Root Cause
This breaking change was introduced in commit 808d106e0c6 from PR #22169 "[jaxrs] Support jackson option (true by default)".
The change modified api.mustache template to conditionally generate @Path only when NOT using interfaceOnly:
{{^interfaceOnly}}
@Path("{{commonPath}}")
{{/interfaceOnly}}Impact
- JAX-RS frameworks like RESTEasy cannot properly register resources without class-level
@Pathannotation - Existing projects using
interfaceOnly=truebreak when upgrading to v7.17.0 - Results in 404 errors for previously working endpoints
Proposed Solution
The @Path annotation should be generated at class level regardless of interfaceOnly setting, as it's required for proper JAX-RS resource registration. The conditional logic should only apply to implementation-specific annotations, not core JAX-RS annotations.
Steps to Reproduce
- Use
jaxrs-specgenerator withinterfaceOnly=true - Generate code with v7.17.0
- Try to use generated interfaces in RESTEasy/Spring Boot application
- Observe 404 errors for endpoints
This appears to be an unintended breaking change that should be reverted or made configurable.