Open RomainPruvostMHH opened 1 year ago
Many thanks for sticking with me. I guess I was confused too. With the previous
version of the plugin all we are generating is:
[INFO] writing file fooApi.java
[INFO] writing file foo\generated-sources\openapi\pom.xml
[INFO] writing file foo\generated-sources\openapi\README.md
[INFO] writing file foo\generated-sources\openapi\src\java\main\com\bar\ApiUtil.java
[INFO] writing file foo\generated-sources\openapi\.openapi-generator-ignore
[INFO] writing file foo\generated-sources\openapi\.openapi-generator\VERSION
[INFO] writing file foo\generated-sources\openapi\.openapi-generator\FILES
This is what I want to reproduce with the new version.
So your comment got me to wonder maybe I only need the client ....testing combinations of the matrix...
It's hard to say. Your reluctance to provide a sample is a problem. I could hazard a guess that since you generate ApiUtil
you are generating a server, but that's only an educated guess.
Came here from this Stack Overflow-comment and just wanted to say that 'useJakartaEe': 'true'
works beautifully for me with the java
generator and the native
library. Thanks for good work!
The feign generator still creates a build.gradle (and build.sbt) with the wrong jakarta version (with javax package), the generated pom.xml is correct.
I wonder if you can file a PR to fix it 🙏
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