We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6c1badb commit 77212bbCopy full SHA for 77212bb
1 file changed
lib/openapi_first/router.rb
@@ -101,11 +101,11 @@ def find_path_item(request_path)
101
params = path_item[:template].match(request_path)
102
next unless params
103
104
- [path_item, params, params.values.sum(&:length)]
+ [path_item, params]
105
end
106
+ return matches.first if matches.length == 1
107
- matches&.min_by { |_path_item, _params, length| length }
108
- &.then { |path_item, params, _length| [path_item, params] }
+ matches&.min_by { |match| match[1].values.sum(&:length) }
109
110
111
0 commit comments