@@ -310,6 +310,7 @@ private static function fetch($schema, ...$paths)
310310
311311 /**
312312 * A list of parameters that are applicable for this operation.
313+ *
313314 * If a parameter is already defined at the Path Item,
314315 * the new definition will override it, but can never remove it.
315316 *
@@ -323,10 +324,34 @@ private function getRequestParameters($template, $method, $location)
323324 {
324325 $ path = $ this ->fetch ($ this ->schema , 'paths ' , $ template );
325326
326- $ parameters = $ this ->fetch ($ path , $ method , 'parameters ' ) ?: $ this ->fetch ($ path , 'parameters ' );
327+ $ operationParameters = $ this ->normalizeRequestParameters (
328+ (array ) $ this ->fetch ($ path , $ method , 'parameters ' ),
329+ $ location
330+ );
331+
332+ $ pathParameters = $ this ->normalizeRequestParameters (
333+ (array ) $ this ->fetch ($ path , 'parameters ' ),
334+ $ location
335+ );
336+
337+ return $ operationParameters + $ pathParameters ;
338+ }
339+
340+ /**
341+ * Normalizes parameters definitions.
342+ *
343+ * Filter parameters by location, and use name as list index.
344+ *
345+ * @param array $parameters
346+ * @param string $location
347+ *
348+ * @return object[]
349+ */
350+ private function normalizeRequestParameters (array $ parameters , $ location )
351+ {
327352 $ schemas = [];
328353
329- foreach (( array ) $ parameters as $ parameter ) {
354+ foreach ($ parameters as $ parameter ) {
330355 if ($ parameter ->in !== $ location ) {
331356 continue ;
332357 }
0 commit comments