Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Update GraphQLController to use ObjectMapper to map ExecutionResult #471

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@

@RestController
public class GraphQLController extends AbstractGraphQLController {

private final GraphQLObjectMapper objectMapper;
private final GraphQLInvoker graphQLInvoker;
private final GraphQLSpringInvocationInputFactory invocationInputFactory;

public GraphQLController(GraphQLObjectMapper objectMapper, GraphQLInvoker graphQLInvoker,
GraphQLSpringInvocationInputFactory invocationInputFactory) {
super(objectMapper);
this.objectMapper = objectMapper;
this.graphQLInvoker = graphQLInvoker;
this.invocationInputFactory = invocationInputFactory;
}
Expand All @@ -33,7 +34,7 @@ protected Object executeRequest(
GraphQLSingleInvocationInput invocationInput = invocationInputFactory
.create(new GraphQLRequest(query, variables, operationName), serverWebExchange);
Mono<ExecutionResult> executionResult = Mono.fromCompletionStage(graphQLInvoker.executeAsync(invocationInput));
return executionResult.map(ExecutionResult::toSpecification);
return executionResult.map(objectMapper::createResultFromExecutionResult);
}

}