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
When generating a java client using microprofile REST client, I'm setting microprofileRestClientVersion=3.0. Microprofile REST client 3.0 is part of multiple versions of the microprofile spec. Here's a list of those microprofile spec versions, along with the version of the Jakarta EE spec they're compatible with:
Microprofile 5.0 (Jakarta EE 9.1)
Microprofile 6.0 (Jakarta EE 10)
The generated client makes use of Jakarta JSON binding to serialize and deserialize request and response objects. Jakarta EE 9.1 includes Jakarta JSON Binding 2.0. Jakarta EE 10 includes Jakarta JSON Binding 3.0.
The generated client makes use of the jakarta.json.bind.annotation.JsonbSubtype
and jakarta.json.bind.annotation.JsonbTypeInfo
annotations, which were introduced in Jakarta JSON Binding 3.0. This means that the generated client can not be used with Jakarta EE 9.1. This is a problem for me, as I need to generate a client that can be used with either Jakarta EE 9.1 or Jakarta EE 10. In this case, although there are API differences, they don't affect the compatibility of the generated client.
The generated code won't be able to compile at Jakarta EE 9.1 due to the use of classes above that aren't available at that spec level.
The sample project I've referenced doesn't actually require the jsonb polymorphism annotations, but they're still included as unused imports. This problem is equally relevant for generated code that does make use of the annotations. Simply removing the annotations where they're unused isn't going to fix this.
openapi-generator version
Problem exists from 7.11.0 up to and including 7.15.0-SNAPSHOT
OpenAPI declaration file content or url
Sample Maven project which reproduces the problem
Generation Details
Build the project with mvn clean install
Steps to reproduce
Build the referenced sample project with mvn clean install
Related issues/PRs
Suggest a fix
Introduced by this commit
From this PR
Is it possible to have an option which constrains the generated client to a particular microprofile specification version, rather than just the microprofileRestClient version, as other dependencies which are used can affect compatibility?