apollo-tooling icon indicating copy to clipboard operation
apollo-tooling copied to clipboard

Codegen should throw error on duplicate fragment names

Open glentakahashi opened this issue 6 years ago • 3 comments

Intended outcome:

apollo client:codegen should throw an error if two fragments are named the same, similar to how it already does this for mutations + queries.

Actual outcome:

The last fragment for a given name will overwrite all the other ones.

How to reproduce the issue:

Repro here: https://github.com/glentakahashi/apollo-codegen-fragment-test

yarn gql creates graphql.d.ts without throwing an error which has only the fragment from b.ts, which has overwritten a.ts

Versions

2.21.1

glentakahashi avatar Dec 06 '19 18:12 glentakahashi

Potential fix here: https://github.com/apollographql/apollo-tooling/pull/1707

glentakahashi avatar Dec 06 '19 19:12 glentakahashi

I see that the PR for the fix has been closed. I was wondering what the reasoning behind this is, as I'm running into this issue as well in my project.

B1rch avatar Dec 15 '21 14:12 B1rch

the PR had been open for > 2 years and the team didn't seem to be getting around to it. We've moved onto a different tool, so you're welcome to re-open a new PR with my changes to try and get it merged again

glentakahashi avatar Dec 15 '21 17:12 glentakahashi