dotansimha / dotansimha/graphql-code-generator

Documentation on specific options for avoidOptionals

Open
#7,487 4 comments 4 reactions 0 assignees View on GitHub
core kind/question
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

I've been looking into the [docs](https://www.graphql-code-generator.com/plugins/typescript) on the `avoidOptionals` config option and have found it difficult to understand the exact meaning of each of the sub-options when providing a `AvoidOptionalsConfig` object ([defined here](https://github.com/dotansimha/graphql-code-generator/blob/c8ef37ae03021f2f8409fbff44313bdbe9e699c1/packages/plugins/other/visitor-plugin-common/src/types.ts#L93)) as the value.

Here's how I understand the options:

- `field`: Field of a type (using the GraphQL `type` declaration).
- `inputValue`: Fields on a GraphQL `input` type. Though I did have to double check that this did not refer to variable inputs for queries/mutations.
- `object`: No idea.
- `defaultValue`: I think this would be when setting a default value for a query/mutation. Not sure, but also I haven't used a default value on a query/mutation in my codebase.
- `resolvers`: (Not listed in docs) I think referring to client-side resolvers. Really not sure, but haven't used those in my codebase either.

Can someone who knows add docs about what each of these fields do? Thank you!

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.