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

Question: Why are all properties in the OpenAPI specification optional? #318

Closed
muehmar opened this issue Oct 25, 2023 · 4 comments
Closed

Comments

@muehmar
Copy link

muehmar commented Oct 25, 2023

We are using the fake smtp server to perform integration test, i.e. check if certain events in our application actually send emails. To automate this, we use the API of the server to fetch and check the emails. We use a Java generator which creates DTO's from the schema components in the openapi. The generator reflects also the specification of optional/required and nullability. Thus it generates getters with Optional as return value in case the properties are optional which seems to be the case for every property in the specification. Is this intentionally?

I could either check every property before accessing it, if its already there (which could be avoided in case the specification tells which property must exist) or I could just avoid all checks but then I dont know which property is really optional and may be absent. What was the intention here or how should one access the API?

@gessnerfl
Copy link
Owner

@muehmar Not sure why this is the case. The documentation is generated by springdoc-openapi. I need to dig deeper into it.

@gessnerfl
Copy link
Owner

@muehmar the issue should be fixed in version 2.1.5.

@gessnerfl
Copy link
Owner

please reopen the ticket if the issue persists.

@muehmar
Copy link
Author

muehmar commented Dec 30, 2023

I'll have a look, thank you and happy new year :-)

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

2 participants