mirror of
https://github.com/retailcrm/graphql-php.git
synced 2025-02-11 18:19:23 +03:00
Additional checks for possible fragment spreads
This commit is contained in:
parent
1e34982bda
commit
c5efd1d65b
@ -5,7 +5,6 @@ namespace GraphQL\Validator\Rules;
|
||||
use GraphQL\Error\Error;
|
||||
use GraphQL\Language\AST\FragmentSpreadNode;
|
||||
use GraphQL\Language\AST\InlineFragmentNode;
|
||||
use GraphQL\Language\AST\Node;
|
||||
use GraphQL\Language\AST\NodeKind;
|
||||
use GraphQL\Type\Schema;
|
||||
use GraphQL\Type\Definition\AbstractType;
|
||||
@ -35,7 +34,9 @@ class PossibleFragmentSpreads extends AbstractValidationRule
|
||||
$fragType = $context->getType();
|
||||
$parentType = $context->getParentType();
|
||||
|
||||
if ($fragType && $parentType && !$this->doTypesOverlap($context->getSchema(), $fragType, $parentType)) {
|
||||
if ($fragType instanceof CompositeType &&
|
||||
$parentType instanceof CompositeType &&
|
||||
!$this->doTypesOverlap($context->getSchema(), $fragType, $parentType)) {
|
||||
$context->reportError(new Error(
|
||||
self::typeIncompatibleAnonSpreadMessage($parentType, $fragType),
|
||||
[$node]
|
||||
|
Loading…
x
Reference in New Issue
Block a user