-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
[Java] add nullable annotation to pojo template for non-required fields #3409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -129,6 +129,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela | |||
{{/maximum}} | |||
* @return {{name}} | |||
**/ | |||
{{^required}} @javax.annotation.Nullable {{/required}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kassim thanks for the PR. Can you use the following instead to avoid blank lines or trailing spaces?
{{^required}}
@javax.annotation.Nullable
{{/required}}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do it in another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed #3453
@kassim thanks for the PR, which has been included in the 4.1.0 release: https://twitter.com/oas_generator/status/1160000504455319553 |
cheers 🍺 glad to have contributed to the project |
Is there a way to switch this off when using openapi-generator-maven-plugin?
|
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
,./bin/openapi3/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
. If contributing template-only or documentation-only changes which will change sample output, be sure to build the project first.master
,4.1.x
,5.0.x
. Default:master
.@bbdouglas
@sreeshas
@jfiala
@lukoyanov
@cbornet
@jeff9finger
@karismann
@Zomzog
Description of the PR
fixes #3264
adds
@javax.annotation.Nullable
to non-required fields, to enhance IDE feedback and Kotlin-interopthis requires the
com.google.code.findbugs:jsr305:3.0.2
dependency for the annotation - I'm not sure where I should adjust thesample dependencies (I adjusted the pom.xml / build.gradle in the sample but the integration test still fails)documentation to inform people thisexisting tests are working fine, I don't think additional ones are necessary