-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
explicit kwargs for namespace and route_param #2647
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
base: master
Are you sure you want to change the base?
Conversation
b9c8f54 to
035f3ef
Compare
dblock
left a comment
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.
Fixup spelling in UPGRADING + some questions/rebase please?
| param.to_sym => options[:requirements] | ||
| } if options[:requirements].is_a?(Regexp) | ||
| def route_param(param, requirements: nil, type: nil, **options, &block) | ||
| requirements = { param.to_sym => requirements } if requirements.is_a?(Regexp) |
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.
| requirements = { param.to_sym => requirements } if requirements.is_a?(Regexp) | |
| requirements = { param.to_sym => requirements } if requirements&.is_a?(Regexp) |
Nit, but that avoids calling is_a?(nil)?
|
|
||
| #### Explicit kwargs for `namespace` and `route_param` | ||
|
|
||
| `namespace` and `route_param` are now now defined with a `**options` instead of `options = {}`. In addtion, `requirements` in explicitely defined so its not in `options` anymore. You can still call `requirements` like before but `options[:requirements]` will be empty. For `route_param`, `type` is also an explicit parameter so it's not in `options` anymore. See [#2647](https://github.com/ruby-grape/grape/pull/2647) for more information. |
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.
| `namespace` and `route_param` are now now defined with a `**options` instead of `options = {}`. In addtion, `requirements` in explicitely defined so its not in `options` anymore. You can still call `requirements` like before but `options[:requirements]` will be empty. For `route_param`, `type` is also an explicit parameter so it's not in `options` anymore. See [#2647](https://github.com/ruby-grape/grape/pull/2647) for more information. | |
| The `API#namespace` and `route_param` methods are now defined with `**options` instead of `options = {}`. In addtion, `requirements` in explicitly defined so it's not in `options` anymore. You can still call `requirements` like before but `options[:requirements]` will be empty. For `route_param`, `type` is also an explicit parameter so it's not in `options` anymore. See [#2647](https://github.com/ruby-grape/grape/pull/2647) for more information. |
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.
Is this part of an API change/breaking change?
Does this need a before/after with an example of how to call it?
This PR replaces
options = {}to modern**optionswith explicit optional parametersrequirementsandtype.