0no-co / gql.tada

🪄 Magical GraphQL query engine for TypeScript
https://gql-tada.0no.co
MIT License
2.52k stars 41 forks source link

What if I don't want "fragment masking"? #90

Closed aradalvand closed 6 months ago

aradalvand commented 6 months ago

I come from a GraphQL Code Generator background, and it's the first time I'm being confronted with the so-called "fragment masking" thing.

It's strange to me that there is no option to disable this "feature", I understand the reasoning behind it but not everyone wants to structure their application the way fragment masking assumes. It's ugly IMO, it requires you to add dummy function calls readFragment(TheActualFragment, theProp), which could've just been avoided altogether. Especially in frameworks like Svelte, this kind of plumbing would look awkward.

Please consider adding a global option (possibly in tsconfig.json) that allows the developer to decide whether they want this behavior or not. It makes no sense to force it upon everyone.

JoviDeCroock commented 6 months ago

Then you can either use @_unmask or in our canary we have an option on the generic to turn it off entirely

aradalvand commented 6 months ago

in our canary we have an option on the generic to turn it off entirely

Good to hear, could you please point me to the PR/piece of code that adds that option (if there's no documentation on it yet)?

JoviDeCroock commented 6 months ago

It's on our docs https://gql-tada.0no.co/guides/fragment-colocation/#fragment-colocation and on canary https://github.com/0no-co/gql.tada/blob/main/src/api.ts#L41

aradalvand commented 6 months ago

Got it, thanks. Any time frame for when the next version will be released?