dotansimha / dotansimha/graphql-code-generator
in flow plugin, namingConvention not respected when used in combination with enumValues
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 23
Description
**Describe the bug**
If `enumValues` are specified then the generated output doesn't respect the `namingConvention`.
See the `codegen.yml` file below, as an example of trying to do upper-case with some `enumValues` specified. It leads to correct enum values:
```
export const STYLEENUMVALUES = Object.freeze({
DEFAULT: 'default',
MINIMAL: 'minimal',
})
export type STYLEENUM = $Values
```
but when referenced it's not following the `namingConvention`:
```
export type SOMETYPE = {|
__typename?: 'OrganizationBranding',
...
style?: ?StyleEnum,
...
|}
```
(notice `StyleEnum` isn't all caps, this leads to a Flow error)
**To Reproduce**
Steps to reproduce the behavior:
https://codesandbox.io/s/sad-pond-rtlx8
1. My GraphQL schema:
```graphql
enum StyleEnum {
DEFAULT
MINIMAL
}
```
2. My `codegen.yml` config file:
```yml
overwrite: true
schema:
- './src/data/schema/*.js'
generates:
src/app/autogenerated_types_and_enums.js:
config:
namingConvention: upper-case#upperCase
enumValues:
StyleEnum:
DEFAULT: 'default'
MINIMAL: 'minimal'
plugins:
- 'flow'
- 'flow-resolvers'
```
**Expected behavior**
should respect `namingConvention` for enums.
**Environment:**
- OS: macOS 10.15
- `@graphql-codegen/...`: 1.12.2
- NodeJS: 13.8.0
**Additional Context:**
seems similar to https://github.com/dotansimha/graphql-code-generator/pull/3015 but not entirely sure about that.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.