@Override public void checkFragmentSpread(FragmentSpread fragmentSpread) { FragmentDefinition fragmentDefinition = getValidationContext().getFragment(fragmentSpread.getName()); if (fragmentDefinition == null) { String message = String.format("Undefined fragment %s", fragmentSpread.getName()); addError(ValidationErrorType.UndefinedFragment, fragmentSpread.getSourceLocation(), message); } } }
private Builder(FragmentSpread existing) { this.sourceLocation = existing.getSourceLocation(); this.comments = existing.getComments(); this.name = existing.getName(); this.directives = existing.getDirectives(); this.ignoredChars = existing.getIgnoredChars(); }
@Override public FragmentSpread deepCopy() { return new FragmentSpread(name, deepCopy(directives), getSourceLocation(), getComments(), getIgnoredChars()); }
@Override public void checkFragmentSpread(FragmentSpread fragmentSpread) { FragmentDefinition fragment = getValidationContext().getFragment(fragmentSpread.getName()); if (fragment == null) return; GraphQLType typeCondition = TypeFromAST.getTypeFromAST(getValidationContext().getSchema(), fragment.getTypeCondition()); GraphQLCompositeType parentType = getValidationContext().getParentType(); if (typeCondition == null || parentType == null) return; if (isValidTargetCompositeType(typeCondition) && isValidTargetCompositeType(parentType) && !doTypesOverlap(typeCondition, parentType)) { String message = String.format("Fragment %s cannot be spread here as objects of " + "type %s can never be of type %s", fragmentSpread.getName(), parentType.getName(), typeCondition.getName()); addError(ValidationErrorType.InvalidFragmentType, fragmentSpread.getSourceLocation(), message); } }
@Override public void checkFragmentSpread(FragmentSpread fragmentSpread) { FragmentDefinition fragmentDefinition = getValidationContext().getFragment(fragmentSpread.getName()); if (fragmentDefinition == null) { String message = String.format("Undefined fragment %s", fragmentSpread.getName()); addError(ValidationErrorType.UndefinedFragment, fragmentSpread.getSourceLocation(), message); } } }
private Builder(FragmentSpread existing) { this.sourceLocation = existing.getSourceLocation(); this.comments = existing.getComments(); this.name = existing.getName(); this.directives = existing.getDirectives(); this.ignoredChars = existing.getIgnoredChars(); }
@Override public FragmentSpread deepCopy() { return new FragmentSpread(name, deepCopy(directives), getSourceLocation(), getComments(), getIgnoredChars()); }
@Override public void checkFragmentSpread(FragmentSpread fragmentSpread) { FragmentDefinition fragment = getValidationContext().getFragment(fragmentSpread.getName()); if (fragment == null) return; GraphQLType typeCondition = TypeFromAST.getTypeFromAST(getValidationContext().getSchema(), fragment.getTypeCondition()); GraphQLCompositeType parentType = getValidationContext().getParentType(); if (typeCondition == null || parentType == null) return; if (isValidTargetCompositeType(typeCondition) && isValidTargetCompositeType(parentType) && !doTypesOverlap(typeCondition, parentType)) { String message = String.format("Fragment %s cannot be spread here as objects of " + "type %s can never be of type %s", fragmentSpread.getName(), parentType.getName(), typeCondition.getName()); addError(ValidationErrorType.InvalidFragmentType, fragmentSpread.getSourceLocation(), message); } }