Skip to content

[java] fixed pojo template for nullable fields#12630

Merged
wing328 merged 3 commits intoOpenAPITools:masterfrom
valmoz:java-fix-nullable-fields-template
Jul 23, 2022
Merged

[java] fixed pojo template for nullable fields#12630
wing328 merged 3 commits intoOpenAPITools:masterfrom
valmoz:java-fix-nullable-fields-template

Conversation

@valmoz
Copy link
Contributor

@valmoz valmoz commented Jun 17, 2022

Related to #12549 this PR modifies the template to be able to manage also JSON fields explicitly set to null (not only omitted field case).

It uses Gson's "isJsonNull" method to check this case, instead of only checking if the key isn't present.

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 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    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*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master (6.0.1) (patch release), 6.1.x (breaking changes with fallbacks), 7.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@wing328
Copy link
Member

wing328 commented Jun 18, 2022

can you please update the samples so that the CI can verify the result?

Copy link

@melloware melloware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@valmoz it looks like the samples tests are failing can you update please?

@valmoz valmoz force-pushed the java-fix-nullable-fields-template branch from e608577 to fb7fcd4 Compare June 23, 2022 12:47
@valmoz
Copy link
Contributor Author

valmoz commented Jun 23, 2022

@wing328 I tried, but both the following commands are failing:

./mvnw clean package
./bin/generate-samples.sh

I checked, and I'm using Java 1.8... Do you have some suggestions about how to make it work properly?

@wing328
Copy link
Member

wing328 commented Jul 2, 2022

@valmoz what error did you get?

@valmoz
Copy link
Contributor Author

valmoz commented Jul 4, 2022

@wing328 I was able to run it. It seems that my maven kept using the wrong version of Java.

@valmoz
Copy link
Contributor Author

valmoz commented Jul 5, 2022

@bbdouglas @sreeshas @jfiala @lukoyanov @cbornet @jeff9finger @karismann @Zomzog @lwlee2608

@vlauciani
Copy link

up 🙏

@vlauciani
Copy link

Waiting the merge, I built a docker image with this PR:

it works very well!

Thank you @valmoz

@JamesBarnes88
Copy link

up 🙏

@wing328 wing328 added this to the 6.1.0 milestone Jul 23, 2022
@wing328 wing328 merged commit ea7a319 into OpenAPITools:master Jul 23, 2022
@wing328
Copy link
Member

wing328 commented Jul 23, 2022

@valmoz thanks for the PR, which has been merged.

@valmoz valmoz deleted the java-fix-nullable-fields-template branch July 23, 2022 16:35
nikosmoum added a commit to candlepin/candlepin that referenced this pull request Feb 22, 2023
- Remove the client generator pojo.mustache override file since the
  bug we worked around has been fixed in 6.3.0.
  (OpenAPITools/openapi-generator#12630)
- Remove the server generator pojo.mustache override file since the
  bug we worked around has been fixed in 6.3.0.
  (OpenAPITools/openapi-generator#13076)
- Merge in some upstream changes for the server generator
  api.mustache override file that were added in 6.3.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants