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 $defaultArgs = [];
|
||||
|
||||
private static array $routeBlacklist = [
|
||||
'v1/mock',
|
||||
'v1/graphql',
|
||||
];
|
||||
|
||||
public static function init(array $models): void
|
||||
{
|
||||
self::$models = $models;
|
||||
|
@ -121,12 +126,11 @@ 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')
|
||||
) {
|
||||
foreach (self::$routeBlacklist as $blacklist) {
|
||||
if (\str_starts_with($route->getPath(), $blacklist)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$names = $route->getLabel('sdk.response.model', 'none');
|
||||
$models = \is_array($names)
|
||||
|
|
Loading…
Reference in a new issue