cosmo icon indicating copy to clipboard operation
cosmo copied to clipboard

Incorrect type deduction with interfaces

Open prokop7 opened this issue 1 year ago • 2 comments
trafficstars

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

prokop7 avatar Aug 19 '24 10:08 prokop7

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.

github-actions[bot] avatar Aug 19 '24 10:08 github-actions[bot]

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

StarpTech avatar Aug 20 '24 09:08 StarpTech

Hi @prokop7

We can't reproduce it with the latest version

devsergiy avatar Jul 08 '25 13:07 devsergiy