Skip to content

Commit cb2d3e7

Browse files
authored
Update breaking changes section format in migration guide (dotansimha#10636)
1 parent b1e27d8 commit cb2d3e7

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

website/src/pages/docs/migration/operations-and-client-preset-from-5-0.mdx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ const config: CodegenConfig = {
209209

210210
## Breaking changes
211211

212-
1. Object types are no longer generated
212+
### 1. Object types are no longer generated
213213

214214
Previously, Object types from the schema were generated via the `typescript` plugin, for example:
215215

@@ -230,11 +230,11 @@ Now, Object types are no longer generated. This prevents accidental misuse of sc
230230
231231
If you need schema types for any reason, please generate them using the `typescript` plugin in a separate file.
232232
233-
2. Args types are no longer generated
233+
### 2. Args types are no longer generated
234234
235235
Args types are only used for server use cases, so they are no longer generated for client use cases.
236236
237-
3. Scalar types are no longer generated as a reusable type
237+
### 3. Scalar types are no longer generated as a reusable type
238238
239239
Previously, Scalar types from the schema were generated into an object and reused in Variables types:
240240
@@ -271,13 +271,13 @@ export type UserVariables = Exact<{
271271
}>
272272
```
273273
274-
4. Input and Enum types are only generated when used
274+
### 4. Input and Enum types are only generated when used
275275
276276
Previously, all Input and Enum types were generated, even if they were not used. This could increase bundle size when Enums that incur runtime cost (e.g. native TypeScript enum or const enum) are used.
277277
278278
Now, only Input and Enum types used in operations are generated.
279279
280-
5. `__typename` is only generated when used
280+
### 5. `__typename` is only generated when used
281281
282282
Previously, `__typename` fields in Result types are generated as optional by default, even when they were not requested:
283283
@@ -317,7 +317,7 @@ export type UserQuery = {
317317
continue to use `skipTypeNameForRoot` and `nonOptionalTypename` options to configure expected type behaviours.
318318
</Callout>
319319
320-
6. Document field types are generated to correctly match runtime expectations
320+
### 6. Document field types are generated to correctly match runtime expectations
321321
322322
Previously, nullable fields in Result types were generated as optional by default:
323323
@@ -340,7 +340,7 @@ export type UserQuery = {
340340
}
341341
```
342342
343-
7. Enum config options are consolidated and the default value is changed
343+
### 7. Enum config options are consolidated and the default value is changed
344344
345345
Previously, there were 4 boolean options to set which Enum variant to generate. When combined, these options overrode one another, leading to unexpected and confusing behaviour.
346346
@@ -354,7 +354,7 @@ Now, `enumType` is the only config option to use. The default has also been chan
354354
| Native const | `export const enum UserRole { Admin = 'ADMIN', Customer = 'CUSTOMER' };` | `{constEnums:true}` | `{enumType:'native-const'}` |
355355
| Native numeric | `export enum UserRole { Admin = 0, Customer = 1 }` | `{numericEnums:true}` | `{enumType:'native-numeric'}` |
356356
357-
8. `avoidOptionals` option is updated to only handle Operation types
357+
### 8. `avoidOptionals` option is updated to only handle Operation types
358358
359359
Previously, `avoidOptionals` was shared with the [typescript plugin](https://the-guild.dev/graphql/codegen/plugins/typescript/typescript#avoidoptionals). As a result, some inner options did not affect Operation types (such as `avoidOptionals.resolvers`, `avoidOptionals.query`, `avoidOptionals.mutation`, `avoidOptionals.subscription`).
360360
@@ -366,7 +366,7 @@ Now, there are only 3 inner options, and when enabled, each forces the respectiv
366366
367367
Note that the default is `false`, and you can still use `avoidOptionals:true` to turn on all options, without having to set each one individually.
368368
369-
9. `preResolveTypes` option is removed
369+
### 9. `preResolveTypes` option is removed
370370
371371
The `preResolveTypes` option was used to generate Result types inline (`preResolveTypes:false`) or use the ones generated by the `typescript` plugin (`preResolveTypes:true`). This approach had several drawbacks:
372372
@@ -378,21 +378,21 @@ The `preResolveTypes` option was used to generate Result types inline (`preResol
378378
379379
If you are seeing problems, please create an issue [here](https://github.com/dotansimha/graphql-code-generator/issues).
380380
381-
10. Legacy utility types are removed
381+
### 10. Legacy utility types are removed
382382
383383
The following utility types have been removed:
384384
385385
- `Maybe`: used to handle nullability types of fields in Result types. However, field types have been pre-resolved and inlined for a long time, so this type is no longer needed.
386386
- `InputMaybe`: used to handle nullability types of Input. Input types are now inlined, so this type is no longer needed.
387387
- `MakeOptional`, `MakeMaybe` and `MakeEmpty`: used to handle `preResolveTypes:false`. However, `preResolveTypes` has been removed, so these types are no longer needed.
388388
389-
11. Make `unknown` the default type for custom scalars instead of `any`
389+
### 11. Make `unknown` the default type for custom scalars instead of `any`
390390
391391
Previously, the default custom Scalars type was `any`, which bypassed typechecking.
392392
393393
Now, the default type is `unknown` to ensure data is handled carefully by users.
394394
395-
12. Make `string | number` the default type for the native `ID` scalar
395+
### 12. Make `string | number` the default type for the native `ID` scalar
396396
397397
Previously, one set of default Scalar types was shared between client and server plugins via the `typescript` plugin dependency. This meant it was not possible to set the default for client, as it would complicate the server config, and vice versa. See this [PR for more details](https://github.com/dotansimha/graphql-code-generator/pull/9497).
398398

0 commit comments

Comments
 (0)