We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Regarding the following:
blog-portfolio/src/pages/posts/persisted-operations/index.mdx
Lines 204 to 206 in 46a9f2d
It would be nice to add the following tod document it 😇
import { Kind, visit } from 'graphql'; import { Types } from '@graphql-codegen/plugin-helpers'; export const addTypenameDocumentTransform: Types.DocumentTransformObject = { transform({ documents }) { return documents.map(document => ({ ...document, document: document.document ? visit(document.document, { SelectionSet(node) { if ( !node.selections.find( selection => selection.kind === 'Field' && selection.name.value === '__typename', ) ) { return { ...node, selections: [ { kind: Kind.FIELD, name: { kind: Kind.NAME, value: '__typename', }, }, ...node.selections, ], }; } }, }) : undefined, })); }, };
import { addTypenameDocumentTransform } from './configs/graphql-code-generator/add-typename-document-transform.mjs'; import { CodegenConfig } from "@graphql-codegen/cli"; const config: CodegenConfig = { schema: "YOUR_GRAPHQL_ENDPOINT", documents: ["./**/*.{ts,tsx}"], ignoreNoDocuments: true, generates: { "./gql/": { preset: "client", plugins: [], presetConfig: { persistedDocuments: true, }, documentTransforms: [addTypenameDocumentTransform], }, }, }; export default config;
The text was updated successfully, but these errors were encountered:
Oh awesome, thanks! I will add it in a gist and link to it from that paragraph
Sorry, something went wrong.
We will also add this document transform to the client preset and document it on the codegen website.
dotansimha/graphql-code-generator#9562
No branches or pull requests
Regarding the following:
blog-portfolio/src/pages/posts/persisted-operations/index.mdx
Lines 204 to 206 in 46a9f2d
It would be nice to add the following tod document it 😇
The text was updated successfully, but these errors were encountered: