Set this configuration to true if you wish to make sure to remove duplicate operation name suffix.
Optional documentMode
documentMode:DocumentMode
default
graphQLTag
description
Declares how DocumentNode are created:
graphQLTag: graphql-tag or other modules (check gqlImport) will be used to generate document nodes. If this is used, document nodes are generated on client side i.e. the module used to generate this will be shipped to the client
documentNode: document nodes will be generated as objects when we generate the templates.
documentNodeImportFragments: Similar to documentNode except it imports external fragments instead of embedding them.
external: document nodes are imported from an external file. To be used with importDocumentNodeExternallyFrom
Optional documentNodeImport
documentNodeImport:string
default
graphql#DocumentNode
description
Customize from which module will DocumentNode be imported from.
This is useful if you want to use modules other than graphql, e.g. @graphql-typed-document-node.
Optional documentVariablePrefix
documentVariablePrefix:string
default
""
description
Changes the GraphQL operations variables prefix.
Optional documentVariableSuffix
documentVariableSuffix:string
default
Document
description
Changes the GraphQL operations variables suffix.
Optional fragmentVariablePrefix
fragmentVariablePrefix:string
default
""
description
Changes the GraphQL fragments variables prefix.
Optional fragmentVariableSuffix
fragmentVariableSuffix:string
default
FragmentDoc
description
Changes the GraphQL fragments variables suffix.
Optional gqlImport
gqlImport:string
default
graphql-tag#gql
description
Customize from which module will gql be imported from.
This is useful if you want to use modules other than graphql-tag, e.g. graphql.macro.
This config should be used if documentMode is external. This has 2 usage:
any string: This would be the path to import document nodes from. This can be used if we want to manually create the document nodes e.g. Use graphql-tag in a separate file and export the generated document
'near-operation-file': This is a special mode that is intended to be used with near-operation-file preset to import document nodes from those files. If these files are .graphql files, we make use of webpack loader.
This config is used internally by presets, but you can use it manually to tell codegen to prefix all base types that it's using.
This is useful if you wish to generate base types from typescript-operations plugin into a different file, and import it from there.
Optional namingConvention
namingConvention:NamingConvention
default
pascal-case#pascalCase
description
Allow you to override the naming convention of the output.
You can either override all namings, or specify an object with specific custom naming convention per output.
The format of the converter must be a valid module#method.
Allowed values for specific output are: typeNames, enumValues.
You can also use "keep" to keep all GraphQL names as-is.
Additionally you can set transformUnderscore to true if you want to override the default behavior,
which is to preserves underscores.
Set this configuration to true if you wish to tell codegen to generate code with no export identifier.
Optional noGraphQLTag
noGraphQLTag:boolean
description
Deprecated. Changes the documentMode to documentNode.
default
false
Optional nonOptionalTypename
nonOptionalTypename:boolean
default
false
description
Automatically adds __typename field to the generated types, even when they are not specified
in the selection set, and makes it non-optional
examplemarkdown
config:nonOptionalTypename:true
Optional omitOperationSuffix
omitOperationSuffix:boolean
default
false
description
Set this configuration to true if you wish to disable auto add suffix of operation name, like Query, Mutation, Subscription, Fragment.
Optional operationResultSuffix
operationResultSuffix:string
default
""
description
Adds a suffix to generated operation result type names
Optional pureMagicComment
pureMagicComment:boolean
default
false
description
This config adds PURE magic comment to the static variables to enforce treeshaking for your bundler.
Optional rawRequest
rawRequest:boolean
description
By default the request method return the data or errors key from the response. If you need to access the extensions key you can use the rawRequest method.
Extends or overrides the built-in scalars and custom GraphQL scalars to a custom type.
examplemarkdown
config:scalars:DateTime:DateJSON:"{ [key: string]: any }"
Optional skipTypename
skipTypename:boolean
default
false
description
Does not add __typename to the generated types, unless it was specified in the selection set.
examplemarkdown
config:skipTypename:true
Optional typesPrefix
typesPrefix:string
default
""
description
Prefixes all the generated types.
examplemarkdown
config:typesPrefix:I
Optional typesSuffix
typesSuffix:string
default
""
description
Suffixes all the generated types.
examplemarkdown
config:typesSuffix:I
Optional useTypeImports
useTypeImports:boolean
name
useTypeImports
default
false
description
Will use import type {} rather than import {} when importing only types. This gives
compatibility with TypeScript's "importsNotUsedAsValues": "error" option
This plugin generates
graphql-request
ready-to-use SDK, which is fully-typed.