C#
This plugin generates C# class
identifier for your schema types.
Installation
Using yarn
API Reference
enumValues
type: EnumValuesMap
Overrides the default value of enum values declared in your GraphQL schema.
namespaceName
type: string
default: GraphQLCodeGen
Allow you to customize the namespace name.
Usage Examples
className
type: string
default: Types
Allow you to customize the parent class name.
Usage Examples
listType
type: string
default: IEnumerable
Allow you to customize the list type
Usage Examples
emitRecords
type: boolean
default: false
Emit C# 9.0+ records instead of classes
Usage Examples
scalars
type: ScalarsMap
Extends or overrides the built-in scalars and custom GraphQL scalars to a custom type.
namingConvention
type: NamingConvention
default: pascal-case#pascalCase
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.
typesPrefix
type: string
default: ``
Prefixes all the generated types.
Usage Examples
typesSuffix
type: string
default: ``
Suffixes all the generated types.
Usage Examples
skipTypename
type: boolean
default: false
Does not add __typename to the generated types, unless it was specified in the selection set.
Usage Examples
nonOptionalTypename
type: boolean
default: false
Automatically adds __typename
field to the generated types, even when they are not specified
in the selection set, and makes it non-optional
Usage Examples
useTypeImports
type: boolean
default: false
Will use import type {}
rather than import {}
when importing only types. This gives
compatibility with TypeScript's "importsNotUsedAsValues": "error" option