From 5c5bdac3d96ecca2026d958f0d989e7e24e14b44 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 13 Oct 2022 12:58:28 +1300 Subject: [PATCH] Add route blacklist instead of individual cases --- src/Appwrite/GraphQL/Types/Mapper.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Appwrite/GraphQL/Types/Mapper.php b/src/Appwrite/GraphQL/Types/Mapper.php index bedc2221a4..fe8d328ac1 100644 --- a/src/Appwrite/GraphQL/Types/Mapper.php +++ b/src/Appwrite/GraphQL/Types/Mapper.php @@ -65,6 +65,11 @@ class Mapper private static array $models = []; private static array $defaultArgs = []; + private static array $routeBlacklist = [ + 'v1/mock', + 'v1/graphql', + ]; + public static function init(array $models): void { self::$models = $models; @@ -121,11 +126,10 @@ class Mapper public static function route(App $utopia, Route $route): iterable { - if ( - \str_starts_with($route->getPath(), '/v1/mock/') || - \str_starts_with($route->getPath(), '/v1/graphql') - ) { - return; + foreach (self::$routeBlacklist as $blacklist) { + if (\str_starts_with($route->getPath(), $blacklist)) { + return; + } } $names = $route->getLabel('sdk.response.model', 'none');