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.72k stars 1.31k forks source link

test(client-preset): custom suffix with `namingConvention` #10013

Open hecticme opened 2 weeks ago

hecticme commented 2 weeks ago

Description

When handling anonymous operation name, BaseDocumentsVisitor calls the convertName() method twice. This leads to duplicated suffix if a user provide a custom namingConvention function.

Related #10012

Type of change

Screenshots/Sandbox (if appropriate/relevant):

https://stackblitz.com/edit/gql-codgen-13f1zd

image

How Has This Been Tested?

I have described the problem in the related issue. The test added in this PR will reflect that.

Test Environment:

Checklist:

Further comments

The main problem that I want to address is that the operation name does not match with itself inside Typed Document Node.

changeset-bot[bot] commented 2 weeks ago

⚠️ No Changeset found

Latest commit: 96c266714abe4680f5b6d67da7d60fb494666830

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR