Skip to content

Commit 9e99862

Browse files
authored
fix(schema): Allow big schemas to be serialized and cached (#1364)
1 parent 9268332 commit 9e99862

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Plugin/GraphQL/Schema/AlterableComposableSchema.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ protected function getSchemaDocument(array $extensions = []) {
130130
$event,
131131
AlterSchemaDataEvent::EVENT_NAME
132132
);
133-
$ast = Parser::parse(implode("\n\n", $event->getSchemaData()));
133+
$ast = Parser::parse(implode("\n\n", $event->getSchemaData()), ['noLocation' => TRUE]);
134134
if (empty($this->inDevelopment)) {
135135
$this->astCache->set($cid, $ast, CacheBackendInterface::CACHE_PERMANENT, ['graphql']);
136136
}
@@ -172,7 +172,7 @@ protected function getExtensionDocument(array $extensions = []) {
172172
$event,
173173
AlterSchemaExtensionDataEvent::EVENT_NAME
174174
);
175-
$ast = !empty($extensions) ? Parser::parse(implode("\n\n", $event->getSchemaExtensionData())) : NULL;
175+
$ast = !empty($extensions) ? Parser::parse(implode("\n\n", $event->getSchemaExtensionData()), ['noLocation' => TRUE]) : NULL;
176176
if (empty($this->inDevelopment)) {
177177
$this->astCache->set($cid, $ast, CacheBackendInterface::CACHE_PERMANENT, ['graphql']);
178178
}

src/Plugin/GraphQL/Schema/SdlSchemaPluginBase.php

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

176176
$schema = array_merge([$this->getSchemaDefinition()], $extensions);
177-
$ast = Parser::parse(implode("\n\n", $schema));
177+
$ast = Parser::parse(implode("\n\n", $schema), ['noLocation' => TRUE]);
178178
if (empty($this->inDevelopment)) {
179179
$this->astCache->set($cid, $ast, CacheBackendInterface::CACHE_PERMANENT, ['graphql']);
180180
}
@@ -205,7 +205,7 @@ protected function getExtensionDocument(array $extensions = []) {
205205
return !empty($definition);
206206
});
207207

208-
$ast = !empty($extensions) ? Parser::parse(implode("\n\n", $extensions)) : NULL;
208+
$ast = !empty($extensions) ? Parser::parse(implode("\n\n", $extensions), ['noLocation' => TRUE]) : NULL;
209209
if (empty($this->inDevelopment)) {
210210
$this->astCache->set($cid, $ast, CacheBackendInterface::CACHE_PERMANENT, ['graphql']);
211211
}

0 commit comments

Comments
 (0)