private Builder(InlineFragment existing) { this.sourceLocation = existing.getSourceLocation(); this.comments = existing.getComments(); this.typeCondition = existing.getTypeCondition(); this.directives = existing.getDirectives(); this.selectionSet = existing.getSelectionSet(); this.ignoredChars = existing.getIgnoredChars(); }
@Override public InlineFragment deepCopy() { return new InlineFragment( deepCopy(typeCondition), deepCopy(directives), deepCopy(selectionSet), getSourceLocation(), getComments(), getIgnoredChars() ); }
@Override public void checkInlineFragment(InlineFragment inlineFragment) { if (inlineFragment.getTypeCondition() == null) { return; } GraphQLType type = getValidationContext().getSchema().getType(inlineFragment.getTypeCondition().getName()); if (type == null) return; if (!(type instanceof GraphQLCompositeType)) { String message = "Inline fragment type condition is invalid, must be on Object/Interface/Union"; addError(ValidationErrorType.InlineFragmentTypeConditionInvalid, inlineFragment.getSourceLocation(), message); } }
@Override public void checkInlineFragment(InlineFragment inlineFragment) { GraphQLOutputType fragType = getValidationContext().getOutputType(); GraphQLCompositeType parentType = getValidationContext().getParentType(); if (fragType == null || parentType == null) return; if (isValidTargetCompositeType(fragType) && isValidTargetCompositeType(parentType) && !doTypesOverlap(fragType, parentType)) { String message = String.format("Fragment cannot be spread here as objects of " + "type %s can never be of type %s", parentType.getName(), fragType.getName()); addError(ValidationErrorType.InvalidFragmentType, inlineFragment.getSourceLocation(), message); } }
private Builder(InlineFragment existing) { this.sourceLocation = existing.getSourceLocation(); this.comments = existing.getComments(); this.typeCondition = existing.getTypeCondition(); this.directives = existing.getDirectives(); this.selectionSet = existing.getSelectionSet(); this.ignoredChars = existing.getIgnoredChars(); }
@Override public InlineFragment deepCopy() { return new InlineFragment( deepCopy(typeCondition), deepCopy(directives), deepCopy(selectionSet), getSourceLocation(), getComments(), getIgnoredChars() ); }
@Override public void checkInlineFragment(InlineFragment inlineFragment) { if (inlineFragment.getTypeCondition() == null) { return; } GraphQLType type = getValidationContext().getSchema().getType(inlineFragment.getTypeCondition().getName()); if (type == null) return; if (!(type instanceof GraphQLCompositeType)) { String message = "Inline fragment type condition is invalid, must be on Object/Interface/Union"; addError(ValidationErrorType.InlineFragmentTypeConditionInvalid, inlineFragment.getSourceLocation(), message); } }
@Override public void checkInlineFragment(InlineFragment inlineFragment) { GraphQLOutputType fragType = getValidationContext().getOutputType(); GraphQLCompositeType parentType = getValidationContext().getParentType(); if (fragType == null || parentType == null) return; if (isValidTargetCompositeType(fragType) && isValidTargetCompositeType(parentType) && !doTypesOverlap(fragType, parentType)) { String message = String.format("Fragment cannot be spread here as objects of " + "type %s can never be of type %s", parentType.getName(), fragType.getName()); addError(ValidationErrorType.InvalidFragmentType, inlineFragment.getSourceLocation(), message); } }