hasura / hasura/graphql-engine
Using graphql-codegen creates two duplicate "export enum OrderBy".
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Version Information
Server Version:
v2.37.0
### Environment
Hasura Cloud
### What is the current behaviour?
Using graphql-codegen creates two duplicate "export enum OrderBy".
```generated.ts
.
.
/** column ordering options */
export enum OrderBy {
/** in ascending order, nulls last */
ASC = 'ASC',
/** in ascending order, nulls first */
ASC_NULLS_FIRST = 'ASC_NULLS_FIRST',
/** in ascending order, nulls last */
ASC_NULLS_LAST = 'ASC_NULLS_LAST',
/** in descending order, nulls first */
DESC = 'DESC',
/** in descending order, nulls first */
DESC_NULLS_FIRST = 'DESC_NULLS_FIRST',
/** in descending order, nulls last */
DESC_NULLS_LAST = 'DESC_NULLS_LAST'
}
.
.
.
/** column ordering options */
export enum OrderBy {
/** in ascending order, nulls first */
ASC = 'asc',
/** in ascending order, nulls first */
ASC_NULLS_FIRST = 'asc_nulls_first',
/** in ascending order, nulls last */
ASC_NULLS_LAST = 'asc_nulls_last',
/** in descending order, nulls last */
DESC = 'desc',
/** in descending order, nulls first */
DESC_NULLS_FIRST = 'desc_nulls_first',
/** in descending order, nulls last */
DESC_NULLS_LAST = 'desc_nulls_last'
}
.
........
```
So, when I run "yarn build", I get the following error.
```
Type error: Duplicate identifier 'ASC'.
```
### What is the expected behaviour?
I want only one "export enum OrderBy" to be created when using graphql-codegen.
### How to reproduce the issue?
1. Connect two databases to Hasura (im my case, Postgres and BigQuery).
2. Creating types from Schema using graphql-codegen.
### Keywords
Duplicate order-by, graphql-codegen
Contributor guide
Research direction
Start by reproducing graphql-codegen after connecting Postgres and BigQuery, then run yarn build against the generated.ts output. Trace where the two OrderBy enums are generated from the combined schema. Done means only one OrderBy enum is emitted and the build no longer reports duplicate identifiers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100