Skip to content

Commit f17938e

Browse files
committed
Polishing
1 parent 2652a57 commit f17938e

File tree

3 files changed

+9
-62
lines changed

3 files changed

+9
-62
lines changed

spring-graphql/src/main/java/org/springframework/graphql/data/pagination/ConnectionFieldTypeVisitor.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ public TraversalControl visitGraphQLFieldDefinition(
110110
return TraversalControl.CONTINUE;
111111
}
112112

113-
private static boolean isUnderSubscriptionOperation(TypeVisitorHelper visitorHelper, TraverserContext<GraphQLSchemaElement> context) {
113+
private static boolean isUnderSubscriptionOperation(
114+
TypeVisitorHelper visitorHelper, TraverserContext<GraphQLSchemaElement> context) {
115+
114116
return context.getBreadcrumbs().stream()
115117
.filter(GraphQLFieldsContainer.class::isInstance)
116118
.map(GraphQLFieldsContainer.class::cast)

spring-graphql/src/main/java/org/springframework/graphql/execution/DefaultTypeVisitorHelper.java

Lines changed: 0 additions & 54 deletions
This file was deleted.

spring-graphql/src/main/java/org/springframework/graphql/execution/TypeVisitorHelper.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,15 +16,13 @@
1616

1717
package org.springframework.graphql.execution;
1818

19-
import java.util.List;
20-
2119
import graphql.schema.GraphQLNamedType;
2220
import graphql.schema.GraphQLSchema;
2321

2422
/**
25-
* Helper for {@link graphql.schema.GraphQLTypeVisitor}s registered via
26-
* {@link GraphQlSource.Builder#typeVisitors(List)} that is exposed as a
27-
* variable in {@link graphql.util.TraverserContext}.
23+
* Helps {@link graphql.schema.GraphQLTypeVisitor}s to recognize whether a type
24+
* is the subscription type. Exposed as a variable in
25+
* {@link graphql.util.TraverserContext}.
2826
*
2927
* @author Rossen Stoyanchev
3028
* @since 1.2.1
@@ -43,7 +41,8 @@ public interface TypeVisitorHelper {
4341
* @param schema the GraphQL schema to use
4442
*/
4543
static TypeVisitorHelper create(GraphQLSchema schema) {
46-
return new DefaultTypeVisitorHelper(schema);
44+
String name = (schema.getSubscriptionType() != null) ? schema.getSubscriptionType().getName() : null;
45+
return (candidate) -> candidate.getName().equals(name);
4746
}
4847

4948
}

0 commit comments

Comments
 (0)