microsoft / graphitation

GraphQL tooling & runtime support needed for MS Teams and beyond
https://microsoft.github.io/graphitation/
MIT License
141 stars 36 forks source link

Mock resolvers ignore abstract types #427

Open ling1726 opened 3 months ago

ling1726 commented 3 months ago

Repro with instructions and comparison with the relay mock payload generator: https://github.com/ling1726/graphitation-payload-generator-repro

When abstract types are used with the payload generator for @graphitation/graphql-js-operation-payload-generator - they are ignored in favour of concrete types. This makes it hard to create mocks for queries that involve abstract interfaces and polymorphism

alloy commented 3 months ago

To elaborate, the issue is that when we have mocks for interfaces, but the executor is following schema that is referring to concrete types, those interface mocks never get used. For each concrete type, we should check if there are mocks for any of the interfaces that the type implements.