Skip to content
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

Modify declared for nested array and hash #2043

Merged

Conversation

kadotami
Copy link
Contributor

I fixed bugs of declared method.

key of options[:route_options][:params] is not considered for nested params.

I changed to these.

  • if nested array is nil, declared method return [].
  • if nested hash is nil, declared method return {}.

@kadotami kadotami changed the title Modify declared for nested array and hash #2042 Modify declared for nested array and hash Apr 27, 2020
@kadotami kadotami force-pushed the fix_declared_for_nested_array_and_hash branch 3 times, most recently from c55af12 to 8cbec94 Compare April 27, 2020 06:08
@@ -422,6 +425,7 @@ def app
get '/declared?first=present'
expect(last_response.status).to eq(200)
expect(JSON.parse(last_response.body)['nested']).to be_a(Hash)
expect(JSON.parse(last_response.body)['nested']).to eq({})
Copy link
Member

Choose a reason for hiding this comment

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

what do you think about parsing the response only once?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry! I'll modify soon.

@kadotami kadotami force-pushed the fix_declared_for_nested_array_and_hash branch from 8cbec94 to 00162f5 Compare April 27, 2020 06:39
@kadotami kadotami force-pushed the fix_declared_for_nested_array_and_hash branch from 00162f5 to 3551c67 Compare April 27, 2020 08:29
@dblock dblock merged commit 785d28a into ruby-grape:master Apr 27, 2020
@dblock
Copy link
Member

dblock commented Apr 27, 2020

👍

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