ardeois / graphql-codegen-typescript-mock-data

[GraphQL Codegen Plugin](https://github.com/dotansimha/graphql-code-generator) for building mock data based on the schema.
MIT License
133 stars 47 forks source link

Mocking Gql Fragments #38

Closed andreialecu closed 2 years ago

andreialecu commented 3 years ago

Hey! Just found this library and it's looking great!

One minor issue we're having is that we use gql fragments extensively, and the props we pass to our react components are of the Fragment type (eg. UserFragment).

It seems like the generator doesn't mock fragments currently, so we need to use the full type - which results in some TS errors unless an assertion is added (aUser(...) as UserFragment).

Would mocking fragments be possible via a config flag?

ardeois commented 3 years ago

Hey @andreialecu, thanks for the interest on this library.

That's a good point we actually have a similar issue in our code at my company. However I don't have time to improve the lib right now, but PRs are welcomed !

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.