diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index 962bc8948a..b47d716737 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -755,7 +755,16 @@ class OpenAPI3 extends Format $node['schema']['default'] = $param['default']; } - if (false !== \strpos($url, ':' . $name)) { // Param is in URL path + $pathAliases = [$name, ...($param['aliases'] ?? [])]; + $isPathParam = false; + foreach ($pathAliases as $pathAlias) { + if (false !== \strpos($url, ':' . $pathAlias)) { + $isPathParam = true; + break; + } + } + + if ($isPathParam) { // Param is in URL path (directly or through alias) $node['in'] = 'path'; $temp['parameters'][] = $node; } elseif ($route->getMethod() == 'GET') { // Param is in query @@ -796,7 +805,9 @@ class OpenAPI3 extends Format } } - $url = \str_replace(':' . $name, '{' . $name . '}', $url); + foreach ($pathAliases as $pathAlias) { + $url = \str_replace(':' . $pathAlias, '{' . $name . '}', $url); + } } if (!empty($bodyRequired)) { diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index d07d957577..61fa2919c9 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -722,7 +722,16 @@ class Swagger2 extends Format $node['default'] = $param['default']; } - if (\str_contains($url, ':' . $name)) { // Param is in URL path + $pathAliases = [$name, ...($param['aliases'] ?? [])]; + $isPathParam = false; + foreach ($pathAliases as $pathAlias) { + if (\str_contains($url, ':' . $pathAlias)) { + $isPathParam = true; + break; + } + } + + if ($isPathParam) { // Param is in URL path (directly or through alias) $node['in'] = 'path'; $temp['parameters'][] = $node; } elseif ($route->getMethod() == 'GET') { // Param is in query @@ -767,7 +776,9 @@ class Swagger2 extends Format } } - $url = \str_replace(':' . $name, '{' . $name . '}', $url); + foreach ($pathAliases as $pathAlias) { + $url = \str_replace(':' . $pathAlias, '{' . $name . '}', $url); + } } if (!empty($bodyRequired)) {