graphene icon indicating copy to clipboard operation
graphene copied to clipboard

Incorrect query AST when there are duplicated nested fields with different selection sets

Open fireteam99 opened this issue 3 years ago • 0 comments

When resolving a query with duplicated nested fields with different selection sets, only the first selection set is available to the resolver info AST.

Given the following query:

query {
    person {
        firstName
    }
    person {
        lastName
    }
}

When inspecting the AST available in info.field_nodes, only firstName will be available.

Expected behavior: the person resolver is called once, and firstName and lastName are available in the AST. Or, the person resolver gets called twice: first with firstName in the AST and the second with lastName in the AST.

Current behavior: the person resolver is called once, and only with firstName.

This is a problem, because I want to be able to know all the full selection set of a queried field for optimization purposes. This bug is especially puzzling because the data returned is in the correct shape with the merged selection sets, yet it seems like the resolver is only returning incomplete data. Any insight on this issue would be greatly appreciated!

Here is a minimal reproducible example: https://gist.github.com/fireteam99/20be417e397a1672380e33b18164ec12.

  • Version: 3.1
  • Platform: MacOS/Linux

fireteam99 avatar Aug 08 '22 19:08 fireteam99