TASK: Allow UnionType extensions

This commit is contained in:
Torsten Blindert 2018-10-01 19:45:48 +02:00
parent 1dc2b939cb
commit 0c33cfa88f

View File

@ -6,6 +6,7 @@ namespace GraphQL\Type\Definition;
use GraphQL\Error\InvariantViolation;
use GraphQL\Language\AST\UnionTypeDefinitionNode;
use GraphQL\Language\AST\UnionTypeExtensionNode;
use GraphQL\Utils\Utils;
use function call_user_func;
use function is_array;
@ -27,6 +28,9 @@ class UnionType extends Type implements AbstractType, OutputType, CompositeType,
/** @var ObjectType[] */
private $possibleTypeNames;
/** @var UnionTypeExtensionNode[] */
public $extensionASTNodes;
public function __construct($config)
{
if (! isset($config['name'])) {
@ -43,6 +47,7 @@ class UnionType extends Type implements AbstractType, OutputType, CompositeType,
$this->name = $config['name'];
$this->description = $config['description'] ?? null;
$this->astNode = $config['astNode'] ?? null;
$this->extensionASTNodes = $config['extensionASTNodes'] ?? null;
$this->config = $config;
}