diff --git a/src/Console/Commands/GraphqliteExportSchema.php b/src/Console/Commands/GraphqliteExportSchema.php index 13ae9a5..aa72f54 100644 --- a/src/Console/Commands/GraphqliteExportSchema.php +++ b/src/Console/Commands/GraphqliteExportSchema.php @@ -2,8 +2,8 @@ namespace TheCodingMachine\GraphQLite\Laravel\Console\Commands; -use GraphQL\Utils\SchemaPrinter; use Illuminate\Console\Command; +use TheCodingMachine\GraphQLite\Laravel\Utils\SchemaPrinter; use TheCodingMachine\GraphQLite\Schema; /** diff --git a/src/Providers/GraphQLiteServiceProvider.php b/src/Providers/GraphQLiteServiceProvider.php index f92f5d9..d5fbe2c 100644 --- a/src/Providers/GraphQLiteServiceProvider.php +++ b/src/Providers/GraphQLiteServiceProvider.php @@ -153,14 +153,6 @@ public function register() $service->addTypeMapperFactory($app[PaginatorTypeMapperFactory::class]); - // We need to configure an empty Subscription type to avoid an exception in the generate-schema command. - $config = SchemaConfig::create(); - $config->setSubscription(new ObjectType([ - 'name' => 'Subscription', - 'fields' => [], - ])); - $service->setSchemaConfig($config); - $controllers = config('graphqlite.controllers', 'App\\Http\\Controllers'); if (!is_iterable($controllers)) { $controllers = [ $controllers ]; diff --git a/src/Utils/SchemaPrinter.php b/src/Utils/SchemaPrinter.php new file mode 100644 index 0000000..a470849 --- /dev/null +++ b/src/Utils/SchemaPrinter.php @@ -0,0 +1,18 @@ +getQueryType() && $schema->getQueryType() === $schema->getType('Query') + && $schema->getMutationType() && $schema->getMutationType() === $schema->getType('Mutation'); + } +} \ No newline at end of file