-
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
Add support for grape version cascading #535
Conversation
@@ -223,7 +223,7 @@ def apply_success_codes(route) | |||
end | |||
|
|||
def tag_object(route) | |||
Array(route.path.split('{')[0].split('/').reject(&:empty?).delete_if { |i| ((i == route.prefix.to_s) || (i == route.version)) }.first) | |||
Array(route.path.split('{')[0].split('/').reject(&:empty?).delete_if { |i| ((i == route.prefix.to_s) || (i == route.version.to_s) || (route.version.is_a?(Array) && route.version.map(&:to_s).include?(i))) }.first) |
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.
think its time to refactor 😉
btw it would make rubucop happy
end | ||
end | ||
|
||
class TagApi < Grape::API | ||
prefix :api | ||
mount TheApi::CascadingVersionApi | ||
mount TheApi::NamespaceApi | ||
add_swagger_documentation version: 'v1' |
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 remove version
, or use doc_version
instead
thanks @qinix for contribution, please my comments above |
updated @LeFnord |
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 fix it
I am very interested in that one. What the status? Should the tests still be breaking? Just running on the branch @qinix provided, works so far, yet I miss the opportunity to cascade different versions from one documentation to another. |
@Overbryd The tests breaks for grape lower than 0.16. If you are using 0.16 or bigger, it will work for you. There is some strange behavior in low version of grape, I'm not willing to fix it now since I'm not using such old version. I'm using it in production now, you can trust it. |
@qinix it is understandable, but it would be nice to communicate it … the PR is very welcome actual I'm preparing ruby 2.4 support, for that I dropped grape support < 0.16.0 |
@LeFnord sorry for my poor english... Okay I will try to re-target it against that. |
@qinix no problem most people in the world are no native english speaker and thanks again |
is included here: https://github.com/LeFnord/grape-swagger/tree/prepare_for_ruby_2.4 |
Support API endpoints like so:
Use the first value in the array as the version component in url.
related issue: #146