Closed
Description
I’m using last example from http://webonyx.github.io/graphql-php/type-system/type-language/
if (!file_exists($cacheFilename)) {
$document = Parser::parse(file_get_contents('./schema.graphql'));
file_put_contents($cacheFilename, "<?php\nreturn " . var_export(AST::toArray($document), true));
} else {
$document = AST::fromArray(require $cacheFilename); // fromArray() is a lazy operation as well
}
When there is no cache file yet - graphiql shows descriptions defined in schema.graphql,
But second request (when cache file already exists) shows all fields without description.
I’ve made quick research and found that in BuildSchema::getDescription on second request node already contain ‘description’ and next parsing not needed.
I propose made simple check in begin of this function
if (property_exists($node, 'description'))
return $node->description;