Open
Description
This fixes building a schema with experimentalFragmentVariables
.
Currenty, the DocumentValidator
returns Unknown type "String"
.
Example:
$typeDefs = '
type Hello {
world(phrase: String): String
}
fragment hello($phrase: String = "world") on Hello {
world(phrase: $phrase)
}
type RootQuery {
hello: Hello
}
schema {
query: RootQuery
}
';
$astDocument = Parser::parse($typeDefs, ['experimentalFragmentVariables' => true]);
return BuildSchema::buildAST($astDocument);
Fragments should also implement TypeSystemDefinitionNode
to have the type names validated against the Type::BUILT_IN_TYPE_NAMES
by the GraphQL\Validator\Rules\KnownTypeNames
rule:
$isSDL = $definitionNode instanceof TypeSystemDefinitionNode || $definitionNode instanceof TypeSystemExtensionNode;
if ($isSDL && in_array($typeName, Type::BUILT_IN_TYPE_NAMES, true)) {
return;
}
Sorry, i struggled to add a test for this case with the current mock data in the KnownTypeNamesTest
. Please advise if it is required.
Metadata
Metadata
Assignees
Labels
No labels