dotansimha / graphql-code-generator

A tool for generating code based on a GraphQL schema and GraphQL operations (query/mutation/subscription), with flexible support for custom plugins.
https://the-guild.dev/graphql/codegen/
MIT License
10.78k stars 1.31k forks source link

The code generator does not take into account naming conflicts #8751

Open TobinXu opened 1 year ago

TobinXu commented 1 year ago

Which packages are impacted by your issue?

@graphql-codegen/cli, @graphql-codegen/typescript-operations

Describe the bug

There are some examples : type VenuePlan { groundPeriods(ground: ID!):[VenuePeriod!]! } type VenuePlanGround { Periods(date: Time!):[VenuePeriod!]! } and when i run code generating in front-end side, there is the error: image image

Your Example Website or App

none

Steps to Reproduce the Bug or Issue

when run graphql-codegen to produce code, it has produced the same name type.

Expected behavior

The code generator needs to take into account naming conflicts

Screenshots or Videos

image image

Platform

"@graphql-codegen/cli": "^1.21.5", "@graphql-codegen/schema-ast": "^1.18.3", "@graphql-codegen/typescript": "^1.22.1", "@graphql-codegen/typescript-graphql-request": "^3.2.1", "@graphql-codegen/typescript-operations": "^1.18.0",

Codegen Config File

generates: ./scripts/api/integration.ts: documents: './operations/documents/integration/*.graphql' schema: ./operations/schema/integration.graphql plugins:

Additional context

No response

xiaoniao000 commented 1 year ago

I have encountered the same problem. I hope the author will deal with it as soon as possible.

amandeepnetweb commented 1 year ago

@xiaoniao000 @TobinXu Getting same issue, Can you tell if you found any solution to escape this issue?

image