Skip to content

Conversation

newtork
Copy link
Contributor

@newtork newtork commented Aug 20, 2024

Currently we generate @Nonnull for all accessors in POJO model classes.

This change considers the nullable: true setting definable in specs.

Consider property foo of model Bar is...

nullable:true and required:true
  • Bar foo( @Nullable foo )
  • Builder foo( @Nullable foo )
  • Bar setFoo( @Nullable foo )
  • @Nullable getFoo()
nullable:false and required:true
  • Bar foo( @Nonnull foo )
  • Builder foo( @Nonnull foo )
  • Bar setFoo( @Nonnull foo )
  • @Nonnull getFoo()
nullable:true and required:false
  • Bar foo( @Nullable foo )
  • Bar setFoo( @Nullable foo )
  • @Nullable getFoo()
nullable:false and required:false
  • Bar foo( @Nullable foo )
  • Bar setFoo( @Nullable foo )
  • @Nonnull getFoo()

I also fixed a minor whitespace issue: For easier review, please hide whitespace changes.

@newtork newtork changed the title [OpenAPI] Fix @Nullable properties [OpenAPI] Fix @Nullable property accessors Aug 20, 2024
@newtork newtork added please merge Request to merge a pull request please review Request to review a pull request labels Aug 20, 2024
@newtork newtork changed the title [OpenAPI] Fix @Nullable property accessors [OpenAPI Generator] Fix @Nullable property accessors Aug 20, 2024
@newtork newtork merged commit 202b2db into main Aug 22, 2024
14 checks passed
@newtork newtork deleted the openapi/fix-nullable-properties branch August 22, 2024 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
please merge Request to merge a pull request please review Request to review a pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants