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

Overlapping fields can be merged - error with types #1032

Open
jBosak98 opened this issue Jan 16, 2025 · 0 comments
Open

Overlapping fields can be merged - error with types #1032

jBosak98 opened this issue Jan 16, 2025 · 0 comments

Comments

@jBosak98
Copy link

Hello, I'm trying to validate a query using wundergraph tools. I have a problem with the validation rule FieldSelectionMerging.
I have a very big graphql schema, but in order to show you the example, I will use only a small piece of it:

interface Animal {
  id: ID!
}
interface DetachedHouse {
  id: ID!
}
interface Flat {
  id: ID!
}
type Dog implements Animal {
  id: ID!
  home: DetachedHouse!
}
type Cat implements Animal {
  id: ID!
  home: Flat!
}
type AdoptedLocation implements Flat & DetachedHouse {
  id: ID!
  address: String!
}
type Query {
  animals: [Animal]
}

With this schema, the query I want to run is:

}
query getAnimals{
  animals {
    ... on Dog {
      home {
        ... on AdoptedLocation {
          id
          address
        }
      }
    }
    ... on Cat {
      home {
        ... on AdoptedLocation {
          id
          address
        }
      }
    }
  }
}

The response of the validation with the FieldSelectionMerging rule is error differing types 'DetachedHouse!' and 'Flat!' for objectName 'home'
In fact, the query is an example of mixin/diamond. From my point of view, there should be no errors here.

Reference implementation: link
Reference tests ported from js code: link

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

No branches or pull requests

1 participant