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

Parameter renaming doesn't work for hash inside given block. #2347

Closed
seriousdev-gh opened this issue Aug 22, 2023 · 3 comments
Closed

Parameter renaming doesn't work for hash inside given block. #2347

seriousdev-gh opened this issue Aug 22, 2023 · 3 comments
Labels

Comments

@seriousdev-gh
Copy link

seriousdev-gh commented Aug 22, 2023

Hello.
Parameter renaming doesn't work if there is a hash inside given.

Params:

          requires :a, type: Hash do
            optional :c, type: String
            given :c do
              requires :b, type: Hash do
                requires :input_field, as: :output_field
              end
            end
          end

Input:

{ a: { b: { input_field: 'value' }, c: 'value2' } }

After running declared(params, evaluate_given: true):

Expected:

{ a: { b: { output_field: 'value' }, c: 'value2' } }

Actual:
Parameter input_field is not renamed to output_field.

{ a: { b: { input_field: 'value' }, c: 'value2' } }

Info: grape version 1.7.1, ruby 3.0.2

@dblock
Copy link
Member

dblock commented Aug 24, 2023

Try turning this into a spec, let's see that it's still the case in the next 1.8?

@seriousdev-gh
Copy link
Author

Added spec. Still the case in the latest main branch.

@dblock
Copy link
Member

dblock commented Jul 7, 2024

This was fixed in #2469, please check it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants