Skip to content

GraphQLMultiQueryRequest is not serializing variable references #860

Description

@giridhargg

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
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions