Skip to content

Commit

Permalink
fix(schema): Allow big schemas to be serialized and cached (#1364)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leksat authored Nov 11, 2023
1 parent 9268332 commit 9e99862
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Plugin/GraphQL/Schema/AlterableComposableSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
Expand Down Expand Up @@ -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']);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Plugin/GraphQL/Schema/SdlSchemaPluginBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
Expand Down Expand Up @@ -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']);
}
Expand Down

0 comments on commit 9e99862

Please sign in to comment.