Open Zambiorix opened 3 years ago
I think a better idea is to use an @template annotation and include that template in your route/controler definition.
Do you think you contribute with a PR for this issue?
I have a similar usecase for such as feature, either middleware-focused, or template focused (or perhaps some sort of global response template)
Right now I have to define the following in all routes, which are actually specific to a middleware
// @Failure 429 {string} string "Limit exceeded"
// @Header 429 {integer} X-Ratelimit-Limit
// @Header 429 {integer} X-Ratelimit-Remaining
// @Header 429 {integer} X-Ratelimit-Reset
Is your feature request related to a problem? Please describe.
I am using Swag with Echo and I've implemented several middleware, like authorization, rate limit, logging and lots more. These middleware sometimes use header and/or parameter information and can produce failures.
Now when I describe a route I have to remember to include all the possible information from the used middlewares. That is prone to errors, if I forget something or if the middleware is updated...
Unless I am mistaken, there is no way of merging middleware information with routes.. I would love to see a solution that solves this problem
Describe the solution you'd like
Maybe include 2 new tags:
For middleware description:
For route description:
So that information from the middleware is merged with the route information
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context Add any other context or screenshots about the feature request here.
Thanks!