1
0
Fork 0
mirror of synced 2024-07-04 22:20:45 +12:00

Add route blacklist instead of individual cases

This commit is contained in:
Jake Barnby 2022-10-13 12:58:28 +13:00
parent aa5e9d7b2d
commit 5c5bdac3d9
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C

View file

@ -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');