OpenAPITools / OpenAPITools/openapi-generator
[BUG] On openapi-generator-maven-plugin v7.3.0 with interfaceOnly uses ApiUtil but does not generate it
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
Upgrading from openapi-generator-maven-plugin v7.2.0 to v7.3.0.
Using configOptions like:
<configOptions>
<!-- Whether to generate only API interface stubs without the server files -->
<interfaceOnly>true</interfaceOnly>
<!-- Generate code and provide dependencies for use with Spring Boot 3.x -->
<useSpringBoot3>true</useSpringBoot3>
<!-- Skip header parameters that matches given regex in the generated API methods
using @ApiImplicitParams annotation -->
<implicitHeadersRegex>prefer</implicitHeadersRegex>
</configOptions>
The generated interface code now includes something like:
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/problem+json"))) {
String exampleString = "Custom MIME type example not yet supported: application/problem+json";
ApiUtil.setExampleResponse(request, "application/problem+json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/problem+json"))) {
String exampleString = "Custom MIME type example not yet supported: application/problem+json";
ApiUtil.setExampleResponse(request, "application/problem+json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/problem+json"))) {
String exampleString = "Custom MIME type example not yet supported: application/problem+json";
ApiUtil.setExampleResponse(request, "application/problem+json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/problem+json"))) {
String exampleString = "Custom MIME type example not yet supported: application/problem+json";
ApiUtil.setExampleResponse(request, "application/problem+json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/problem+json"))) {
String exampleString = "Custom MIME type example not yet supported: application/problem+json";
ApiUtil.setExampleResponse(request, "application/problem+json", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
But the ApiUtil class is not generated.
I tried adding following configuration properties without luck:
<generateSupportingFiles>true</generateSupportingFiles>
<supportingFilesToGenerate>ApiUtil.java</supportingFilesToGenerate>
With version v7.2.0 such java code is not generated (only the last return line is generated).
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
Start with the openapi-generator-maven-plugin handling of interfaceOnly and the generated Java interface shown in the report. Trace why that interface references ApiUtil while ApiUtil is absent, including whether supporting-file configuration is applied. Done means the interfaceOnly output is compilable and its behavior matches the v7.2.0 output or includes the required ApiUtil class.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100