grape icon indicating copy to clipboard operation
grape copied to clipboard

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

Open seriousdev-gh opened this issue 2 years ago • 2 comments

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

seriousdev-gh avatar Aug 22 '23 16:08 seriousdev-gh

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

dblock avatar Aug 24 '23 13:08 dblock