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

fix include_missing for nested hash #816

Merged
merged 4 commits into from
Nov 21, 2014

Conversation

georgimitev
Copy link
Contributor

include_missing seems to work only when you have params like that:

params do
  requires :first_name, type: String, desc: 'First name'
  requires :last_name, type: String, desc: 'Last name'
end

and it does not filter nils If you have nested params like that:

params do
  requires :user, :type => Hash do
    requires :first_name, type: String
    requires :last_name, type: String
    requires :address, :type => Hash do
      requires :city, type: String
    end
  end
end

This pr is fixing this issue. Once you are ok with the current pr (structure, code), will do the necessary changes to the changelog.

@dblock
Copy link
Member

dblock commented Nov 18, 2014

This makes sense. We actually don't seem to document include_missing at all. Would you mind also update this in the README?

@georgimitev
Copy link
Contributor Author

@dblock i've updated the README and CHANGELOG, I've also added a section about declared(params) since i couldn't find one. Let me know if anything else is required.

@dblock
Copy link
Member

dblock commented Nov 21, 2014

This is great, merging.

dblock added a commit that referenced this pull request Nov 21, 2014
@dblock dblock merged commit 15fd71e into ruby-grape:master Nov 21, 2014
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.

2 participants