You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In @graphql-codegen/typescript-operations version 4.4.0, support for the @unmask directive from Apollo's data masking was added. This requires settings inlineFragmentTypes: "mask" and customDirectives: { apolloUnmask: true } in the config, and seems to work as expected. However, @graphql-codegen/client-preset (version 4.5.1) does not seem to support this. Apollo's docs suggest to set customDirectives in presetConfig, but neither config nor presetConfig seems to work for this combination.
Notice that this includes other fields that are present in the PostFragment fragment in the example code
I guess the current behavior is in one way be expected given that customDirectives is not one of the options forwarded by client-preset. However, I think it would be desired for the client-preset to support customDirectives, and it does indeed work if I add customDirectives to forwardedConfig in the preset code.
With the following config (slightly different from Apollo's doc):
presetConfig: { fragmentMasking: false },
config: {
inlineFragmentTypes: 'mask',
customDirectives: { apolloUnmask: true }, // this is in `config`, instead of `presetConfig` like the doc
},
Which packages are impacted by your issue?
@graphql-codegen/client-preset
Describe the bug
In
@graphql-codegen/typescript-operations
version 4.4.0, support for the@unmask
directive from Apollo's data masking was added. This requires settingsinlineFragmentTypes: "mask"
andcustomDirectives: { apolloUnmask: true }
in the config, and seems to work as expected. However,@graphql-codegen/client-preset
(version 4.5.1) does not seem to support this. Apollo's docs suggest to setcustomDirectives
inpresetConfig
, but neither config nor presetConfig seems to work for this combination.Your Example Website or App
https://stackblitz.com/edit/16patsle-codegen-apollo-unmask
Steps to Reproduce the Bug or Issue
@unmask
@unmask
directiveExpected behavior
I would expect the
@unmask
directive to work and give output similar to this:Notice that this includes other fields that are present in the PostFragment fragment in the example code
I guess the current behavior is in one way be expected given that
customDirectives
is not one of the options forwarded by client-preset. However, I think it would be desired for the client-preset to support customDirectives, and it does indeed work if I add customDirectives toforwardedConfig
in the preset code.Screenshots or Videos
No response
Platform
graphql
version: 16.10.0@graphql-codegen/*
version(s):@graphql-codegen/[email protected]
,@graphql-codegen/[email protected]
,@graphql-typed-document-node/[email protected]
Codegen Config File
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: