-
Notifications
You must be signed in to change notification settings - Fork 749
Description
Use case
Extensible enums has been accepted and would make a great addition to the codegen options.
Currently you have to dance around either:
switching directly on the GraphQLEnum, which requires a default case
unwrapping directly the enum and exhaustively checking
When the enum changes in the schema, the first option provides no warning that your code has a new case to consider; the latter breaks the code entirely. Neither are great options.
This attribute is explicitly for the use case of public API that may be extended later, and provides the same behavior as non frozen enums in Library Evolution-enabled modules (which are very much a niche).
The end result would be that all gql enums could be switched over directly (you could drop the GraphQLEnum type, eventually) and would require an @unknown default case. Furthermore, you would receive a compiler warning when you had not handled a new case.
Describe the solution you'd like
No response