[client-preset] allowed options and defaults
See original GitHub issueThis issue is the place to discuss allowed options and default values when using the preset: 'client'
setup.
Currently supported options
scalars
strictScalars
namingConvention
useTypeImports
skipTypename
enumsAsTypes
arrayInputCoercion
presetConfig.fragmentMasking
presetConfig.gqlTagName
presetConfig.unmaskFunctionName
emitLegacyCommonJSImports
Requested options support
nonOptionalTypename
(https://github.com/dotansimha/graphql-code-generator/issues/8296#issuecomment-1287010974)immutableTypes
(https://github.com/dotansimha/graphql-code-generator/issues/8296#issuecomment-1287010974)
Current defaults
presetConfig.fragmentMasking: true
inlineFragmentTypes: true
(if fragment masking is enabled)emitLegacyCommonJSImports: true
Requested defaults
ignoreNoDocuments: true
(@charlypoly)- should
presetConfig.fragmentMasking
befalse
by default? (@charlypoly) dedupeFragments: true
(https://github.com/dotansimha/graphql-code-generator/issues/8103#issuecomment-1298692748)enumsAsTypes: true
(@n1ru4l)
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:17
Top Results From Across the Web
client-preset - GraphQL Code Generator
The client preset allows the following config options: scalars : Extends or overrides the built-in scalars and custom GraphQL scalars to a ...
Read more >MacOS Client: change default ClientSettings ... - TechNet - Microsoft
in 10.3.3 user defaults were set to disable clipboard, mic, smartcard, camera, and folder redirection. Is it possible to change any of these...
Read more >Core Model / Components - Spring
clientSettings : The custom settings for the client – for example, require PKCE, require authorization consent, and others. 12, tokenSettings : ...
Read more >Configuring Client Settings
Configuring Client Settings. By default, all clients share the same configuration (default configuration according to Configuring LDAP Sync).
Read more >Client Settings - Shrew Soft VPN Client Administrators Guide
The Firewall Options settings are used to define what features will be enabled to prevent problems from occurring when a Firewall or NAT...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ShravanSunder I agree with all your proposals - except
maybeValue: 'T | undefined | null',
. The maybe/value for nullable fields should beT | null
- it can never beundefined
.nonOptionalTypename
is dangerous IMHO - It allows the wrong configuration.E.g. the correct type for
is
not
or
However, GraphQL clients such as apollo and urql ADD
__typename
selections to the documents before sending them to the GraphQL server. I am unsure whether I like this behavior. But if you look at this it makes sense why the defaults are like they are today.Having that said, for me, the following makes the most sense:
__typename
is OMITTED from the generated types by default.Adding the
__typename
property to the generated type via a configuration option by default, either as optional or mandatory - is something I would ideally try to avoid - but I can also see why people don’t want to explicitly clutter their GraphQL Operation documents with__typename
selections.In order to make the apollo/urql users happy this means we will kind of need an
automaticallyAddTypenameSelection
configuration.This is a potential proposal that groups the configuration under one object property:
I don’t event think we need to allow adding
__typename
properties as optional - it should either be non-optional or not at all present.Curious to hear the use-cases of having
__typename?: "User"
.