dotansimha / dotansimha/graphql-code-generator

[RFC] Automate enumValues generation

Open
#3,623 3 comments 0 reactions 0 assignees View on GitHub
core kind/enhancement plugins
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

When dealing with SQL databases most of the times the enums will store simply integer values, like:
```ts
enum Sex {
Male = 0,
Female = 1
}
```
Having to specify the following for each of them could be annoying:
```ts
enumValues:
Sex:
MALE: 0
FEMALE: 1
```

It would be nice to have a way to specify defaults other than the name of the value.

Something like:
```ts
enumDefaultValues: to-integer#toInteger
```
which would be obviously overridden by `enumValues` itself.

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.