Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AlterableComposableSchema::getExtensionDocument returning NULL #1395

Closed
almunnings opened this issue Apr 12, 2024 · 0 comments · Fixed by #1398
Closed

AlterableComposableSchema::getExtensionDocument returning NULL #1395

almunnings opened this issue Apr 12, 2024 · 0 comments · Fixed by #1398

Comments

@almunnings
Copy link
Contributor

Ahoy hoy

If you have a schema without any extensions, and you use the AlterSchemaExtensionDataEvent to add to $extensions, the $ast will always return NULL.

https://github.com/drupal-graphql/graphql/blob/8.x-4.x/src/Plugin/GraphQL/Schema/AlterableComposableSchema.php#L172

$ast = !empty($extensions) ? Parser::parse(implode("\n\n", $event->getSchemaExtensionData()), ['noLocation' => TRUE]) : NULL;

Should probably read:

$extensions = $event->getSchemaExtensionData();
$ast = !empty($extensions) ? Parser::parse(implode("\n\n", $extensions), ['noLocation' => TRUE]) : NULL;

Ran into this with GraphQL Compose. The sdl extensions are injected via the event, not via schema extensions.

Please and thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant