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

validate field merging when multiple sub-selections partially overlap #819

Closed
lrlna opened this issue Jan 31, 2024 · 0 comments · Fixed by #816
Closed

validate field merging when multiple sub-selections partially overlap #819

lrlna opened this issue Jan 31, 2024 · 0 comments · Fixed by #816
Assignees
Labels
apollo-compiler issues/PRs pertaining to semantic analysis & validation

Comments

@lrlna
Copy link
Member

lrlna commented Jan 31, 2024

copying from #816:

Current situation

This is an offending query:

{
  root { ... on A { unrelated } }
  root { ... on B { overlapping } }
  root { ... on C { overlapping } }
}

Here, assume B.overlapping selects an Int!, and C.overlapping selects an Int. Clearly root.overlapping can either be Int! or Int, and so this must be an error. But previous versions of apollo-compiler do not report anything.

Cause

The validation is implemented by drilling in from the top down. The first field it encounters is root. root is selected multiple times so we need to see if its subselections can merge. In main, we do this by comparing every subselection to the first subselection (... on A { unrelated }). Both the B and C subselections can be merged with A, as they don't select any conflicting fields.

@lrlna lrlna added the apollo-compiler issues/PRs pertaining to semantic analysis & validation label Jan 31, 2024
@lrlna lrlna added this to the QP Preview (Release 1) milestone Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apollo-compiler issues/PRs pertaining to semantic analysis & validation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants