Skip to content

Allows to set a global ParamBuilder - #1833

Merged
dblock merged 15 commits into
masterfrom
issue-1775
Dec 10, 2018
Merged

Allows to set a global ParamBuilder#1833
dblock merged 15 commits into
masterfrom
issue-1775

Conversation

@myxoh

@myxoh myxoh commented Dec 5, 2018

Copy link
Copy Markdown
Member

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

Comment thread CHANGELOG.md Outdated
@dblock

dblock commented Dec 6, 2018

Copy link
Copy Markdown
Member

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.

@myxoh

myxoh commented Dec 6, 2018

Copy link
Copy Markdown
Member Author

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 👍
I'll do so between later today, and early tomorrow.
Other than that, any point you want to add?

@dblock

dblock commented Dec 6, 2018

Copy link
Copy Markdown
Member

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!

@myxoh

myxoh commented Dec 7, 2018

Copy link
Copy Markdown
Member Author

@dblock I've made those changes

@myxoh myxoh mentioned this pull request Dec 7, 2018

@dblock dblock left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See notes.

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread spec/grape/request_spec.rb
Comment thread spec/grape/config_spec.rb Outdated

@dblock dblock left a comment

Copy link
Copy Markdown
Member

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).

Comment thread README.md Outdated

## Configuration

Grape counts with a module `Grape.configure` for some basic configuration at load time.

Copy link
Copy Markdown
Member

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.

Comment thread README.md Outdated
end
```

Or globally with the [Configuration](#configuration) `Grape.configure.param_builder`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Missing a period.

Comment thread 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`

Copy link
Copy Markdown
Member

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

@dblock

dblock commented Dec 10, 2018

Copy link
Copy Markdown
Member

We do need a green CI. Didn't look at failures.

@myxoh

myxoh commented Dec 10, 2018

Copy link
Copy Markdown
Member Author

There seems to be an independent failure on the Gem dependencies. I'll try to address it on a separate PR

@myxoh

myxoh commented Dec 10, 2018

Copy link
Copy Markdown
Member Author

Opened issue for this: #1839 It seems to be related with coveralls which is no longer maintained

@dblock
dblock merged commit 766cdb5 into master Dec 10, 2018
@dblock

dblock commented Dec 10, 2018

Copy link
Copy Markdown
Member

👍

basjanssen pushed a commit to basjanssen/grape that referenced this pull request Feb 28, 2020
@ericproulx
ericproulx deleted the issue-1775 branch July 23, 2026 01:33
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