Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge selected fields in ResolveInfo::getFieldSelection() #1365

Merged
merged 2 commits into from
Apr 17, 2023

Conversation

jacor84
Copy link
Contributor

@jacor84 jacor84 commented Apr 17, 2023

Description

Folding a selection set in ResolveInfo needs to preserve all fields from a given type/level. Currently, there is a possibility to overwrite it with a new set of fields. See an example below, which is a new test case, where the sub-selection from the first level2 would be lost.

    query deepMerge {
      level1 {
        level2 { # used here
          scalar1
        }
        level2 { # and here
          scalar2
        }
        scalar1
        scalar2
      }
    }

The solution is to merge selected fields for FieldNode, which is done in the second commit.

Closes #1364

@spawnia spawnia changed the title Issue #1364: resolve info field selection Merge selected fields in ResolveInfo::getFieldSelection() Apr 17, 2023
@spawnia spawnia merged commit ab96306 into webonyx:master Apr 17, 2023
13 checks passed
@spawnia spawnia added the bug label Apr 17, 2023
@spawnia
Copy link
Collaborator

spawnia commented Apr 17, 2023

Thanks, released with https://github.com/webonyx/graphql-php/releases/tag/v15.2.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ResolveInfo::getFieldSelection() doesn't merge fields correctly in some specific cases
2 participants