Skip to content

AlterableComposableSchema::getExtensionDocument returning NULL #1395

@almunnings

Description

@almunnings

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions