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
2 changes: 1 addition & 1 deletion src/main/java/graphql/GraphQL.java
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ public CompletableFuture<ExecutionResult> executeAsync(UnaryOperator<ExecutionIn
public CompletableFuture<ExecutionResult> executeAsync(ExecutionInput executionInput) {
ExecutionInput executionInputWithId = ensureInputHasId(executionInput);

CompletableFuture<InstrumentationState> instrumentationStateCF = instrumentation.createStateAsync(new InstrumentationCreateStateParameters(this.graphQLSchema, executionInput));
CompletableFuture<InstrumentationState> instrumentationStateCF = instrumentation.createStateAsync(new InstrumentationCreateStateParameters(this.graphQLSchema, executionInputWithId));
return Async.orNullCompletedFuture(instrumentationStateCF).thenCompose(instrumentationState -> {
try {
InstrumentationExecutionParameters inputInstrumentationParameters = new InstrumentationExecutionParameters(executionInputWithId, this.graphQLSchema, instrumentationState);
Expand Down
23 changes: 23 additions & 0 deletions src/test/groovy/graphql/GraphQLTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ import graphql.execution.SubscriptionExecutionStrategy
import graphql.execution.ValueUnboxer
import graphql.execution.instrumentation.ChainedInstrumentation
import graphql.execution.instrumentation.Instrumentation
import graphql.execution.instrumentation.InstrumentationState
import graphql.execution.instrumentation.SimpleInstrumentation
import graphql.execution.instrumentation.SimplePerformantInstrumentation
import graphql.execution.instrumentation.dataloader.DataLoaderDispatcherInstrumentation
import graphql.execution.instrumentation.parameters.InstrumentationCreateStateParameters
import graphql.execution.preparsed.NoOpPreparsedDocumentProvider
import graphql.language.SourceLocation
import graphql.schema.DataFetcher
Expand Down Expand Up @@ -1063,6 +1066,26 @@ over
many lines''']
}

def "executionId is set before being passed to instrumentation"() {
InstrumentationCreateStateParameters seenParams

def instrumentation = new Instrumentation() {
@Override InstrumentationState createState(InstrumentationCreateStateParameters params) {
seenParams = params
null
}
}

when:
GraphQL.newGraphQL(StarWarsSchema.starWarsSchema)
.instrumentation(instrumentation)
.build()
.execute("{ __typename }")

then:
seenParams.executionInput.executionId != null
}

def "variables map can't be null via ExecutionInput"() {
given:

Expand Down