From c71ff3542fcc5019240b7cdc2e6a1157d1fdd201 Mon Sep 17 00:00:00 2001 From: Darshan Date: Sun, 27 Jul 2025 19:19:14 +0530 Subject: [PATCH] fix: deprecation inheritance on other methods with different namespace. --- src/Appwrite/SDK/Specification/Format/OpenAPI3.php | 8 ++++++++ src/Appwrite/SDK/Specification/Format/Swagger2.php | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index a9991d7b03..98c33b8ae0 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -223,6 +223,14 @@ class OpenAPI3 extends Format 'description' => ($desc) ? \file_get_contents($desc) : '', ]; + // add deprecation only if method has it! + if ($methodObj->getDeprecated() instanceof Deprecated) { + $additionalMethod['deprecated'] = [ + 'since' => $methodObj->getDeprecated()->getSince(), + 'replaceWith' => $methodObj->getDeprecated()->getReplaceWith(), + ]; + } + // If additional method has no parameters, inherit from route if (empty($methodObj->getParameters())) { foreach ($route->getParams() as $name => $param) { diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index 305a10b34b..96f7b96f06 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -232,6 +232,14 @@ class Swagger2 extends Format 'description' => ($desc) ? \file_get_contents($desc) : '', ]; + // add deprecation only if method has it! + if ($methodObj->getDeprecated() instanceof Deprecated) { + $additionalMethod['deprecated'] = [ + 'since' => $methodObj->getDeprecated()->getSince(), + 'replaceWith' => $methodObj->getDeprecated()->getReplaceWith(), + ]; + } + // If additional method has no parameters, inherit from route if (empty($methodObj->getParameters())) { foreach ($route->getParams() as $name => $param) {