Skip to content

ConditionalNodeDecision not invoked for every field #3409

@dfa1

Description

@dfa1

Describe the bug
I'm trying to use ConditionalNodeDecision but it not invoked for every field, just the top level one.

To Reproduce

final ExecutionInput executionInput = ExecutionInput.newExecutionInput()
                .query(request.query())
                .operationName(request.operationName())
                .variables(request.variables())
                .graphQLContext(builder ->
.graphQLContext(builder ->
                        builder
.put(ConditionalNodeDecision.class, new Custom()) <-- 

but then in graphql.execution.conditional.ConditionalNodes#shouldInclude:

        // if they have declared a decision callback, then we will use it but we expect this to be mostly
        // empty and hence the cost is a map lookup.
        if (graphQLContext != null) {
            ConditionalNodeDecision conditionalDecision = graphQLContext.get(ConditionalNodeDecision.class);

only the first call has the context, subsequent calls have empty context.

The first call is originating in:
image

and as you can see the context is defined.
The next call is originating in getImmediateFields:
image
and at this point the context is empty.

Graphql-java version is 21.2 on JDK 17.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions