Skip to content

Commit a4c30f7

Browse files
authored
Merge pull request #766 from mfn/mfn-dont-catch
Don't catch SchemaNotFound
2 parents fafba4f + bb44cc4 commit a4c30f7

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ CHANGELOG
101101
- Laravels `ValidationException` is now formatted the same way as a `ValidationError` [\#748 / mfn](https://github.com/rebing/graphql-laravel/pull/748)
102102

103103
### Changed
104+
- Don't silence broken schemas when normalizing them for generating routes [\#766 / mfn](https://github.com/rebing/graphql-laravel/pull/766)
104105
- Lazy loading types has been enabled by default [\#758 / mfn](https://github.com/rebing/graphql-laravel/pull/758)
105106

106107
2021-04-10, 7.2.0

src/GraphQL.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -500,13 +500,12 @@ protected function getSchemaConfiguration($schema)
500500
*/
501501
public static function getNormalizedSchemasConfiguration(): array
502502
{
503-
return array_filter(array_map(function ($schema) {
504-
try {
503+
return array_map(
504+
static function ($schema) {
505505
return static::getNormalizedSchemaConfiguration($schema);
506-
} catch (SchemaNotFound $e) {
507-
return null;
508-
}
509-
}, config('graphql.schemas', [])));
506+
},
507+
config('graphql.schemas', [])
508+
);
510509
}
511510

512511
/**

tests/TestCase.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ protected function getEnvironmentSetUp($app): void
7272
]);
7373

7474
$app['config']->set('graphql.schemas.class_based', ExampleSchema::class);
75-
$app['config']->set('graphql.schemas.invalid_class_based', 'ThisClassDoesntExist');
7675

7776
$app['config']->set('graphql.types', [
7877
'Example' => ExampleType::class,

tests/Unit/GraphQLTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ public function testSchemaWithWrongName(): void
9797

9898
public function testSchemaWithInvalidClassName(): void
9999
{
100+
$this->app['config']->set('graphql.schemas.invalid_class_based', 'ThisClassDoesntExist');
101+
100102
$this->expectException(SchemaNotFound::class);
101103
$this->expectExceptionMessage('Schema class ThisClassDoesntExist not found.');
102104
GraphQL::schema('invalid_class_based');

0 commit comments

Comments
 (0)