Search code examples
openapiswagger-2.0

Swagger / Open API 2.0 can I declare a common response header?


Is it possible to declare a custom response header which would be present in all responses without copying it in each of the response structure?


Solution

  • According to section 2.3 Response’s headers of Writing OpenAPI (Swagger) Specification Tutorial – Part 5 – Advanced Input And Output Modeling the answer is no. Which is what I understand from the 2.0 spec too.

    Vote/comment on Structural improvements: enhance headers handling · Issue #690 · OAI/OpenAPI-Specification.