lib/grape/dsl/inside_route.rb in grape-1.0.0 vs lib/grape/dsl/inside_route.rb in grape-1.0.1

- old
+ new

@@ -48,11 +48,19 @@ def declared_hash(passed_params, options, declared_params) declared_params.each_with_object(passed_params.class.new) do |declared_param, memo| # If it is not a Hash then it does not have children. # Find its value or set it to nil. if !declared_param.is_a?(Hash) - next unless options[:include_missing] || passed_params.key?(declared_param) - memo[optioned_param_key(declared_param, options)] = passed_params[declared_param] + has_alias = route_setting(:aliased_params) && route_setting(:aliased_params).find { |current| current[declared_param] } + param_alias = has_alias[declared_param] if has_alias + + next unless options[:include_missing] || passed_params.key?(declared_param) || param_alias + + if param_alias + memo[optioned_param_key(param_alias, options)] = passed_params[param_alias] + else + memo[optioned_param_key(declared_param, options)] = passed_params[declared_param] + end else declared_param.each_pair do |declared_parent_param, declared_children_params| next unless options[:include_missing] || passed_params.key?(declared_parent_param) passed_children_params = passed_params[declared_parent_param] || passed_params.class.new