Bug Report Checklist
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
@Path annotation
- Existing projects using
interfaceOnly=true break 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-spec generator with interfaceOnly=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.
Bug Report Checklist
Description
Starting with OpenAPI Generator v7.17.0, when using the
jaxrs-specgenerator withinterfaceOnly=true, the@Pathannotation 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
Expected Behavior (v7.16.0)
Generated interface includes
@Pathat class level:Actual Behavior (v7.17.0)
Generated interface has NO
@Pathat class level:Root Cause
This breaking change was introduced in commit 808d106e0c6 from PR #22169 "[jaxrs] Support jackson option (true by default)".
The change modified
api.mustachetemplate to conditionally generate@Pathonly when NOT usinginterfaceOnly:Impact
@PathannotationinterfaceOnly=truebreak when upgrading to v7.17.0Proposed Solution
The
@Pathannotation should be generated at class level regardless ofinterfaceOnlysetting, 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
jaxrs-specgenerator withinterfaceOnly=trueThis appears to be an unintended breaking change that should be reverted or made configurable.