homebound-team / graphql-typescript-factories

TypeScript test builders/factories for GraphQL schemas

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generate factories for fragments that use aliases

stephenh opened this issue · comments

Currently, all of our factories are generated for a given object type, with the assumption that any fragments/queries that use an object type will need a subset of the fields, so the object type, being the superset of fields, will always be able to fulfill any given fragment/query.

However, this assumption doesn't hold true for fragments that use aliases.

We've happened to fix this for the top-level response of queries in our sister library:

homebound-team/graphql-typescript-response-factories#20

But it'd be good to handle it for non-top-level fragments as well.

We could potentially detect fragments that use aliases, and then for those fragments generate special newMyFragment types, that used the aliased names.