Skip to content

Commit cbdebe8

Browse files
committed
better comments
1 parent 1ef5824 commit cbdebe8

1 file changed

Lines changed: 17 additions & 21 deletions

File tree

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

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ import type { CodegenConfig } from '@graphql-codegen/cli'
284284
const config: CodegenConfig = {
285285
schema: './schema.graphql',
286286
documents: ['./src/**/*.{ts,tsx}', '!./src/**/__generated__/**'],
287-
// `externalDocuments` are read-only documents that are loaded but do not generate any output.
287+
// `externalDocuments` are read-only documents that are loaded but do not generate output.
288288
// They are used to include fragments from another package within a monorepo.
289289
externalDocuments: ['../other-package/src/**/*.{ts,tsx}', '!../other-package/src/**/__generated__/**'],
290290
generates: {
@@ -330,17 +330,17 @@ export default config
330330
The setup above closely mimics Apollo Tooling but isn’t an exact match. The following items may
331331
require manual fixes:
332332

333-
1. Nested field types naming.
333+
#### 1. Nested field types naming.
334334

335335
In very rare cases, the field names generated by GraphQL Codegen don’t match Apollo Tooling’s. Update
336336
these cases manually.
337337

338-
2. Enum file location.
338+
#### 2. Enum file location.
339339

340340
Occasionally, GraphQL Codegen places enums in a different file then Apollo Tooling. If an enum is
341341
missing, check nearby generated files and adjust your imports accordingly.
342342

343-
3. `is possibly null` and `has any type` typecheck bugs.
343+
#### 3. `is possibly null` and `has any type` typecheck bugs.
344344

345345
These bugs has to be fixed.
346346

@@ -352,30 +352,26 @@ For `is possibly null` bug, asserting for not null or adding `!` will fix most c
352352

353353
For `has any type` bug - a proper type needs to be determined.
354354

355-
4. Mismatch between `Type | null` and `Type | null | undefined`.
355+
#### 4. Mismatch between `Type | null` and `Type | null | undefined`.
356356

357357
Experiment with the following configuration options to keep your codebase changes to a minimum:
358358

359-
```
360-
maybeValue: defaults to 'T | null', set to 'T | null | undefined' if necessary
361-
inputMaybeValue: defaults to 'Maybe<T>', set to 'T | null | undefined' if necessary
362-
avoidOptionals: Replaces ? optional modifier with explicit Maybe<T>. Supports granular control via object form.
363-
allowUndefinedQueryVariables: Adds | undefined to Query operation variable types (not Mutation/Subscription)
364-
optionalResolveType: Makes __resolveType optional (__resolveType?) in resolver types.
365-
nullability: When errorHandlingClient: true, adjusts nullability for fields marked with @semanticNonNull directive (requires graphql-sock).
366-
```
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`).
367365

368-
5. Extra `__typename` present, or required `__typename` missing.
366+
#### 5. Extra `__typename` present, or required `__typename` missing.
369367

370368
Experiment with the following configuration options to keep your codebase changes to a minimum:
371369

372-
```
373-
skipTypename: prevents adding __typename to generated types unless explicitly in the selection set.
374-
skipTypeNameForRoot: skips __typename specifically for root types (Query, Mutation, Subscription). Ignored if __typename is explicitly in the selection set
375-
nonOptionalTypename: always adds __typename and makes it a required (non-optional) field.
376-
addTypenameToSelectionSets: injects __typename directly into the generated document node selection sets.
377-
resolversNonOptionalTypename: makes __typename non-optional in resolver mappings without affecting base types. Supports granular control via object form.
378-
```
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.
379375

380376
## Further reading
381377

0 commit comments

Comments
 (0)