fix(graphql): default to v1 schema (#1015)

This commit is contained in:
Kyrch
2025-11-30 10:07:05 -03:00
committed by GitHub
parent 037a460add
commit ac5df24981
4 changed files with 26 additions and 36 deletions
@@ -93,7 +93,7 @@ class OptimizeImageAction
}
if ($this->width !== null && $this->height !== null) {
$imagePath = $this->downscaleImage($imagePath);
return $this->downscaleImage($imagePath);
}
return $imagePath;
@@ -88,15 +88,18 @@ use App\GraphQL\Schema\Unions\PerformanceArtistUnion;
use App\GraphQL\Schema\Unions\ResourceableUnion;
use App\Http\Middleware\GraphQL\LogGraphQLRequest;
use App\Http\Middleware\GraphQL\MaxCount;
use App\Http\Middleware\GraphQL\RateLimitPerQuery;
use App\Http\Middleware\GraphQL\SetServingGraphQL;
use Illuminate\Support\Facades\Config;
use Rebing\GraphQL\GraphQLController;
use Rebing\GraphQL\Support\Contracts\ConfigConvertible;
class DefaultSchema implements ConfigConvertible
class V1Schema implements ConfigConvertible
{
public function toConfig(): array
{
return [
// Also supported array syntax: `[\Rebing\GraphQL\GraphQLController::class, 'query']`
'controller' => GraphQLController::class.'@query',
'query' => [
// Admin
AnnouncementPaginationQuery::class,
@@ -220,12 +223,6 @@ class DefaultSchema implements ConfigConvertible
],
// Laravel HTTP middleware
'middleware' => [
// Rate limiting GraphQL to prevent abuse.
RateLimitPerQuery::class,
// Set the serving context to graphql.
SetServingGraphQL::class,
// Allow client to get full database.
MaxCount::class,
@@ -237,6 +234,10 @@ class DefaultSchema implements ConfigConvertible
// An array of middlewares, overrides the global ones
'execution_middleware' => [],
'route_attributes' => [
'domain' => Config::get('graphql.domain'),
],
];
}
}
+13 -24
View File
@@ -2,28 +2,32 @@
declare(strict_types=1);
use App\GraphQL\Schema\Schemas\DefaultSchema;
use App\GraphQL\Schema\Schemas\V1Schema;
use App\GraphQL\Schema\Types\Base\PaginationInfoType;
use App\Http\Middleware\GraphQL\RateLimitPerQuery;
use App\Http\Middleware\GraphQL\SetServingGraphQL;
return [
'domain' => env('GRAPHQL_DOMAIN_NAME', env('APP_URL')),
'rate_limit' => (int) env('GRAPHQL_RATE_LIMIT', 80),
'route' => [
// The prefix for routes; do NOT use a leading slash!
'prefix' => env('GRAPHQL_PATH', '/'),
// The controller/method to use in GraphQL request.
// Also supported array syntax: `[\Rebing\GraphQL\GraphQLController::class, 'query']`
'controller' => Rebing\GraphQL\GraphQLController::class.'@query',
// Any middleware for the graphql route group
// This middleware will apply to all schemas
'middleware' => [],
'middleware' => [
// Set the serving context to graphql.
SetServingGraphQL::class,
// Rate limiting GraphQL to prevent abuse.
RateLimitPerQuery::class,
],
// Additional route group attributes
//
// Example:
//
// 'group_attributes' => ['guard' => 'api']
//
'group_attributes' => [
@@ -33,7 +37,7 @@ return [
// The name of the default schema
// Used when the route group is directly accessed
'default_schema' => 'default',
'default_schema' => 'v1',
'batching' => [
// Whether to support GraphQL batching or not.
@@ -45,8 +49,6 @@ return [
// The schemas for query and/or mutation. It expects an array of schemas to provide
// both the 'query' fields and the 'mutation' fields.
//
// You can also provide a middleware that will only apply to the given schema
//
// Example:
//
// 'schemas' => [
@@ -71,17 +73,13 @@ return [
// ]
//
'schemas' => [
'default' => DefaultSchema::class,
'v1' => V1Schema::class,
],
// The global types available to all schemas.
// You can then access it from the facade like this: GraphQL::type('user')
'types' => [
// Pagination
PaginationInfoType::class,
// ExampleType::class,
// ExampleRelationType::class,
// \Rebing\GraphQL\Support\UploadType::class,
],
// This callable will be passed the Error object for each errors GraphQL catch.
@@ -124,19 +122,16 @@ return [
],
/*
* You can define your own pagination type.
* Reference \Rebing\GraphQL\Support\PaginationType::class
*/
'pagination_type' => App\GraphQL\Schema\Types\Base\PaginationType::class,
/*
* You can define your own simple pagination type.
* Reference \Rebing\GraphQL\Support\SimplePaginationType::class
*/
'simple_pagination_type' => Rebing\GraphQL\Support\SimplePaginationType::class,
/*
* You can define your own cursor pagination type.
* Reference Rebing\GraphQL\Support\CursorPaginationType::class
*/
'cursor_pagination_type' => Rebing\GraphQL\Support\CursorPaginationType::class,
@@ -193,9 +188,6 @@ return [
'cache_ttl' => 300,
],
/*
* Execution middlewares
*/
'execution_middleware' => [
Rebing\GraphQL\Support\ExecutionMiddleware\ValidateOperationParamsMiddleware::class,
// AutomaticPersistedQueriesMiddleware listed even if APQ is disabled, see the docs for the `'apq'` configuration
@@ -204,8 +196,5 @@ return [
// \Rebing\GraphQL\Support\ExecutionMiddleware\UnusedVariablesMiddleware::class,
],
/*
* Globally registered ResolverMiddleware
*/
'resolver_middleware_append' => null,
];
+2 -2
View File
@@ -19,7 +19,7 @@ return [
|
*/
'domain' => env('FILAMENT_DOMAIN'),
'domain' => env('FILAMENT_DOMAIN_NAME'),
/*
|--------------------------------------------------------------------------
@@ -32,7 +32,7 @@ return [
|
*/
'path' => env('FILAMENT_DOMAIN') ? env('PULSE_PATH', 'pulse') : env('FILAMENT_PATH').'/pulse',
'path' => env('FILAMENT_DOMAIN_NAME') ? env('PULSE_PATH', 'pulse') : env('FILAMENT_PATH').'/pulse',
/*
|--------------------------------------------------------------------------