Skip to content

Commit ca9984f

Browse files
committed
Format
1 parent 205f8dd commit ca9984f

1 file changed

Lines changed: 40 additions & 18 deletions

File tree

website/src/pages/docs/migration/apollo-tooling.mdx

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ import type { CodegenConfig } from '@graphql-codegen/cli'
9393
const config: CodegenConfig = {
9494
schema: './schema.graphql',
9595
documents: ['./src/**/*.{ts,tsx}', '!./src/**/__generated__/**'],
96-
externalDocuments: ['../other-package/src/**/*.{ts,tsx}', '!../other-package/src/**/__generated__/**'],
96+
externalDocuments: [
97+
'../other-package/src/**/*.{ts,tsx}',
98+
'!../other-package/src/**/__generated__/**'
99+
],
97100
generates: {
98101
'./src/': {
99102
preset: 'near-operation-file',
@@ -154,7 +157,10 @@ import type { CodegenConfig } from '@graphql-codegen/cli'
154157
const config: CodegenConfig = {
155158
schema: './schema.graphql',
156159
documents: ['./src/**/*.{ts,tsx}', '!./src/**/__generated__/**'],
157-
externalDocuments: ['../other-package/src/**/*.{ts,tsx}', '!../other-package/src/**/__generated__/**'],
160+
externalDocuments: [
161+
'../other-package/src/**/*.{ts,tsx}',
162+
'!../other-package/src/**/__generated__/**'
163+
],
158164
generates: {
159165
'./src/': {
160166
preset: 'near-operation-file',
@@ -196,7 +202,10 @@ configuration option:
196202
const config: CodegenConfig = {
197203
schema: './schema.graphql',
198204
documents: ['./src/**/*.{ts,tsx}', '!./src/**/__generated__/**'],
199-
externalDocuments: ['../other-package/src/**/*.{ts,tsx}', '!../other-package/src/**/__generated__/**'],
205+
externalDocuments: [
206+
'../other-package/src/**/*.{ts,tsx}',
207+
'!../other-package/src/**/__generated__/**'
208+
],
200209
generates: {
201210
'./src/': {
202211
preset: 'near-operation-file',
@@ -239,7 +248,10 @@ declarations matching Apollo Tooling's output, set `enumType: 'native'`:
239248
const config: CodegenConfig = {
240249
schema: './schema.graphql',
241250
documents: ['./src/**/*.{ts,tsx}', '!./src/**/__generated__/**'],
242-
externalDocuments: ['../other-package/src/**/*.{ts,tsx}', '!../other-package/src/**/__generated__/**'],
251+
externalDocuments: [
252+
'../other-package/src/**/*.{ts,tsx}',
253+
'!../other-package/src/**/__generated__/**'
254+
],
243255
generates: {
244256
'./src/': {
245257
preset: 'near-operation-file',
@@ -286,7 +298,10 @@ const config: CodegenConfig = {
286298
documents: ['./src/**/*.{ts,tsx}', '!./src/**/__generated__/**'],
287299
// `externalDocuments` are read-only documents that are loaded but do not generate output.
288300
// They are used to include fragments from another package in a monorepo without generating unnecessary files.
289-
externalDocuments: ['../other-package/src/**/*.{ts,tsx}', '!../other-package/src/**/__generated__/**'],
301+
externalDocuments: [
302+
'../other-package/src/**/*.{ts,tsx}',
303+
'!../other-package/src/**/__generated__/**'
304+
],
290305
generates: {
291306
'./src/': {
292307
preset: 'near-operation-file',
@@ -332,8 +347,8 @@ require manual fixes:
332347

333348
#### 1. Nested field types naming.
334349

335-
In very rare cases, the field names generated by GraphQL Codegen don’t match Apollo Tooling’s. Update
336-
these cases manually.
350+
In very rare cases, the field names generated by GraphQL Codegen don’t match Apollo Tooling’s.
351+
Update these cases manually.
337352

338353
#### 2. Enum file location.
339354

@@ -356,22 +371,29 @@ For `has any type` bug - a proper type needs to be determined.
356371

357372
Experiment with the following configuration options to keep your codebase changes to a minimum:
358373

359-
* **maybeValue**: defaults to `T | null`, set to `T | null | undefined` if necessary
360-
* **inputMaybeValue**: defaults to `Maybe<T>`, set to `T | null | undefined` if necessary
361-
* **avoidOptionals**: Replaces ? optional modifier with explicit `Maybe<T>`. Supports granular control via object form.
362-
* **allowUndefinedQueryVariables**: Adds | undefined to Query operation variable types (not Mutation/Subscription)
363-
* **optionalResolveType**: Makes `__resolveType` optional (`__resolveType?`) in resolver types.
364-
* **nullability**: When `errorHandlingClient: true`, adjusts nullability for fields marked with `@semanticNonNull` directive (requires `graphql-sock`).
374+
- **maybeValue**: defaults to `T | null`, set to `T | null | undefined` if necessary
375+
- **inputMaybeValue**: defaults to `Maybe<T>`, set to `T | null | undefined` if necessary
376+
- **avoidOptionals**: Replaces ? optional modifier with explicit `Maybe<T>`. Supports granular
377+
control via object form.
378+
- **allowUndefinedQueryVariables**: Adds | undefined to Query operation variable types (not
379+
Mutation/Subscription)
380+
- **optionalResolveType**: Makes `__resolveType` optional (`__resolveType?`) in resolver types.
381+
- **nullability**: When `errorHandlingClient: true`, adjusts nullability for fields marked with
382+
`@semanticNonNull` directive (requires `graphql-sock`).
365383

366384
#### 5. Extra `__typename` present, or required `__typename` missing.
367385

368386
Experiment with the following configuration options to keep your codebase changes to a minimum:
369387

370-
* **skipTypename**: prevents adding `__typename` to generated types unless explicitly in the selection set.
371-
* **skipTypeNameForRoot**: skips `__typename` specifically for root types (Query, Mutation, Subscription). Ignored if `__typename` is explicitly in the selection set
372-
* **nonOptionalTypename**: always adds `__typename` and makes it a required (non-optional) field.
373-
* **addTypenameToSelectionSets**: injects `__typename` directly into the generated document node selection sets.
374-
* **resolversNonOptionalTypename**: makes `__typename` non-optional in resolver mappings without affecting base types. Supports granular control via object form.
388+
- **skipTypename**: prevents adding `__typename` to generated types unless explicitly in the
389+
selection set.
390+
- **skipTypeNameForRoot**: skips `__typename` specifically for root types (Query, Mutation,
391+
Subscription). Ignored if `__typename` is explicitly in the selection set
392+
- **nonOptionalTypename**: always adds `__typename` and makes it a required (non-optional) field.
393+
- **addTypenameToSelectionSets**: injects `__typename` directly into the generated document node
394+
selection sets.
395+
- **resolversNonOptionalTypename**: makes `__typename` non-optional in resolver mappings without
396+
affecting base types. Supports granular control via object form.
375397

376398
## Further reading
377399

0 commit comments

Comments
 (0)