-
Notifications
You must be signed in to change notification settings - Fork 10.4k
OpenAPI Vs Swashbuckle #56711
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
Comments
Requiredness and nullability are two orthogonal concepts. Required means you have to set it. Nullable means it can be set to the value
|
Thanks for chiming in @KennethHoff! Your response around required vs. nullable is correct. With regard to the other comment:
There's a bit of subtlety to reason through with this one. The "correct" way to model this in OpenAPI is using the I'm gonna mark this issue as "resolved" for now given we're tracking the feedback presented here elsewhere. If you have any other questions, feel free to comment before the bot autoresolves or open another issue. |
I think this situation should be mutually exclusive, not usable. From the perspective of user expectations, since it is mandatory, it should not be set to be null.So the attribute display in Swashbuck is more in line with expectations, |
Specified but null is useful for scenarios such as an HTTP PATCH where you want to explicitly clear a value of an object, where as not providing the property at all would mean "don't edit it at all, leave it with whatever value it may already have". |
This issue has been resolved and has not had any activity for 1 day. It will be closed for housekeeping purposes. See our Issue Management Policies for more information. |
Is there an existing issue for this?
Describe the bug
OpenAPI
Swashbuckle
@captainsafia
TemperatureF
has no method set, and should not appear in the modelTemperatureC2
is a nullable attribute, but it adds a required attribute and should no longer appear nullableExpected Behavior
No response
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: