-
Notifications
You must be signed in to change notification settings - Fork 476
Allow passing of Array with brackets (eg. Array[String], Array[Integer]) #455
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6a36f3d
Allow arrays of primitive types in Grape parameter declaration
TySpring 801cb6c
Adjust rubocop class line length
TySpring 3d9e26b
Add test to ensure array of primitives works with formData
TySpring 6e69111
Add usage of array of primitive types to documentation
TySpring 4dfbe72
Update changelog
TySpring ba265dd
remove require pry
TySpring 33e5e29
Address PR comments
TySpring 747d523
Address comments: clean up code style in parse_params.rb
TySpring 00cce26
(Attempt to) address PR comments: make `param_type_is_array?` more ex…
TySpring 52ad06c
Refactor parse_params to remove the extra brackets
TySpring File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
You're parsing this twice, perpetuating the mess we have here and adding to it :) Refactor
param_type_is_array
intoparse_param_type
or something like that and return the array key. Nuke the wholepossible_key = param.first.to_s.gsub('[', '[][')
as well as part of that.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.
@dblock … the whole
('[', '[][')
junk could be removed by avoiding the introducing of it here endpoint.rb#L224I had to make a decision, should the name of the parameter indicating if it is a Hash, Array or not, this solution following the rails naming convention for form data
questions is, is it really needed … think removing it, could made many things easier
Uh oh!
There was an error while loading. Please reload this page.
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.
so @LeFnord are you suggesting that the output for nested Arrays in formData would look like
address[line1]
as opposed toaddress[][line1]
?Also @dblock are you saying you want me to remove the method
param_type_is_array?
altogether, and move the logic intoparse_param_type
? This seems contradictory to your comment here: #455 (comment).@LeFnord @dblock Is your general goal just to "clean up the parsing code" without changing logic? Or is it actually to change the output of this parsing logic to remove the added
[]
for array types?