Skip to content
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

OpenApi Generator return empty collection instead of null for collection types #3362

Open
hamidonos opened this issue Aug 14, 2024 · 0 comments

Comments

@hamidonos
Copy link
Collaborator

hamidonos commented Aug 14, 2024

Situation

Currently the generator will generate methods which will return null for collection types that are @Nullable. This is not very handy since it forces you to create the collection first instead of using it right away.

I think that null collections are not necessary. Absence of value is simply an empty list (which is much safer and easier to work with down the road)

Solution

  • Configure the open api generator in a way that it creates empty collections for nullable collection types.
  • Remove any unnecessary null checks and collection initializations currently used in other classes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant