-
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
use route_settings for hidden and operations extensions #596
Changes from 3 commits
ea53d8c
4ae1ece
7c80043
c8d688f
2a49465
6e96fd9
2ea0dd0
2f533d4
34f57cf
4c39b14
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -337,7 +337,8 @@ def model_name(name) | |
end | ||
|
||
def hidden?(route, options) | ||
route_hidden = route.options[:hidden] | ||
route_hidden = route.settings.try(:[], :swagger).try(:[], :hidden) | ||
route_hidden = route.options[:hidden] if route.options.key?(:hidden) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. am I right, the original behavior still available? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, the original behavior is default. |
||
return route_hidden unless route_hidden.is_a?(Proc) | ||
options[:token_owner] ? route_hidden.call(send(options[:token_owner].to_sym)) : route_hidden.call | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,10 +19,11 @@ class ExtensionsApi < Grape::API | |
{ 'declared_params' => declared(params) } | ||
end | ||
|
||
route_setting :x_operation, some: 'stuff' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like it, makes the extensions more consistent, thanks |
||
|
||
desc 'This returns something with extension on verb level', | ||
params: Entities::UseResponse.documentation, | ||
failure: [{ code: 400, message: 'NotFound', model: Entities::ApiError }], | ||
x: { some: 'stuff' } | ||
failure: [{ code: 400, message: 'NotFound', model: Entities::ApiError }] | ||
params do | ||
requires :id, type: Integer | ||
end | ||
|
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 revert it back