Netflix / Netflix/dgs-codegen

Variable declaratino missing wenn miltiple operations are used

Open
#669 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hi,
ich tried to create a query based on GraphQLMultiQueryRequest using variable references:

quey ($request1: Type1m $request2: Type2){
op1(request: $request1){
...
}
op2 (request: $request2){
...
}
}

by setting up variable references in the first request I am using in the GraphQLMultiQueryRequest for serializtion.
The query, that I get from call of the method serialize ist
quey{
op1(request: $request1){
...
}
op2 (request: $request2){
...
}
}
which cannot be performed, as the engine cannot have an idea of the type of operations the arguments.
I figured, that it might be, that just

operationDef.variableDefinitions(variableDefinitions)...
is missing in the implementation of GraphQLMultiQueryRequest. However, as I can see, that variableDefinitions are collected earlier in the code, there might be a reason I'm unaware off, that is prohibiting to do so.
Please let me know, whether or not the code change I'm suggesting will work and if not, what would be the right way to deal with such a situation.

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.

Research direction

Start at GraphQLMultiQueryRequest serialization, focusing on how variable definitions are collected and passed to the operation definition. Reproduce the two-operation query from the issue and verify that serialization retains the variable declarations so the resulting query can be executed.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.