-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Allows to set a global ParamBuilder #1833
Conversation
If we want to add global configuration to Grape lets adopt the Ruby-esque standard like all the other gems. I should be able to do Grape.configure do |config|
config.x =
end Take a look at https://github.com/dblock/strava-ruby-client/blob/master/lib/strava/api/config.rb for an example. |
Not particularly a fan of it (which is why it wasn't my first choice), but should be fairly easy to implement, and I see your point 👍 |
Ruby is lovely because it's often convention over configuration, and predictable imperfect way of doing things consistently. Long live Ruby :) Code looks good otherwise so far. I'll re-review thoroughly when you have the config stuff sorted out. Thanks! |
@dblock I've made those changes |
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.
See notes.
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.
Looks good. I made some minor suggestions for language in README. Feel free to make/not make them and merge (I would squash since the change ended up being quite minimal).
README.md
Outdated
@@ -541,6 +542,29 @@ end | |||
|
|||
[grape-swagger]: https://github.com/ruby-grape/grape-swagger | |||
|
|||
## Configuration | |||
|
|||
Grape counts with a module `Grape.configure` for some basic configuration at load time. |
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.
Counts is probably the wrong word. I tend to keep this as short as possible. For example:
Use Grape.configure
to setup global settings at load time.
README.md
Outdated
@@ -618,6 +642,8 @@ params do | |||
end | |||
``` | |||
|
|||
Or globally with the [Configuration](#configuration) `Grape.configure.param_builder` |
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.
Missing a period.
README.md
Outdated
Grape counts with a module `Grape.configure` for some basic configuration at load time. | ||
Currently the configurable settings are: | ||
|
||
* `param_builder`: Sets the default [Parameter Builder](#parameters), by default: `Grape::Extensions::ActiveSupport::HashWithIndifferentAccess::ParamBuilder` |
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.
Sets the Parameter Builder, defaults to Grape::Extensions::ActiveSupport::HashWithIndifferentAccess::ParamBuilder
We do need a green CI. Didn't look at failures. |
There seems to be an independent failure on the Gem dependencies. I'll try to address it on a separate PR |
Opened issue for this: #1839 It seems to be related with coveralls which is no longer maintained |
👍 |
This is related to the issue: #1775
Creates a new module for global configuration (I checked the documentation and couldn't find one available), and added the setting for a global param builder