OpenAPITools / OpenAPITools/openapi-generator

[REQ] [Java] Support of JakartaEE 9

Open
#13,124 64 comments 28 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Context

Since Eclipse Foundation is in charge of JakartaEE specifications, it's time to switch to JakartaEE 9 for openapi generator.
The first step was to switch to JakartaEE 8 (see the issue #10504). It's done now.

The next step is to upgrade to JakartaEE 9 which means to upgrade to new versions of jakarta's dependencies.
But this upgrade is a bit more difficult than the previous because the main goal of JakartaEE 9 is that the javax.* packages to jakarta.* packages have been renamed by Eclipse.
I think that it will be necessary to create a new property (named jakartaeeVersion=9 for example) to allow the user to generate the source code with the actual versions of jakartaEE 8 or the last versions of jakartaEE 9.

Describe the solution you'd like

We need to upgrade the following dependencies in the Maven/Gradle/Scala mustache template files. These template files are located in openapi-generator/modules/openapi-generator/src/main/resources.

jakarta.annotation:jakarta.annotation-api:1.3.5 => 2.0.0
jakarta.validation:jakarta.validation-api:2.0.2 => 3.0.0
jakarta.ws.rs:jakarta.ws.rs-api:2.1.6 => 3.0.0
jakarta.json.bind:jakarta.json.bind-api:1.0.2 => 2.0.0
jakarta.json:jakarta.json-api:1.1.6 => 2.0.0
jakarta.xml.bind:jakarta.xml.bind-api:2.3.3 => 3.0.0
jakarta.el:jakarta.el-api:3.0.3 => 4.0.0
jakarta.servlet:jakarta.servlet-api:4.0.4 => 5.0.0
jakarta.activation:jakarta.activation-api:1.2.2 => 2.0.0

The upgrade of jakarta versions will force us to replace all javax.* import by jakarta.* in the mustache templates.

Then, we need a new property named jakartaeeVersion to keep the generation source code as is (with the package javax.* ) or to use the new jakartaEE 9 classes in the generated source code.
By default, if the property didn't set, we consider that we are still on jakartaEE 8 (javax.*).

Beware, some samples are dependents of Spring Boot. For them, it will be necessary to upgrade the version of spring boot parent to 3 (release in September 2022). It is not part of the scope of this issue.

How to validate the request

We need to create an unit test with the property jakartaeeVersion. The versions of depedencies should be equal to the versions above.
And of course, we need to create a new java sample with the new property.

Additional context

Versions of JakartaEE 9 : https://projects.eclipse.org/releases/jakarta-ee-9. Or a map here https://jakarta.ee/release/9/
Explanations of JakartaEE 9 release plan : https://eclipse-ee4j.github.io/jakartaee-platform/jakartaee9/JakartaEE9ReleasePlan

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in openapi-generator/modules/openapi-generator/src/main/resources and review the Maven, Gradle, and Scala mustache templates, then locate the existing unit-test and sample-generation paths. Done means Jakarta EE 9 dependency versions and package imports are supported through jakartaeeVersion while the default remains Jakarta EE 8, with a unit test and new Java sample validating the property.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.