wundergraph / cosmo

The open-source solution to building, maintaining, and collaborating on GraphQL Federation at Scale. The alternative to Apollo Studio and GraphOS.
https://cosmo-docs.wundergraph.com/
Apache License 2.0
735 stars 104 forks source link

Incorrect type deduction with interfaces #1094

Open prokop7 opened 2 months ago

prokop7 commented 2 months ago

Component(s)

router

Component version

v0.0.0-20240819092109-3eea9d8f5836

wgc version

0.58.7

controlplane version

4c8154f4ad9d98bd67a4aee1c8615acdb97de3e165cdac5a346ce7dcb484b9e4

router version

v0.0.0-20240819092109-3eea9d8f5836

What happened?

With given schema

type Query {
  objects: Object
}
interface Object {
  id: Int!
}

type Car implements Object {
  id: Int!
  content: CarContent!
}

type CarContent {
  name: String!
}

type Bike implements Object {
  id: Int!
  content: BikeContent!
}

type BikeContent {
  name: String!
}

the following query will fail with this exception differing types 'BikeContent!' and 'CarContent!' for objectName 'content'

query {
  objects {
    id
    ... on Car {
      id
      content {
        name
      }
    }
    ... on Bike {
      id
      content {
        name
      }
    }
  }
}

It is expected that this query will either execute smoothly or fail during the composition phase. On Apollo side this runs without exceptions

Environment information

Environment

K8S cluster golang:1.22.2 + distroless/static

Router configuration

No response

Router execution config

No response

Log output

No response

Additional context

No response

github-actions[bot] commented 2 months ago

WunderGraph commits fully to Open Source and we want to make sure that we can help you as fast as possible. The roadmap is driven by our customers and we have to prioritize issues that are important to them. You can influence the priority by becoming a customer. Please contact us here.

StarpTech commented 2 months ago

Hi @prokop7, thanks for the report! We will take a look and come back to you.