microsoft / graphitation

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

Mock resolvers ignore abstract types #427

Open ling1726 opened 1 month ago

ling1726 commented 1 month 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 1 month 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.