dotansimha / dotansimha/graphql-code-generator

Docs for oneOfInputUnion: true

Open
#10,472 1 comment 0 reactions 1 assignee Claimed by @eddeee888 View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

### Is your feature request related to a problem? Please describe.

I've observed that `oneOfInputUnion: true` will change the code that gets generated.

```graphql
input YinOrYangInput @oneOf {
yin: YinConfig
yang: YangConfig
}
```

If you have this GraphQL schema, ordinarily you'll get the TS version:

```ts
export type YinOrYangInput = {
yin?: Maybe;
yang?: Maybe;
}
```

🔍👻 But if you add this mysterious `oneOfInputUnion: true` config, then the generated output changes to a union type:

```ts
export type YinOrYangInput =
| { yin: YinConfig, yang?: never }
| { yin?: never, yang: YangConfig }
```

### Describe the solution you'd like

From what I can tell, documentation for this config option is non-existent.

### Describe alternatives you've considered

_No response_

### Any additional important details?

_No response_

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.