From b185686e5cb1f9ae1943cf31985abe2035d662f9 Mon Sep 17 00:00:00 2001 From: Alex Tkachev Date: Sat, 23 Sep 2023 13:44:54 +0400 Subject: [PATCH] fix: allow big schemas to be serialized and cached --- src/Plugin/GraphQL/Schema/AlterableComposableSchema.php | 4 ++-- src/Plugin/GraphQL/Schema/SdlSchemaPluginBase.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Plugin/GraphQL/Schema/AlterableComposableSchema.php b/src/Plugin/GraphQL/Schema/AlterableComposableSchema.php index 3088322cc..31dda11f2 100644 --- a/src/Plugin/GraphQL/Schema/AlterableComposableSchema.php +++ b/src/Plugin/GraphQL/Schema/AlterableComposableSchema.php @@ -130,7 +130,7 @@ protected function getSchemaDocument(array $extensions = []) { $event, AlterSchemaDataEvent::EVENT_NAME ); - $ast = Parser::parse(implode("\n\n", $event->getSchemaData())); + $ast = Parser::parse(implode("\n\n", $event->getSchemaData()), ['noLocation' => TRUE]); if (empty($this->inDevelopment)) { $this->astCache->set($cid, $ast, CacheBackendInterface::CACHE_PERMANENT, ['graphql']); } @@ -172,7 +172,7 @@ protected function getExtensionDocument(array $extensions = []) { $event, AlterSchemaExtensionDataEvent::EVENT_NAME ); - $ast = !empty($extensions) ? Parser::parse(implode("\n\n", $event->getSchemaExtensionData())) : NULL; + $ast = !empty($extensions) ? Parser::parse(implode("\n\n", $event->getSchemaExtensionData()), ['noLocation' => TRUE]) : NULL; if (empty($this->inDevelopment)) { $this->astCache->set($cid, $ast, CacheBackendInterface::CACHE_PERMANENT, ['graphql']); } diff --git a/src/Plugin/GraphQL/Schema/SdlSchemaPluginBase.php b/src/Plugin/GraphQL/Schema/SdlSchemaPluginBase.php index 47d1e7f2c..ffd25b128 100644 --- a/src/Plugin/GraphQL/Schema/SdlSchemaPluginBase.php +++ b/src/Plugin/GraphQL/Schema/SdlSchemaPluginBase.php @@ -174,7 +174,7 @@ protected function getSchemaDocument(array $extensions = []) { }); $schema = array_merge([$this->getSchemaDefinition()], $extensions); - $ast = Parser::parse(implode("\n\n", $schema)); + $ast = Parser::parse(implode("\n\n", $schema), ['noLocation' => TRUE]); if (empty($this->inDevelopment)) { $this->astCache->set($cid, $ast, CacheBackendInterface::CACHE_PERMANENT, ['graphql']); } @@ -205,7 +205,7 @@ protected function getExtensionDocument(array $extensions = []) { return !empty($definition); }); - $ast = !empty($extensions) ? Parser::parse(implode("\n\n", $extensions)) : NULL; + $ast = !empty($extensions) ? Parser::parse(implode("\n\n", $extensions), ['noLocation' => TRUE]) : NULL; if (empty($this->inDevelopment)) { $this->astCache->set($cid, $ast, CacheBackendInterface::CACHE_PERMANENT, ['graphql']); }