You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just started playing around with this library today, so I may be missing something, but is this attribute compatible with IEnumerable?
If I set it to something like this, in the UI it correctly shows the model/schema: [SwaggerResponse(System.Net.HttpStatusCode.BadRequest, "Validation Failed", typeof(ValidationResult))]
However, if I try to say it's an enumeration of some kind, the UI shows nothing for the response model: [SwaggerResponse(System.Net.HttpStatusCode.BadRequest, "Validation Failed", typeof(ValidationResult[]))] [SwaggerResponse(System.Net.HttpStatusCode.BadRequest, "Validation Failed", typeof(List<ValidationResult>))] [SwaggerResponse(System.Net.HttpStatusCode.BadRequest, "Validation Failed", typeof(IEnumerable<ValidationResult>))]
If I set the ResponseType to the same enumerable, the "Response Class (Status 200)" section at the top does populate correctly. I tried to fork the project to determine if these two sections were following different logic, but I couldn't really tell either way.
The project looks great! And I saw the thread about questioning whether to include this SwaggerResponse attribute, and I think it was a good choice adding it in! Thanks!
edit
Looking at the data that is getting sent to the browser, it does appear everything is getting setup correctly:
There must just be an issue on the display side
The text was updated successfully, but these errors were encountered:
I believe this is actually an issue with the swagger-ui as opposed to SB itself.
First and foremost, SB is a Swagger JSON generator. For convenience though, it does include an embedded version of swagger-ui, which consumes the generated JSON, so that you can seamlessly provide a rich documentation UI with a one-line Nuget install.
Can you view the raw JSON directly (browse to swagger/docs/v1) and check if the responses are being added correctly?. I suspect this to be the case but it would be great if you can confirm.
This means that SB is doing it's job correctly. However, I've noticed the support in swagger-ui for error model descriptions is somewhat limited and I think this may be what you're experiencing. If this is the case, then the swagger-ui repo may be a better place to find some answers or post an issue:)
I just started playing around with this library today, so I may be missing something, but is this attribute compatible with IEnumerable?
If I set it to something like this, in the UI it correctly shows the model/schema:
[SwaggerResponse(System.Net.HttpStatusCode.BadRequest, "Validation Failed", typeof(ValidationResult))]
However, if I try to say it's an enumeration of some kind, the UI shows nothing for the response model:
[SwaggerResponse(System.Net.HttpStatusCode.BadRequest, "Validation Failed", typeof(ValidationResult[]))]
[SwaggerResponse(System.Net.HttpStatusCode.BadRequest, "Validation Failed", typeof(List<ValidationResult>))]
[SwaggerResponse(System.Net.HttpStatusCode.BadRequest, "Validation Failed", typeof(IEnumerable<ValidationResult>))]
If I set the
ResponseType
to the same enumerable, the "Response Class (Status 200)" section at the top does populate correctly. I tried to fork the project to determine if these two sections were following different logic, but I couldn't really tell either way.The project looks great! And I saw the thread about questioning whether to include this SwaggerResponse attribute, and I think it was a good choice adding it in! Thanks!
edit
Looking at the data that is getting sent to the browser, it does appear everything is getting setup correctly:
There must just be an issue on the display side
The text was updated successfully, but these errors were encountered: