diff --git a/src/Plugin/GraphQL/Schema/SdlSchemaPluginBase.php b/src/Plugin/GraphQL/Schema/SdlSchemaPluginBase.php index 47d1e7f2c..5637a6bf4 100644 --- a/src/Plugin/GraphQL/Schema/SdlSchemaPluginBase.php +++ b/src/Plugin/GraphQL/Schema/SdlSchemaPluginBase.php @@ -164,22 +164,22 @@ protected function getSchemaDocument(array $extensions = []) { // Only use caching of the parsed document if we aren't in development mode. $cid = "schema:{$this->getPluginId()}"; if (empty($this->inDevelopment) && $cache = $this->astCache->get($cid)) { - return $cache->data; + $schema = $cache->data; } - - $extensions = array_filter(array_map(function (SchemaExtensionPluginInterface $extension) { - return $extension->getBaseDefinition(); - }, $extensions), function ($definition) { - return !empty($definition); - }); - - $schema = array_merge([$this->getSchemaDefinition()], $extensions); - $ast = Parser::parse(implode("\n\n", $schema)); - if (empty($this->inDevelopment)) { - $this->astCache->set($cid, $ast, CacheBackendInterface::CACHE_PERMANENT, ['graphql']); + else { + $extensions = array_filter(array_map(function (SchemaExtensionPluginInterface $extension) { + return $extension->getBaseDefinition(); + }, $extensions), function ($definition) { + return !empty($definition); + }); + + $schema = array_merge([$this->getSchemaDefinition()], $extensions); + if (empty($this->inDevelopment)) { + $this->astCache->set($cid, $schema, CacheBackendInterface::CACHE_PERMANENT, ['graphql']); + } } - return $ast; + return Parser::parse(implode("\n\n", $schema)); } /**