openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[Java] Support JsonNullable in JaxRS-spec (issue #9018)

Open Jurrie opened this issue 1 month ago • 6 comments

This fixes issue #9018

This is basically just copying the relevant things (the "vendorExtensions.x-is-jackson-optional-nullable" things) from modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/pojo.mustache to modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pojo.mustache.

Mentioning Java technical committee @bbdouglas @sreeshas @jfiala @lukoyanov @cbornet @jeff9finger @karismann @Zomzog @lwlee2608 @martin-mfg
PR checklist
  • [✔] Read the contribution guidelines.
  • [✔] Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • [✔] Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL) Commit all changed files. This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*. IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • [✔] File the PR against the correct branch: master (upcoming 7.x.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • [✔] If your PR solves a reported issue, reference it using GitHub's linking syntax (e.g., having "fixes #123" present in the PR description)
  • [✔] If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Jurrie avatar Nov 21 '25 13:11 Jurrie

thanks for the PR

please follow step 3 to update the samples.

wing328 avatar Nov 23 '25 08:11 wing328

Hi @wing328, sorry for missing this. The changes were in all sort of files I did not expect, so I assumed that these were not part of the PR. Now I see that they should've been included. The changes are present because the flag openApiNullable (default true) is now honored in modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pojo.mustache (the same way as in modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/pojo.mustache), causing a new import statement.

Jurrie avatar Nov 24 '25 07:11 Jurrie

After running bin/utils/ensure-up-to-date I get the following untracked files:

	modules/openapi-generator-cli/.checkstyle
	modules/openapi-generator-core/.checkstyle
	modules/openapi-generator-core/src/main/java/META-INF/
	modules/openapi-generator-maven-plugin/.checkstyle
	modules/openapi-generator-online/.checkstyle
	modules/openapi-generator-online/src/main/java/META-INF/
	modules/openapi-generator/.checkstyle
	modules/openapi-generator/src/main/java/META-INF/
	samples/server/petstore/springboot-beanvalidation/src/main/java/META-INF/
	samples/server/petstore/springboot-reactive/src/main/java/META-INF/
	samples/server/petstore/springboot-virtualan/src/main/java/META-INF/
	samples/server/petstore/springboot/src/main/java/META-INF/

These are most likely not related to my changes. At least, I don't recognize them as such. Should I commit those files?

Jurrie avatar Nov 24 '25 07:11 Jurrie

are you using WSL under Windows to run the command updating samples?

wing328 avatar Nov 24 '25 16:11 wing328

No, I'm using Ubuntu LTS.

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 24.04.3 LTS
Release:	24.04
Codename:	noble
$ java -version
openjdk version "11.0.23" 2024-04-16
OpenJDK Runtime Environment Temurin-11.0.23+9 (build 11.0.23+9)
OpenJDK 64-Bit Server VM Temurin-11.0.23+9 (build 11.0.23+9, mixed mode)
$ mvn --version
Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Maven home: /home/jurrie/java/apache-maven-3.9.6
Java version: 11.0.23, vendor: Eclipse Adoptium, runtime: /home/jurrie/.sdkman/candidates/java/11.0.23-tem
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.14.0-35-generic", arch: "amd64", family: "unix"

Jurrie avatar Nov 24 '25 16:11 Jurrie

@wing328 I cleaned my workspace and did the steps again. Now there are no uncommitted files. Possibly they were left-overs from previous build attempts. Let me know if I can do anything else to get this merged!

Jurrie avatar Nov 30 '25 12:11 Jurrie

https://github.com/OpenAPITools/openapi-generator/actions/runs/19626397191/job/57754122566?pr=22412

please review the build failure when you've time

for https://github.com/OpenAPITools/openapi-generator/actions/runs/19626397182/job/57754122210?pr=22412, please merge the latest master into your branch

wing328 avatar Dec 11 '25 07:12 wing328

@wing328 I fixed the build you referred to in https://github.com/OpenAPITools/openapi-generator/pull/22412/#issuecomment-3640670804. Could you restart the build please?

Jurrie avatar Dec 15 '25 14:12 Jurrie

https://github.com/OpenAPITools/openapi-generator/actions/runs/20235619961/job/58091458851?pr=22412

i think you will need to update the template (instead of the auto generated samples) to fix the issue

wing328 avatar Dec 15 '25 15:12 wing328

Alright, I think I did that now. I was quite confused by the fact that stuff that is generated is also committed 😀

Jurrie avatar Dec 15 '25 15:12 Jurrie