-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keep fields specified by @unmask
for use with Apollo Client data masking
#10163
Keep fields specified by @unmask
for use with Apollo Client data masking
#10163
Conversation
🦋 Changeset detectedLatest commit: 5035012 The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@unmask
for use with Apollo Client data masking
if (!selectionNode.fragmentDirectives?.some(d => d.name.value === 'unmask')) { | ||
continue; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What should happen if inlineFragmentTypes='combine'
is used with @unmask
?
Should we just target the 'mask'
scenario in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I think so. mask
is the only one that removes fields from generated type correct?
I can probably be a bit more explicit here if need be that this should only be combined with unmask
.
Should we update the doc for graphql-code-generator/packages/plugins/other/visitor-plugin-common/src/base-visitor.ts Lines 362 to 365 in 1bed87b
|
Could you please run |
Yes definitely! I'll add that change as well. |
* }; | ||
* export default config; | ||
*/ | ||
customDirectives?: CustomDirectivesConfig; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the new config option to enable the new apolloUnmask
directive. Let me know if there is a better place for these.
@eddeee888 apologies for taking so long to get back to this! I'm finally back from all my conference travel and vacation. This should be ready to go on my end so please let me know if anything else needs tweaked. I'm holding off on the support for Looking forward to landing this sometime soon! |
Hi @jerelmiller , could you help fix this prettier issue? https://github.com/dotansimha/graphql-code-generator/actions/runs/11671752015/job/32751535165?pr=10163#step:4:11 We are very close to done, thank you for pushing it forward! |
@eddeee888 got the prettier issue fixed in 5035012. I think that should be the last thing missing. Thanks for reviewing! Looking forward to having this in there 🙂 |
Description
Provide support for
@unmask
withinlineFragmentTypes: "mask"
so that these fields are available in the TypeScript type. This provides compatibility with Apollo Client's data masking feature that will be released in the upcoming 3.12 release.Related #10162
Related apollographql/apollo-client#12085
Type of change
Please delete options that are not relevant.
expected)
Screenshots/Sandbox (if appropriate/relevant):
See the data masking RFC for more details on the feature in Apollo Client.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Environment:
@graphql-codegen/...
:Checklist:
Further comments
I'm opening this as a draft to discuss the idea with the maintainers. This is a continuation of our conversation in Slack 🙂.