dotansimha / dotansimha/graphql-code-generator

enumValues don't work well with typesPrefix

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

Description

**Describe the bug**

When specifying `typesPrefix` I cannot use `enumValues` to declare the values for my enum.

**To Reproduce**
Steps to reproduce the behavior: See sandbox https://codesandbox.io/s/musing-bouman-lsgqt?file=/codegen.yml

**Expected behavior**

When I use `enumValues` in conjunction with `typesPrefix` I can only define the `enumValue` for the enum before prefixing.

The prefixed enum value cannot be defined because I suppose the tool has no knowledge of it at the time of running the enumValues command.

If I try to define

```enumValues:
GraphqlFoobar: ./index#Foobar
```

instead it breaks because `GraphqlFoobar` is nowhere to be found in my schema (rightfully so, because it's prefixed after the generation).

`enumValues`'s result should use the prexixes/suffixes properly so those options combine well together.

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.