Netflix / Netflix/dgs-codegen

GraphQLMultiQueryRequest is not serializing variable references

Open
#860 1 comment 0 reactions 1 assignee View on GitHub

@paulbakker is already working on this.

Since Aug 11, 2025.

investigate
Dominant language
Kotlin
Stars
217
Forks
116
PR merge metrics
No merged PRs in 30d

Description

GraphQLMultiQueryRequest is not giving the variable references when serializing. Although GraphQLQueryRequest is serializing correctly. For example I have below schema:

type Query {
    books(author: String): [Book]
    authors: [Author]
}

type Book {
    id: ID
    name: String!
    authors: [Author!]!
}
type Author {
    name: String!
}

The generated DTO's for queries and projections, and the multi-query request will be:

var booksGraphqlQuery = BooksGraphQLQuery.newRequest().authorReference("authorName").build();
var authorsGraphqlQuery = AuthorsGraphQLQuery.newRequest().build();
var booksProjection = BooksProjectionRoot<>().id().name().authors().name();
var authorsProjection = AuthorsProjectionRoot<>().name();

var booksRequest = new GraphQLQueryRequest(booksGraphqlQuery, booksProjection);
var authorsRequest = new GraphQLQueryRequest(authorsGraphqlQuery, authorsProjection);

var multiQueryRequest = new GraphQLMultiQueryRequest(List.of(booksRequest, authorsRequest));

Now if I do booksRequest.serialize(), I see the result query string contains variable references

query ($authorName: String!) {
    books(author: $authorName) {
        id
        name
        authors {
            name
        }
    }
}

But if I do multiQueryRequest.serialize(), then the result query string does not contains the variable references

{
    books(author: null) {
        id
        name
        authors {
            name
        }
    }
    authors {
        name
    }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.