dotansimha / dotansimha/graphql-code-generator

Consider making `futureProofEnums` the default?

Open
#10,878 0 comments 1 reaction 1 assignee Claimed by @eddeee888 View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

### Is your feature request related to a problem? Please describe.

In order to write [robust applications](https://github.com/graphql/graphql.github.io/pull/2434), it is important that application code handles unknown future values for enums.

### Describe the solution you'd like

Making `futureProofEnums` the default would force consumers to handle unknown cases, making them more robust to schema evolutions.

~~The current value is named `%future enum value` but I would recommend `__UNKNOWN` instead which feels a little bit more inline with the usual GraphQL conventions.~~

Edit: never mind, `__UNKNOWN` is not what we want. but maybe `%do not use this value, add a default case instead`?

Relay has [a linter rule to detect that all switches must also have a `default:` case](https://relay.dev/docs/getting-started/lint-rules/#relayno-future-added-value)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.