Graphql-code-generator: immutableTypes: Add more options in setting, i.e. exclude *Input types

Created on 30 Apr 2019  路  4Comments  路  Source: dotansimha/graphql-code-generator

I would like to be able to exclude *Input types from being immutable.
I like to be able to use the immutableTypes feature, as I think most of the types there should be treated as immutables.
However, I want to be able to gradually build the input objects, so I want to exclude those.

A solution could be being able to configure:

  • immutableTypes: allExceptInputs
enhancement plugins

All 4 comments

Hi @yoavain-sundaysky ! Thank you for reporting this issue.
You are right, at the moment the immutable configuration can only be turned on/off and is not configurable.
We can give it a try in the future and add it (And we always welcome PRs).

may be an option to just have the results from queries and mutations to be immutable instead of the types themself would be a nice option as well.

Woudnt it be better to be able to override all options based on some name or type pattern. Something like.

generates:
path/to/file.ts:
 plugins:
   - typescript
   - typescript-operations
 config:
   avoidOptionals: true
   immutableTypes: true
 configByKind:
   input: 
     immutableTypes: false
 configByName:
   *Input: 
     avoidOptionals: false

This would allow to customize the generation a lot.

@lanwin this sounds like a nice idea, but I worry that it might make the implementation much more complex than today.
Do you have more uses cases that it can enhance? maybe you can open an issue for this with examples?
Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mszczepanczyk picture mszczepanczyk  路  3Comments

steebchen picture steebchen  路  3Comments

edorivai picture edorivai  路  3Comments

dotansimha picture dotansimha  路  3Comments

quolpr picture quolpr  路  3Comments