-
Notifications
You must be signed in to change notification settings - Fork 472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow specifying custom tags at the route level #523
Conversation
edd12e9
to
9340714
Compare
@@ -4,7 +4,7 @@ | |||
|
|||
* [#520](https://github.com/ruby-grape/grape-swagger/pull/520): Response model can have required attributes - [@WojciechKo](https://github.com/WojciechKo). | |||
* [#510](https://github.com/ruby-grape/grape-swagger/pull/510): Use 'token_owner' instead of 'oauth_token' on Swagger UI endpoint authorization. - [@texpert](https://github.com/texpert). | |||
* Your contribution here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please return it after your changelog note
Hello, thank you for your contribution, this is a good feature, can you provide description of this feature in |
thanks @jordanfbrown … @jordanfbrown … please add a section to teh README (don't forget a TOC entry 😉), |
The current logic to determine a route's set of tags is based solely on the route, which works in most cases, but isn't flexible when you want to override the tags. The situation that led me here was the following setup: ``` prefix 'locations/:id' resource :employees do desc 'Retrieve employees for a given location' get '/' do ... end end ``` Which grouped the `/locations/:id/employees` under the `locations` namespace. This was undesirable, because almost all of the endpoints in our API are prefixed with `/locations/:id`, which meant that they were all grouped under the `locations` namespace. Allowing an additional `tags` attribute on the `desc` method solved the issue for me. ``` desc 'Retrieve employees for a given location', tags: ['employees'] ```
9340714
to
f187a52
Compare
@Bugagazavr @LeFnord Feedback addressed, thanks! |
👍 |
The current logic to determine a route's set of tags is based solely on the route, which works in most cases, but isn't flexible when you want to override the tags. The situation that led me here was the following setup: ``` prefix 'locations/:id' resource :employees do desc 'Retrieve employees for a given location' get '/' do ... end end ``` Which grouped the `/locations/:id/employees` under the `locations` namespace. This was undesirable, because almost all of the endpoints in our API are prefixed with `/locations/:id`, which meant that they were all grouped under the `locations` namespace. Allowing an additional `tags` attribute on the `desc` method solved the issue for me. ``` desc 'Retrieve employees for a given location', tags: ['employees'] ```
The current logic to determine a route's set of tags is based solely on the route, which works in most cases, but isn't flexible when you want to override the tags.
The situation that led me here was the following setup:
Which grouped the
/locations/:id/employees
under thelocations
namespace. This was undesirable, because almost all of the endpoints in our API are prefixed with/locations/:id
, which meant that they were all grouped under thelocations
namespace.Allowing an additional
tags
attribute on thedesc
method solved the issue for me.Before:
After:
Is there another way to accomplish this that I missed altogether, or does this seem like a reasonable addition?