You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Executor/ReferenceExecutor.php
+13-14Lines changed: 13 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,7 @@
36
36
useGraphQL\Type\Definition\Type;
37
37
useGraphQL\Type\Introspection;
38
38
useGraphQL\Type\Schema;
39
+
useGraphQL\Type\SchemaValidationContext;
39
40
useGraphQL\Utils\AST;
40
41
useGraphQL\Utils\Utils;
41
42
useSplObjectStorage;
@@ -848,14 +849,10 @@ protected function completeValue(
848
849
849
850
// Account for invalid schema definition when typeLoader returns different
850
851
// instance than `resolveType` or $field->getType() or $arg->getType()
851
-
$schema = $this->exeContext->schema;
852
-
if ($returnType !== $schema->getType($returnType->name)) {
853
-
$hint = $schema->getConfig()->typeLoader !== null
854
-
? "Ensure the type loader returns the same instance as defined in {$info->parentType}.{$info->fieldName}. "
855
-
: '';
856
-
857
-
thrownewInvariantViolation("Found duplicate type in schema: {$returnType}. {$hint}See https://webonyx.github.io/graphql-php/type-definitions/#type-registry.");
@@ -1356,13 +1353,15 @@ protected function ensureValidRuntimeType(
1356
1353
thrownewInvariantViolation("Runtime Object type \"{$runtimeType}\" is not a possible type for \"{$returnType}\".");
1357
1354
}
1358
1355
1359
-
if ($this->exeContext->schema->getType($runtimeType->name) === null) {
1360
-
thrownewInvariantViolation("Schema does not contain type \"{$runtimeType}\". This can happen when an object type is only referenced indirectly through abstract types and never directly through fields.List the type in the option \"types\" during schema construction, see https://webonyx.github.io/graphql-php/schema-definition/#configuration-options.");
"Schema does not contain type \"{$runtimeType}\". This can happen when an object type is only referenced indirectly through abstract types and never directly through fields.List the type in the option \"types\" during schema construction, see https://webonyx.github.io/graphql-php/schema-definition/#configuration-options."
1359
+
);
1362
1360
1363
-
if ($runtimeType !== $this->exeContext->schema->getType($runtimeType->name)) {
1364
-
thrownewInvariantViolation("Schema must contain unique named types but contains multiple types named \"{$runtimeType}\". Make sure that `resolveType` function of abstract type \"{$returnType}\" returns the same type instance as referenced anywhere else within the schema (see https://webonyx.github.io/graphql-php/type-definitions/#type-registry).");
"Schema must contain unique named types but contains multiple types named \"{$runtimeType}\". Make sure that `resolveType` function of abstract type \"{$returnType}\" returns the same type instance as referenced anywhere else within the schema (see https://webonyx.github.io/graphql-php/type-definitions/#type-registry)."
Copy file name to clipboardExpand all lines: src/Type/Schema.php
+4-5Lines changed: 4 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -125,11 +125,10 @@ public function getTypeMap(): array
125
125
assert($typeinstanceof NamedType);
126
126
127
127
$typeName = $type->name;
128
-
if (isset($this->resolvedTypes[$typeName])) {
129
-
if ($type !== $this->resolvedTypes[$typeName]) {
130
-
thrownewInvariantViolation("Schema must contain unique named types but contains multiple types named \"{$type}\" (see https://webonyx.github.io/graphql-php/type-definitions/#type-registry).");
"Schema must contain unique named types but contains multiple types named \"{$type}\" (see https://webonyx.github.io/graphql-php/type-definitions/#type-registry).",
'Schema does not contain type "FooObject". This can happen when an object type is only referenced indirectly through abstract types and never directly through fields.List the type in the option "types" during schema construction, see https://webonyx.github.io/graphql-php/schema-definition/#configuration-options.',
'Schema must contain unique named types but contains multiple types named "Test". Make sure that `resolveType` function of abstract type "Node" returns the same type instance as referenced anywhere else within the schema (see https://webonyx.github.io/graphql-php/type-definitions/#type-registry).',
Copy file name to clipboardExpand all lines: tests/Executor/ExecutorLazySchemaTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -181,8 +181,8 @@ public function testHintsOnConflictingTypeInstancesInDefinitions(): void
181
181
182
182
$error = $result->errors[0] ?? null;
183
183
self::assertInstanceOf(Error::class, $error);
184
-
self::assertEquals(
185
-
'Found duplicate type in schema: Test. Ensure the type loader returns the same instance as defined in Query.test. See https://webonyx.github.io/graphql-php/type-definitions/#type-registry.',
184
+
self::assertStringContainsString(
185
+
'Found duplicate type in schema at Query.test: Test. Ensure the type loader returns the same instance. See https://webonyx.github.io/graphql-php/type-definitions/#type-registry.',
'SomeScalar must provide "serialize" function. If this custom Scalar '
1296
-
. 'is also used as an input type, ensure "parseValue" and "parseLiteral" '
1297
-
. 'functions are also provided.'
1295
+
'SomeScalar must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.'
1298
1296
));
1299
1297
1300
1298
$this->schemaWithFieldType(
@@ -1772,8 +1770,7 @@ public function testRejectsASchemaWhichDefinesAnObjectTypeTwice(): void
'Schema must contain unique named types but contains multiple types named "SameName" (see https://webonyx.github.io/graphql-php/type-definitions/#type-registry).'
1777
1774
));
1778
1775
$schema->assertValid();
1779
1776
}
@@ -1810,13 +1807,12 @@ public function testRejectsASchemaWhichDefinesFieldsWithConflictingTypes(): void
'Schema must contain unique named types but contains multiple types named "SameName" (see https://webonyx.github.io/graphql-php/type-definitions/#type-registry).'
0 commit comments