OpenAPITools / OpenAPITools/openapi-generator
[BUG] jaxrs-jersey with useJakartaEe=true JacksonJsonProvider depends on javax.ws.rs.ext.MessageBodyReader
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
the generated JacksonJsonProvider generated with jaxrs-jersey and useJakartaEe=true does not compile:
JacksonJsonProvider.java:[17,8] cannot access javax.ws.rs.ext.MessageBodyReader
class file for javax.ws.rs.ext.MessageBodyReader not found
adding the dependency for javax.ws.rs.ext.MessageBodyReader results in:
Bootstrap.java:[29,51] incompatible types: jakarta.servlet.ServletConfig cannot be converted to javax.servlet.ServletConfig
openapi-generator version
6.6.0 (openapi-generator-maven-plugin)
Generation Details
Steps to reproduce
generate with maven. snippet from pom:
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/example.yaml</inputSpec>
<generatorName>jaxrs-jersey</generatorName>
<configOptions>
<sourceFolder>src/main/java</sourceFolder>
<dateLibrary>java8</dateLibrary>
<java8>true</java8>
<useJakartaEe>true</useJakartaEe>
</configOptions>
<modelPackage>com.example.api.model</modelPackage>
<apiPackage>com.example.api</apiPackage>
</configuration>
</execution>
</executions>
</plugin>
looks like the generator should import com.fasterxml.jackson.jakarta.rs.json.JacksonXmlBindJsonProvider from jackson-jakarta-rs-json-provider when useJakartaEe=true .
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 by generating a jaxrs-jersey server with the Maven plugin configuration shown and inspect the generated JacksonJsonProvider plus its dependencies. Verify the Jakarta setting selects compatible Jackson and servlet/JAX-RS types; done means the generated project compiles with useJakartaEe=true without adding conflicting javax dependencies.
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
- Mostly clear
- Newbie friendliness
- 45/100