Include known error responses in OpenAPI metadata/generated OpenAPI doc #58719
Labels
area-minimal
Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
area-mvc
Includes: MVC, Actions and Controllers, Localization, CORS, most templates
feature-openapi
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
There are some cases where the framework / middleware pipeline can generate error responses, such as when the endpoint defines a required parameter -- if the parameter is not present in the request, the framework generates a status code 400 response. And if the ProblemDetails service was added to the DI container, it is used to generate a ProblemDetails response body for this.
However, these responses are not represented in the generated OpenAPI document.
Describe the solution you'd like
For the case indicated, and perhaps others, these responses should be included in the generated OpenAPI document. However, I think we'll want to be careful about this -- for example I'm not sure we should add 401 and 403 responses for operations that require authentication.
Additional context
No response
The text was updated successfully, but these errors were encountered: