Skip to content

Commit 6c6d8f3

Browse files
LennardWesterveldfubhy
authored andcommitted
fix(SdlSchemaPluginBase): Allowing empty extension document. (#846)
1 parent 251dc40 commit 6c6d8f3

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/Plugin/GraphQL/Schema/SdlSchemaPluginBase.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,11 @@ public function getSchema(ResolverRegistryInterface $registry) {
132132
$extension->registerResolvers($registry);
133133
}
134134

135-
return SchemaExtender::extend($schema, $this->getExtensionDocument($extensions));
135+
if ($extendSchema = $this->getExtensionDocument($extensions)) {
136+
return SchemaExtender::extend($schema, $extendSchema);
137+
}
138+
139+
return $schema;
136140
}
137141

138142
/**
@@ -198,7 +202,7 @@ protected function getExtensionDocument(array $extensions = []) {
198202
return !empty($definition);
199203
});
200204

201-
$ast = Parser::parse(implode("\n\n", $extensions));
205+
$ast = !empty($extensions) ? Parser::parse(implode("\n\n", $extensions)) : NULL;
202206
if (empty($this->inDevelopment)) {
203207
$this->astCache->set($cid, $ast, CacheBackendInterface::CACHE_PERMANENT, ['graphql']);
204208
}

0 commit comments

Comments
 (0)