Class GraphQLTypeCollectingVisitor
java.lang.Object
graphql.schema.GraphQLTypeVisitorStub
graphql.schema.impl.GraphQLTypeCollectingVisitor
- All Implemented Interfaces:
GraphQLTypeVisitor
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<String, GraphQLNamedType> private final Map<String, GraphQLNamedType> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidassertTypeUniqueness(GraphQLNamedType type, Map<String, GraphQLNamedType> result) private voidassertUniqueTypeObjects(GraphQLNamedType type, GraphQLType existingType) private Map<String, GraphQLNamedType> fixDanglingReplacedTypes(Map<String, GraphQLNamedType> visitedTypes) It's possible for certain schema edits to create a situation where a field / arg / input field had a type reference, then it got replaced with an actual strong reference and then the schema gets edited such that the only reference to that type is the replaced strong reference.com.google.common.collect.ImmutableMap<String, GraphQLNamedType> private booleanisNotTypeReference(String name) private voidsave(String name, GraphQLNamedType type) private <T> voidsaveIndirectStrongReference(Supplier<GraphQLType> typeSupplier) visitGraphQLAppliedDirectiveArgument(GraphQLAppliedDirectiveArgument node, TraverserContext<GraphQLSchemaElement> context) visitGraphQLArgument(GraphQLArgument node, TraverserContext<GraphQLSchemaElement> context) visitGraphQLEnumType(GraphQLEnumType node, TraverserContext<GraphQLSchemaElement> context) visitGraphQLFieldDefinition(GraphQLFieldDefinition node, TraverserContext<GraphQLSchemaElement> context) visitGraphQLInputObjectField(GraphQLInputObjectField node, TraverserContext<GraphQLSchemaElement> context) visitGraphQLInputObjectType(GraphQLInputObjectType node, TraverserContext<GraphQLSchemaElement> context) visitGraphQLInterfaceType(GraphQLInterfaceType node, TraverserContext<GraphQLSchemaElement> context) visitGraphQLObjectType(GraphQLObjectType node, TraverserContext<GraphQLSchemaElement> context) visitGraphQLScalarType(GraphQLScalarType node, TraverserContext<GraphQLSchemaElement> context) visitGraphQLUnionType(GraphQLUnionType node, TraverserContext<GraphQLSchemaElement> context) Methods inherited from class GraphQLTypeVisitorStub
visitGraphQLAppliedDirective, visitGraphQLDirective, visitGraphQLEnumValueDefinition, visitGraphQLList, visitGraphQLNonNull, visitGraphQLType, visitGraphQLTypeReferenceMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface GraphQLTypeVisitor
changeNode, deleteNode, insertAfter, insertBefore, visitBackRef, visitGraphQLCompositeType, visitGraphQLDirectiveContainer, visitGraphQLFieldsContainer, visitGraphQLInputFieldsContainer, visitGraphQLInputType, visitGraphQLModifiedType, visitGraphQLNullableType, visitGraphQLOutputType, visitGraphQLUnmodifiedType
-
Field Details
-
result
-
indirectStrongReferences
-
-
Constructor Details
-
GraphQLTypeCollectingVisitor
public GraphQLTypeCollectingVisitor()
-
-
Method Details
-
visitGraphQLEnumType
public TraversalControl visitGraphQLEnumType(GraphQLEnumType node, TraverserContext<GraphQLSchemaElement> context) - Specified by:
visitGraphQLEnumTypein interfaceGraphQLTypeVisitor- Overrides:
visitGraphQLEnumTypein classGraphQLTypeVisitorStub
-
visitGraphQLScalarType
public TraversalControl visitGraphQLScalarType(GraphQLScalarType node, TraverserContext<GraphQLSchemaElement> context) - Specified by:
visitGraphQLScalarTypein interfaceGraphQLTypeVisitor- Overrides:
visitGraphQLScalarTypein classGraphQLTypeVisitorStub
-
visitGraphQLObjectType
public TraversalControl visitGraphQLObjectType(GraphQLObjectType node, TraverserContext<GraphQLSchemaElement> context) - Specified by:
visitGraphQLObjectTypein interfaceGraphQLTypeVisitor- Overrides:
visitGraphQLObjectTypein classGraphQLTypeVisitorStub
-
visitGraphQLInputObjectType
public TraversalControl visitGraphQLInputObjectType(GraphQLInputObjectType node, TraverserContext<GraphQLSchemaElement> context) - Specified by:
visitGraphQLInputObjectTypein interfaceGraphQLTypeVisitor- Overrides:
visitGraphQLInputObjectTypein classGraphQLTypeVisitorStub
-
visitGraphQLInterfaceType
public TraversalControl visitGraphQLInterfaceType(GraphQLInterfaceType node, TraverserContext<GraphQLSchemaElement> context) - Specified by:
visitGraphQLInterfaceTypein interfaceGraphQLTypeVisitor- Overrides:
visitGraphQLInterfaceTypein classGraphQLTypeVisitorStub
-
visitGraphQLUnionType
public TraversalControl visitGraphQLUnionType(GraphQLUnionType node, TraverserContext<GraphQLSchemaElement> context) - Specified by:
visitGraphQLUnionTypein interfaceGraphQLTypeVisitor- Overrides:
visitGraphQLUnionTypein classGraphQLTypeVisitorStub
-
visitGraphQLFieldDefinition
public TraversalControl visitGraphQLFieldDefinition(GraphQLFieldDefinition node, TraverserContext<GraphQLSchemaElement> context) - Specified by:
visitGraphQLFieldDefinitionin interfaceGraphQLTypeVisitor- Overrides:
visitGraphQLFieldDefinitionin classGraphQLTypeVisitorStub
-
visitGraphQLInputObjectField
public TraversalControl visitGraphQLInputObjectField(GraphQLInputObjectField node, TraverserContext<GraphQLSchemaElement> context) - Specified by:
visitGraphQLInputObjectFieldin interfaceGraphQLTypeVisitor- Overrides:
visitGraphQLInputObjectFieldin classGraphQLTypeVisitorStub
-
visitGraphQLArgument
public TraversalControl visitGraphQLArgument(GraphQLArgument node, TraverserContext<GraphQLSchemaElement> context) - Specified by:
visitGraphQLArgumentin interfaceGraphQLTypeVisitor- Overrides:
visitGraphQLArgumentin classGraphQLTypeVisitorStub
-
visitGraphQLAppliedDirectiveArgument
public TraversalControl visitGraphQLAppliedDirectiveArgument(GraphQLAppliedDirectiveArgument node, TraverserContext<GraphQLSchemaElement> context) - Specified by:
visitGraphQLAppliedDirectiveArgumentin interfaceGraphQLTypeVisitor- Overrides:
visitGraphQLAppliedDirectiveArgumentin classGraphQLTypeVisitorStub
-
saveIndirectStrongReference
-
isNotTypeReference
-
save
-
assertTypeUniqueness
-
assertUniqueTypeObjects
-
getResult
-
fixDanglingReplacedTypes
private Map<String, GraphQLNamedType> fixDanglingReplacedTypes(Map<String, GraphQLNamedType> visitedTypes) It's possible for certain schema edits to create a situation where a field / arg / input field had a type reference, then it got replaced with an actual strong reference and then the schema gets edited such that the only reference to that type is the replaced strong reference. This edge case means that the replaced reference can be missed if it's the only way to get to that type because this visitor asks for the children as original type, e.g. the type reference and not the replaced reference.- Parameters:
visitedTypes- the types collected by this visitor- Returns:
- a fixed up map where the only
-