Add route blacklist instead of individual cases
This commit is contained in:
parent
aa5e9d7b2d
commit
5c5bdac3d9
1 changed files with 9 additions and 5 deletions
|
@ -65,6 +65,11 @@ class Mapper
|
||||||
private static array $models = [];
|
private static array $models = [];
|
||||||
private static array $defaultArgs = [];
|
private static array $defaultArgs = [];
|
||||||
|
|
||||||
|
private static array $routeBlacklist = [
|
||||||
|
'v1/mock',
|
||||||
|
'v1/graphql',
|
||||||
|
];
|
||||||
|
|
||||||
public static function init(array $models): void
|
public static function init(array $models): void
|
||||||
{
|
{
|
||||||
self::$models = $models;
|
self::$models = $models;
|
||||||
|
@ -121,11 +126,10 @@ class Mapper
|
||||||
|
|
||||||
public static function route(App $utopia, Route $route): iterable
|
public static function route(App $utopia, Route $route): iterable
|
||||||
{
|
{
|
||||||
if (
|
foreach (self::$routeBlacklist as $blacklist) {
|
||||||
\str_starts_with($route->getPath(), '/v1/mock/') ||
|
if (\str_starts_with($route->getPath(), $blacklist)) {
|
||||||
\str_starts_with($route->getPath(), '/v1/graphql')
|
return;
|
||||||
) {
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$names = $route->getLabel('sdk.response.model', 'none');
|
$names = $route->getLabel('sdk.response.model', 'none');
|
||||||
|
|
Loading…
Reference in a new issue