Skip to content

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

Closed
@seriousdev-gh

Description

@seriousdev-gh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions