Skip to content

Commit 965ae5c

Browse files
committed
remove conditional node decision feature and cleanup
1 parent 469caf6 commit 965ae5c

4 files changed

Lines changed: 97 additions & 214 deletions

File tree

‎src/main/java/graphql/execution/conditional/ConditionalNodeDecision.java‎

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

‎src/main/java/graphql/execution/conditional/ConditionalNodeDecisionEnvironment.java‎

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

‎src/main/java/graphql/execution/conditional/ConditionalNodes.java‎

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -26,55 +26,10 @@ public boolean shouldInclude(DirectivesContainer<?> element,
2626
GraphQLSchema graphQLSchema,
2727
GraphQLContext graphQLContext
2828
) {
29-
//
30-
// call the base @include / @skip first
31-
if (!shouldInclude(variables, element.getDirectives())) {
32-
return false;
33-
}
34-
//
35-
// if they have declared a decision callback, then we will use it but we expect this to be mostly
36-
// empty and hence the cost is a map lookup.
37-
if (graphQLContext != null) {
38-
ConditionalNodeDecision conditionalDecision = graphQLContext.get(ConditionalNodeDecision.class);
39-
if (conditionalDecision != null) {
40-
return customShouldInclude(variables, element, graphQLSchema, graphQLContext, conditionalDecision);
41-
}
42-
}
43-
// if no one says otherwise, the node is considered included
44-
return true;
45-
}
46-
47-
private boolean customShouldInclude(Map<String, Object> variables,
48-
DirectivesContainer<?> element,
49-
GraphQLSchema graphQLSchema,
50-
GraphQLContext graphQLContext,
51-
ConditionalNodeDecision conditionalDecision
52-
) {
53-
CoercedVariables coercedVariables = CoercedVariables.of(variables);
54-
return conditionalDecision.shouldInclude(new ConditionalNodeDecisionEnvironment() {
55-
@Override
56-
public DirectivesContainer<?> getDirectivesContainer() {
57-
return element;
58-
}
59-
60-
@Override
61-
public CoercedVariables getVariables() {
62-
return coercedVariables;
63-
}
64-
65-
@Override
66-
public GraphQLSchema getGraphQlSchema() {
67-
return graphQLSchema;
68-
}
69-
70-
@Override
71-
public GraphQLContext getGraphQLContext() {
72-
return graphQLContext;
73-
}
74-
});
29+
return shouldInclude(variables, element.getDirectives());
30+
// this was backported and additional code which allowed for custom Should include code was removed
7531
}
7632

77-
7833
private boolean shouldInclude(Map<String, Object> variables, List<Directive> directives) {
7934
// shortcut on no directives
8035
if (directives.isEmpty()) {

0 commit comments

Comments
 (0)