Skip to content

Codegen doesn't fail when identical operations are present in multiple files #10517

@ankitprahladsoni

Description

@ankitprahladsoni

Which packages are impacted by your issue?

@graphql-codegen/core

Describe the bug

Codegen doesn't throw any error if identical operations are present in different files

Your Example Website or App

https://codesandbox.io/p/devbox/zealous-leakey-cwjm77

Steps to Reproduce the Bug or Issue

  1. Clone https://codesandbox.io/p/devbox/zealous-leakey-cwjm77
  2. run yarn codegen

Expected behavior

Expected to see Not all operations have an unique name: user: error

Screenshots or Videos

No response

Platform

  • OS: any
  • NodeJS: ^22
  • graphql version: ^16
  • @graphql-codegen/* version(s): ^4

Codegen Config File

No response

Additional context

We do see the error when, in any of the file, we add a new field or remove a field, marking these operations as not identical.
I think this can cause problems for a huge team if everyone is adding an identical operation in their own files, and suddenly adding another field breaks the codegen. IMO, the codegen should have failed the moment same name operations were introduced, and it should have forced devs to create a common gql file.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions