-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
XML Comments make property invisible in swagger UI example json #2656
Comments
We experience the same problem in our nested DTOs
Results into the following:
Both the custom sample and the one with just a descriptive name for the field generate as one-off. |
I think swagger ui cannot resolve the oneof reference, so maybe you need to set AllowReferencesWithProperties to true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
Using NSwag.AspNetCore 13.2.2, given an API controller that returns the following response model
Will generate the following schema in the Open API doc
This renders fine in the Swagger UI. Specifically, the response example JSON includes the
loveInterest
property.However, if I change the model to include an XML comment on the LoveInterest property:
Then the Open API doc includes this schema
And in this case, the Swagger UI will not render the
loveInterest
property in the response example JSON. This means, given a very basic model, adding an XML comment causes the property to be invisible in the Swagger UI examples.To Summarize:
Works as expected
When the schema is generated as
Property is missing from example
when the schema is generated as
This seems similar to #2071, in which case it was the presense of the
nullable
attribute which triggered the generation ofoneOf
, however, it seems other attributes (in this casedescription
) will also change from a simple$ref
tooneOf
This seems quite problematic. If Swagger UI has issues with
oneOf
, is there a way it can be avoided in this scenario?The text was updated successfully, but these errors were encountered: