-
-
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
Optional groups #443
Optional groups #443
Conversation
Might be better to go with `optional_group(element)` than `group(element, required: false)`?
feels a little clearer.
Thanks. I smell too many parameters in Could you please update CHANGELOG, too. |
Agreed about |
Also, this would be a breaking change, but it might be simpler to do: optional :group1 do
requires :field1
end
requires :group2 do
requires :field2
end That is, instead of having methods |
You can probably introduce There's a merge conflict, could you merge from upstream please. |
@@ -3,6 +3,7 @@ Next Release | |||
#### Features | |||
|
|||
* Grape is no longer tested against Ruby 1.8.7. | |||
* [#443](https://github.com/intridea/grape/pull/443): Added `optional_group` to ParamsScope to let users validate the internal structure of a group without requiring its presence. - [@asross](https://github.com/asross). |
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.
There's an extra period before your name - [ ...
:)
Aside of that HUGE deal (j/k), maybe something simpler as a one-liner, like the fact that you added optional_group
that does X?
Given your last comment I wonder whether |
Yeah, I'm thinking similarly, although I don't think you should be able to call |
…ptional to take blocks
What do you think of that change? The only thing I feel leery about is how to handle extra arguments to |
Love it. I am going to let it maroon here for a day or so and will merge unless I hear objections from other people. |
I merged this, thank you so much. Good work. |
Thanks! Glad to be of help. |
Thanks for this! |
See issue #319.