X Tutup
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 2 additions & 31 deletions src/main/java/graphql/execution/Execution.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import graphql.language.VariableDefinition;
import graphql.schema.GraphQLObjectType;
import graphql.schema.GraphQLSchema;
import graphql.schema.impl.SchemaUtil;
import graphql.util.LogKit;
import org.slf4j.Logger;

Expand All @@ -26,14 +27,10 @@
import java.util.Map;
import java.util.concurrent.CompletableFuture;

import static graphql.Assert.assertShouldNeverHappen;
import static graphql.execution.ExecutionContextBuilder.newExecutionContextBuilder;
import static graphql.execution.ExecutionStepInfo.newExecutionStepInfo;
import static graphql.execution.ExecutionStrategyParameters.newParameters;
import static graphql.execution.instrumentation.SimpleInstrumentationContext.nonNullCtx;
import static graphql.language.OperationDefinition.Operation.MUTATION;
import static graphql.language.OperationDefinition.Operation.QUERY;
import static graphql.language.OperationDefinition.Operation.SUBSCRIPTION;
import static java.util.concurrent.CompletableFuture.completedFuture;

@Internal
Expand Down Expand Up @@ -115,7 +112,7 @@ private CompletableFuture<ExecutionResult> executeOperation(ExecutionContext exe
GraphQLObjectType operationRootType;

try {
operationRootType = getOperationRootType(executionContext.getGraphQLSchema(), operationDefinition);
operationRootType = SchemaUtil.getOperationRootType(executionContext.getGraphQLSchema(), operationDefinition);
} catch (RuntimeException rte) {
if (rte instanceof GraphQLError) {
ExecutionResult executionResult = new ExecutionResultImpl(Collections.singletonList((GraphQLError) rte));
Expand Down Expand Up @@ -175,30 +172,4 @@ private CompletableFuture<ExecutionResult> executeOperation(ExecutionContext exe

return result;
}


private GraphQLObjectType getOperationRootType(GraphQLSchema graphQLSchema, OperationDefinition operationDefinition) {
Copy link
Member Author

@dondonz dondonz Aug 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this to a util, it's also used by the ExecutableNormalizedOperationFactory

OperationDefinition.Operation operation = operationDefinition.getOperation();
if (operation == MUTATION) {
GraphQLObjectType mutationType = graphQLSchema.getMutationType();
if (mutationType == null) {
throw new MissingRootTypeException("Schema is not configured for mutations.", operationDefinition.getSourceLocation());
}
return mutationType;
} else if (operation == QUERY) {
GraphQLObjectType queryType = graphQLSchema.getQueryType();
if (queryType == null) {
throw new MissingRootTypeException("Schema does not define the required query root type.", operationDefinition.getSourceLocation());
}
return queryType;
} else if (operation == SUBSCRIPTION) {
GraphQLObjectType subscriptionType = graphQLSchema.getSubscriptionType();
if (subscriptionType == null) {
throw new MissingRootTypeException("Schema is not configured for subscriptions.", operationDefinition.getSourceLocation());
}
return subscriptionType;
} else {
return assertShouldNeverHappen("Unhandled case. An extra operation enum has been added without code support");
}
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

12 changes: 0 additions & 12 deletions src/main/java/graphql/execution/nextgen/BatchedDataFetcher.java

This file was deleted.

Loading
X Tutup