Netflix / dgs-codegen

Apache License 2.0
177 stars 92 forks source link

Variable declaratino missing wenn miltiple operations are used #669

Open rogereitner opened 3 months ago

rogereitner commented 3 months ago

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.