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

feat(presets/client): support `enumsAsConst` option #9981

Open azu opened 1 month ago

azu commented 1 month ago

Description

Add enumsAsConst to client presets.

Related

Edit:

This PR is duplicated of https://github.com/dotansimha/graphql-code-generator/pull/9574, but this includes a test.

Type of change

Please delete options that are not relevant.

Screenshots/Sandbox (if appropriate/relevant):

Add Unit Test

How Has This Been Tested?

Test Environment:

Checklist:

Further comments

client preset already support enumsAsType. I think that it should support enumsAsConst too.

changeset-bot[bot] commented 1 month ago

🦋 Changeset detected

Latest commit: 67ede7c531513dac6351be72b6f49e71a7f42a72

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ------------------------------ | ----- | | @graphql-codegen/client-preset | Patch |

Not sure what this means? Click here to learn what changesets are.

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

azu commented 1 month ago

Ah, I notice that this PR is duplicated of https://github.com/dotansimha/graphql-code-generator/pull/9574, but this PR includes a test.

azu commented 1 month ago

@n1ru4l Thanks. I've added enumsAsConst to website/src/pages/plugins/presets/preset-client.mdx https://github.com/dotansimha/graphql-code-generator/pull/9981/commits/c9a3511c6b5ce8f58b6740a3daafede5c4c9d22f