Skip to content

Commit 82e56e9

Browse files
committed
docs: add migration for plugin.forEach
1 parent 5437ed8 commit 82e56e9

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

.changeset/lucky-bees-exist.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@hey-api/openapi-ts': minor
3+
---
4+
5+
feat(parser): replace `plugin.subscribe()` with `plugin.forEach()`
6+
7+
### Added `plugin.forEach()` method
8+
9+
This method replaces the `.subscribe()` method. Additionally, `.forEach()` is executed immediately, which means we don't need the `before` and `after` events – simply move your code before and after the `.forEach()` block.
10+
11+
```ts
12+
plugin.forEach('operation', 'schema', (event) => {
13+
// do something with event
14+
});
15+
```

docs/openapi-ts/migrating.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,22 @@ This config option is deprecated and will be removed in favor of [clients](./cli
2727

2828
This config option is deprecated and will be removed.
2929

30+
## v0.75.0
31+
32+
### Added `plugin.forEach()` method
33+
34+
This method replaces the `.subscribe()` method. Additionally, `.forEach()` is executed immediately, which means we don't need the `before` and `after` events – simply move your code before and after the `.forEach()` block.
35+
36+
```ts
37+
plugin.subscribe('operation', (event) => { // [!code --]
38+
// do something with event // [!code --]
39+
}); // [!code --]
40+
plugin.subscribe('schema', (event) => { // [!code --]
41+
plugin.forEach('operation', 'schema', (event) => { // [!code ++]
42+
// do something with event
43+
});
44+
```
45+
3046
## v0.74.0
3147
3248
### Single Zod schema per request

0 commit comments

Comments
 (0)