dotansimha / dotansimha/graphql-code-generator
Avoid optionals on fields influences variables
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 23
Description
**Describe the bug**
Even though `avoidOptionals.inputValue` is `false`, variable types are generated without optionals.
**To Reproduce**
1. My GraphQL schema:
```graphql
type Query {
a(filter: [A!]): String
}
```
2. My GraphQL operations:
```graphql
query a($filter: [A!]) {
a(filter: $filter)
}
```
3. My `codegen.yml` config file:
```yml
avoidOptionals:
field: true
object: true
```
```ts
export type AQueryVariables = Exact<{
filter: Maybe>;
}>;
```
https://codesandbox.io/s/stupefied-paper-vjrm1?file=/types.ts
**Expected behavior**
It's still part of my InputType so this is expected
```ts
export type AQueryVariables = Exact<{
filter?: Maybe>;
}>;
```
**Environment:**
- OS:
"@graphql-codegen/add": "^2.0.1",
"@graphql-codegen/cli": "^1.17.8",
"@graphql-codegen/fragment-matcher": "^1.17.8",
"@graphql-codegen/typescript": "^1.17.9",
"@graphql-codegen/typescript-operations": "^1.17.8",
"@graphql-codegen/typescript-react-apollo": "^2.0.6",
- NodeJS: 14
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.