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(#2195): Fix declared method for hash params with overlapping names #2372

Merged
merged 1 commit into from
Nov 17, 2023

Conversation

jcagarcia
Copy link
Contributor

Hi 👋

I was taking a look to the issue #2195 .

Seems the error is because the logic inside the handle_passed_param method is using the start_with?(key) method. So, if we have two params like :empty_hash and :empty_hash_two, as both of them share part of the key, it detects that the :empty_hash parameter has children, and it behaves in a different way and it ends returning a nil value.

For solving it, I'm checking that for having children the key of the children should start with the same key name + a [. Maybe not the better solution for checking this 🤔 so open to discussion.

@dblock dblock merged commit 5c237e3 into ruby-grape:master Nov 17, 2023
31 checks passed
@dblock
Copy link
Member

dblock commented Nov 17, 2023

This is simple and all specs pass, so let's go for it.

@jcagarcia jcagarcia deleted the issue-2195 branch November 17, 2023 22:40
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