Are there plans to add support for global responses? #5006
Replies: 2 comments
-
There are no plans to support this in the 3.x specification series, but it's a fairly common use case. The Overlay standard supports this pattern pretty well, and I'd recommend you look at that for a solution. |
Beta Was this translation helpful? Give feedback.
-
I believe this came up as a moonwalk discussion -- the idea of having global responses for various response codes like 500, 503 which would apply to all endpoints in the document unless they were overridden at a specific operation level, much as we have a global As it is a new concept that doesn't change existing parts of the document, it could conceivably be added in a 3.x release. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
It would be helpful if OpenAPI specification allowed me to specify certain responses that will be returned for every endpoint in the specification, rather than having to document every response on every endpoint. (Although I would imagine people might want to apply those default responses to some sort of pattern matching, either by path or tag or other...)
For instance, if my API requires authentication on every endpoint, applies rate limiting to every endpoint, and can return a
500 Internal Server Error
for every endpoint, then it would be nice to define a default set of responses for 401, 403, 429 and 500. Those responses would also include e.g. rate limit headers.When following a design-first approach, this would significantly reduce the amount of copy-pasting of response references, reduce the chance of making errors, and reduce size of a fully-documented OpenAPI specification, which then decreases the resources required to process one when generating client-side docs.
Beta Was this translation helpful? Give feedback.
All reactions