Skip to content

Commit 5d7ceca

Browse files
authored
docs(schema): Add comment about the noLocation option (#1376)
1 parent 9e99862 commit 5d7ceca

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/Plugin/GraphQL/Schema/AlterableComposableSchema.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ protected function getSchemaDocument(array $extensions = []) {
130130
$event,
131131
AlterSchemaDataEvent::EVENT_NAME
132132
);
133+
// For caching and parsing big schemas we need to disable the creation of
134+
// location nodes in the AST object to prevent serialization and memory
135+
// errors. See https://github.com/webonyx/graphql-php/issues/1164
133136
$ast = Parser::parse(implode("\n\n", $event->getSchemaData()), ['noLocation' => TRUE]);
134137
if (empty($this->inDevelopment)) {
135138
$this->astCache->set($cid, $ast, CacheBackendInterface::CACHE_PERMANENT, ['graphql']);

src/Plugin/GraphQL/Schema/SdlSchemaPluginBase.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ protected function getSchemaDocument(array $extensions = []) {
174174
});
175175

176176
$schema = array_merge([$this->getSchemaDefinition()], $extensions);
177+
// For caching and parsing big schemas we need to disable the creation of
178+
// location nodes in the AST object to prevent serialization and memory
179+
// errors. See https://github.com/webonyx/graphql-php/issues/1164
177180
$ast = Parser::parse(implode("\n\n", $schema), ['noLocation' => TRUE]);
178181
if (empty($this->inDevelopment)) {
179182
$this->astCache->set($cid, $ast, CacheBackendInterface::CACHE_PERMANENT, ['graphql']);

0 commit comments

Comments
 (0)