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
Subscription "NameOfSubscription" must select only one top level field when using addTypenameSelectionDocumentTransform and generating code for subscription
#9888
Open
Sojaner opened this issue
Feb 29, 2024
· 0 comments
The __typename should not be added to the root node of a subscription when using addTypenameSelectionDocumentTransform with documentTransforms since a single root node is expected and the code generator fails because of that
yarn generate(Test without the addTypenameSelectionDocumentTransform - Works fine)
yarn generate --add-typenames(Test with the addTypenameSelectionDocumentTransform - This will fail)
yarn generate --add-fixed-typenames(Test with the patchedaddTypenameSelectionDocumentTransform - Works fine)
Expected behavior
Generating types from all types of documents should work when using the addTypenameSelectionDocumentTransform document transformer, but currently, the subscription types will cause an error and fail the code generation.
Which packages are impacted by your issue?
@graphql-codegen/client-preset
Describe the bug
The
__typename
should not be added to the root node of a subscription when usingaddTypenameSelectionDocumentTransform
withdocumentTransforms
since a single root node is expected and the code generator fails because of thatYour Example Website or App
https://github.com/Sojaner/graphql-code-generator-issue-sandbox-template
Steps to Reproduce the Bug or Issue
yarn generate
(Test without theaddTypenameSelectionDocumentTransform
- Works fine)yarn generate --add-typenames
(Test with theaddTypenameSelectionDocumentTransform
- This will fail)yarn generate --add-fixed-typenames
(Test with the patchedaddTypenameSelectionDocumentTransform
- Works fine)Expected behavior
Generating types from all types of documents should work when using the
addTypenameSelectionDocumentTransform
document transformer, but currently, the subscription types will cause an error and fail the code generation.Platform
graphql
version: N/A@graphql-codegen/client-preset
version: 4.2.4Codegen Config File
The text was updated successfully, but these errors were encountered: