@@ -18,7 +18,6 @@ def initialize(route, _params, _settings, _endpoint)
18
18
def parse
19
19
stackable_values = route . app &.inheritable_setting &.namespace_stackable
20
20
21
- get_path_params ( stackable_values )
22
21
path_params = build_path_params ( stackable_values )
23
22
24
23
fulfill_params ( path_params )
@@ -54,29 +53,13 @@ def fulfill_params(path_params)
54
53
# The route.params hash includes both parametrized params (with a string as a key)
55
54
# and well-defined params from body/query (with a symbol as a key).
56
55
# We avoid overriding well-defined params with parametrized ones.
57
- next if param . is_a? ( String ) && accum . key? ( param . to_sym )
56
+ key = param . is_a? ( String ) ? param . to_sym : param
57
+ next if param . is_a? ( String ) && accum . key? ( key )
58
58
59
- value = ( path_params [ param ] || { } ) . merge (
60
- definition . is_a? ( Hash ) ? definition : { }
61
- )
62
-
63
- accum [ param . to_sym ] = value . empty? ? DEFAULT_PARAM_TYPE : value
64
- end
65
- end
66
-
67
- # Iterates over namespaces recursively
68
- # to build a hash of path params with options, including type
69
- def get_path_params ( stackable_values )
70
- params = { }
71
- return param unless stackable_values
72
- return params unless stackable_values . is_a? Grape ::Util ::StackableValues
73
-
74
- stackable_values &.new_values &.dig ( :namespace ) &.each do |namespace | # rubocop:disable Style/SafeNavigationChainLength
75
- space = namespace . space . to_s . gsub ( ':' , '' )
76
- params [ space ] = namespace . options || { }
59
+ defined_options = definition . is_a? ( Hash ) ? definition : { }
60
+ value = ( path_params [ param ] || { } ) . merge ( defined_options )
61
+ accum [ key ] = value . empty? ? DEFAULT_PARAM_TYPE : value
77
62
end
78
- inherited_params = get_path_params ( stackable_values . inherited_values )
79
- inherited_params . merge ( params )
80
63
end
81
64
end
82
65
end
0 commit comments