Skip to content
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

Merged
merged 10 commits into from
May 10, 2017
Merged

use route_settings for hidden and operations extensions #596

merged 10 commits into from
May 10, 2017

Conversation

thogg4
Copy link
Contributor

@thogg4 thogg4 commented Mar 8, 2017

@LeFnord This pr may be a little heavy handed, but I wanted to show you what I meant by having grape-swagger use the preferred way to pass route settings.

Please let me know what you think and what I can improve and change.

Addresses #594

@LeFnord
Copy link
Member

LeFnord commented Mar 9, 2017

will give it a try and a deeper look on the weekend, ok?

@coveralls
Copy link

coveralls commented Apr 11, 2017

Coverage Status

Coverage increased (+0.01%) to 97.515% when pulling 7c80043 on itransact:use-settings into 46dffa3 on ruby-grape:master.

@thogg4
Copy link
Contributor Author

thogg4 commented May 8, 2017

@LeFnord what do you think about this approach?

@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
s.license = 'MIT'

s.required_ruby_version = '>= 2.2.6'
s.add_runtime_dependency 'grape', '>= 0.16.2'
s.add_runtime_dependency 'grape', '>= 0.19.1'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please revert it back

@@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

am I right, the original behavior still available?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the original behavior is default.

@@ -19,10 +19,11 @@ class ExtensionsApi < Grape::API
{ 'declared_params' => declared(params) }
end

route_setting :x_operation, some: 'stuff'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it, makes the extensions more consistent, thanks

Copy link
Member

@LeFnord LeFnord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please can you add more specs, so one can see the different possibilities to hide an endpoint, thanks

@coveralls
Copy link

coveralls commented May 10, 2017

Coverage Status

Coverage increased (+0.01%) to 97.515% when pulling 6e96fd9 on itransact:use-settings into 3493e3c on ruby-grape:master.

@LeFnord
Copy link
Member

LeFnord commented May 10, 2017

👍 @thogg4 please add the changelog entry, then I'll mörge it

@coveralls
Copy link

coveralls commented May 10, 2017

Coverage Status

Coverage increased (+0.01%) to 97.515% when pulling 4c39b14 on itransact:use-settings into 3493e3c on ruby-grape:master.

@LeFnord LeFnord merged commit b33ff7c into ruby-grape:master May 10, 2017
LeFnord pushed a commit to LeFnord/grape-swagger that referenced this pull request Feb 9, 2019
* use route_settings for hidden and operations extensions
* remove puts statements
* revert grape version
* add some details to the readme
* add route to demonstrate how to hide endpoint with route settings
* correct hide with route setting in readme
* add changelog entry
* remove curly braces for rubocop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants