Add default response for all the endpoints with Microsoft.AspNetCore.OpenApi #59304
Unanswered
marcominerva
asked this question in
Q&A
Replies: 1 comment 9 replies
-
I'm not aware of a way to push an entirely new schema into the document as-is. Maybe if you defined the schema inline (not as reference, because it will be pointing at something not defined) the later bits of the pipeline will notice it's re-used in multiple places and hoist it up to be a schema reference for you? If that doesn't work, wrap all the operations in a group and define the default error like with |
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
I would like to add a default Error response for all the endpoints of my Minimal API:
So, I have created the following Operation Transformer:
This works only if I have at least one endpoint that produces a
Problem
response, so that theProblemDetails
schema is inserted in OpenAPI definition:To avoid this requirement, with Swashbuckle I had defined a document filter to automatically add the corresponding schema:
But this is no longer possible with Microsoft.AspNetCore.OpenApi. So, in this case what is the correct solution?
Beta Was this translation helpful? Give feedback.
All reactions