Skip to content

Commit d0a4b13

Browse files
authored
chore(release): release and bump versions of packages (#1829)
1 parent 11a1b8d commit d0a4b13

File tree

13 files changed

+204
-71
lines changed

13 files changed

+204
-71
lines changed

.changeset/slack-auto-routing.md

Lines changed: 0 additions & 58 deletions
This file was deleted.

apps/generator/CHANGELOG.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,71 @@
11
# @asyncapi/generator
22

3+
## 3.1.0
4+
5+
### Minor Changes
6+
7+
- 11a1b8d: - **Updated Component**: `OnMessage` (Python) - Added discriminator-based routing logic that automatically dispatches messages to operation-specific handlers before falling back to generic handlers
8+
9+
- **New Helpers**:
10+
- `getMessageDiscriminatorData` - Extracts discriminator key and value from individual messages
11+
- `getMessageDiscriminatorsFromOperations` - Collects all discriminator metadata from receive operations
12+
- Enhanced Python webSocket client generation with **automatic operation-based message routing**:
13+
14+
## How python routing works
15+
16+
- Generated WebSocket clients now automatically route incoming messages to operation-specific handlers based on message discriminators. Users can register handlers for specific message types without manually parsing or filtering messages.
17+
- When a message arrives, the client checks it against registered discriminators (e.g., `type: "hello"`, `type: "events_api"`)
18+
- If a match is found, the message is routed to the specific operation handler (e.g., `onHelloMessage`, `onEvent`)
19+
- If no match is found, the message falls back to generic message handlers
20+
- This enables clean separation of message handling logic based on message types
21+
22+
> `discriminator` is a `string` field that you can add to any AsyncAPI Schema. This also means that it is limited to AsyncAPI Schema only, and it won't work with other schema formats, like for example, Avro.
23+
24+
The implementation automatically derives discriminator information from your AsyncAPI document:
25+
26+
- Discriminator `key` is extracted from the `discriminator` field in your AsyncAPI spec
27+
- Discriminator `value` is extracted from the `const` property defined in message schemas
28+
29+
Example AsyncAPI Schema with `discriminator` and `const`:
30+
31+
```yaml
32+
schemas:
33+
hello:
34+
type: object
35+
discriminator: type # you specify name of property
36+
properties:
37+
type:
38+
type: string
39+
const: hello # you specify the value of the discriminator property that is used for routing
40+
description: A hello string confirming WebSocket connection
41+
```
42+
43+
## Fallback
44+
45+
When defaults aren't available in the AsyncAPI document, users must provide **both** `discriminator_key` and `discriminator_value` when registering handlers. Providing only one parameter is not supported - you must provide either both or neither.
46+
47+
> **Why this limitation exists**: When a receive operation has multiple messages sharing the same discriminator key (e.g., all use `"type"` field), we need the specific value (e.g., `"hello"`, `"disconnect"`) to distinguish between them. Without both pieces of information, the routing becomes ambiguous.
48+
49+
Example:
50+
51+
```python
52+
# Default case - discriminator info auto-derived from AsyncAPI doc
53+
client.register_on_hello_message_handler(my_handler)
54+
55+
# Custom case - must provide both key AND value
56+
client.register_on_hello_message_handler(
57+
my_handler,
58+
discriminator_key="message_type",
59+
discriminator_value="custom_hello"
60+
)
61+
```
62+
63+
### Patch Changes
64+
65+
- Updated dependencies [11a1b8d]
66+
- @asyncapi/generator-components@0.5.0
67+
- @asyncapi/generator-helpers@1.1.0
68+
369
## 3.0.1
470

571
### Patch Changes

apps/generator/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@asyncapi/generator",
3-
"version": "3.0.1",
3+
"version": "3.1.0",
44
"description": "The AsyncAPI generator. It can generate documentation, code, anything!",
55
"main": "./lib/generator.js",
66
"engines": {

packages/components/CHANGELOG.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,70 @@
11
# @asyncapi/generator-components
22

3+
## 0.5.0
4+
5+
### Minor Changes
6+
7+
- 11a1b8d: - **Updated Component**: `OnMessage` (Python) - Added discriminator-based routing logic that automatically dispatches messages to operation-specific handlers before falling back to generic handlers
8+
9+
- **New Helpers**:
10+
- `getMessageDiscriminatorData` - Extracts discriminator key and value from individual messages
11+
- `getMessageDiscriminatorsFromOperations` - Collects all discriminator metadata from receive operations
12+
- Enhanced Python webSocket client generation with **automatic operation-based message routing**:
13+
14+
## How python routing works
15+
16+
- Generated WebSocket clients now automatically route incoming messages to operation-specific handlers based on message discriminators. Users can register handlers for specific message types without manually parsing or filtering messages.
17+
- When a message arrives, the client checks it against registered discriminators (e.g., `type: "hello"`, `type: "events_api"`)
18+
- If a match is found, the message is routed to the specific operation handler (e.g., `onHelloMessage`, `onEvent`)
19+
- If no match is found, the message falls back to generic message handlers
20+
- This enables clean separation of message handling logic based on message types
21+
22+
> `discriminator` is a `string` field that you can add to any AsyncAPI Schema. This also means that it is limited to AsyncAPI Schema only, and it won't work with other schema formats, like for example, Avro.
23+
24+
The implementation automatically derives discriminator information from your AsyncAPI document:
25+
26+
- Discriminator `key` is extracted from the `discriminator` field in your AsyncAPI spec
27+
- Discriminator `value` is extracted from the `const` property defined in message schemas
28+
29+
Example AsyncAPI Schema with `discriminator` and `const`:
30+
31+
```yaml
32+
schemas:
33+
hello:
34+
type: object
35+
discriminator: type # you specify name of property
36+
properties:
37+
type:
38+
type: string
39+
const: hello # you specify the value of the discriminator property that is used for routing
40+
description: A hello string confirming WebSocket connection
41+
```
42+
43+
## Fallback
44+
45+
When defaults aren't available in the AsyncAPI document, users must provide **both** `discriminator_key` and `discriminator_value` when registering handlers. Providing only one parameter is not supported - you must provide either both or neither.
46+
47+
> **Why this limitation exists**: When a receive operation has multiple messages sharing the same discriminator key (e.g., all use `"type"` field), we need the specific value (e.g., `"hello"`, `"disconnect"`) to distinguish between them. Without both pieces of information, the routing becomes ambiguous.
48+
49+
Example:
50+
51+
```python
52+
# Default case - discriminator info auto-derived from AsyncAPI doc
53+
client.register_on_hello_message_handler(my_handler)
54+
55+
# Custom case - must provide both key AND value
56+
client.register_on_hello_message_handler(
57+
my_handler,
58+
discriminator_key="message_type",
59+
discriminator_value="custom_hello"
60+
)
61+
```
62+
63+
### Patch Changes
64+
65+
- Updated dependencies [11a1b8d]
66+
- @asyncapi/generator-helpers@1.1.0
67+
368
## 0.4.1
469

570
### Patch Changes

packages/components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@asyncapi/generator-components",
3-
"version": "0.4.1",
3+
"version": "0.5.0",
44
"description": "Package with reusable components for generation using React render engine",
55
"scripts": {
66
"test": "npm run build && jest --coverage",

packages/helpers/CHANGELOG.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,65 @@
11
# @asyncapi/generator-helpers
22

3+
## 1.1.0
4+
5+
### Minor Changes
6+
7+
- 11a1b8d: - **Updated Component**: `OnMessage` (Python) - Added discriminator-based routing logic that automatically dispatches messages to operation-specific handlers before falling back to generic handlers
8+
9+
- **New Helpers**:
10+
- `getMessageDiscriminatorData` - Extracts discriminator key and value from individual messages
11+
- `getMessageDiscriminatorsFromOperations` - Collects all discriminator metadata from receive operations
12+
- Enhanced Python webSocket client generation with **automatic operation-based message routing**:
13+
14+
## How python routing works
15+
16+
- Generated WebSocket clients now automatically route incoming messages to operation-specific handlers based on message discriminators. Users can register handlers for specific message types without manually parsing or filtering messages.
17+
- When a message arrives, the client checks it against registered discriminators (e.g., `type: "hello"`, `type: "events_api"`)
18+
- If a match is found, the message is routed to the specific operation handler (e.g., `onHelloMessage`, `onEvent`)
19+
- If no match is found, the message falls back to generic message handlers
20+
- This enables clean separation of message handling logic based on message types
21+
22+
> `discriminator` is a `string` field that you can add to any AsyncAPI Schema. This also means that it is limited to AsyncAPI Schema only, and it won't work with other schema formats, like for example, Avro.
23+
24+
The implementation automatically derives discriminator information from your AsyncAPI document:
25+
26+
- Discriminator `key` is extracted from the `discriminator` field in your AsyncAPI spec
27+
- Discriminator `value` is extracted from the `const` property defined in message schemas
28+
29+
Example AsyncAPI Schema with `discriminator` and `const`:
30+
31+
```yaml
32+
schemas:
33+
hello:
34+
type: object
35+
discriminator: type # you specify name of property
36+
properties:
37+
type:
38+
type: string
39+
const: hello # you specify the value of the discriminator property that is used for routing
40+
description: A hello string confirming WebSocket connection
41+
```
42+
43+
## Fallback
44+
45+
When defaults aren't available in the AsyncAPI document, users must provide **both** `discriminator_key` and `discriminator_value` when registering handlers. Providing only one parameter is not supported - you must provide either both or neither.
46+
47+
> **Why this limitation exists**: When a receive operation has multiple messages sharing the same discriminator key (e.g., all use `"type"` field), we need the specific value (e.g., `"hello"`, `"disconnect"`) to distinguish between them. Without both pieces of information, the routing becomes ambiguous.
48+
49+
Example:
50+
51+
```python
52+
# Default case - discriminator info auto-derived from AsyncAPI doc
53+
client.register_on_hello_message_handler(my_handler)
54+
55+
# Custom case - must provide both key AND value
56+
client.register_on_hello_message_handler(
57+
my_handler,
58+
discriminator_key="message_type",
59+
discriminator_value="custom_hello"
60+
)
61+
```
62+
363
## 1.0.1
464

565
### Patch Changes

packages/helpers/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@asyncapi/generator-helpers",
3-
"version": "1.0.1",
3+
"version": "1.1.0",
44
"description": "Package with reusable helpers that make it easier to work with AsyncAPI structures.",
55
"scripts": {
66
"test": "jest --coverage",

packages/templates/clients/kafka/java/quarkus/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"lint:fix": "eslint --fix --max-warnings 0 --config ../../../../../../.eslintrc --ignore-path ../../../../../../.eslintignore ."
1919
},
2020
"dependencies": {
21-
"@asyncapi/generator-helpers": "1.0.1",
21+
"@asyncapi/generator-helpers": "1.1.0",
2222
"@asyncapi/generator-react-sdk": "^1.1.2"
2323
},
2424
"devDependencies": {

packages/templates/clients/websocket/dart/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"license": "Apache-2.0",
1313
"dependencies": {
1414
"@asyncapi/generator-react-sdk": "*",
15-
"@asyncapi/generator-helpers": "1.0.1",
16-
"@asyncapi/generator-components": "0.4.1"
15+
"@asyncapi/generator-helpers": "1.1.0",
16+
"@asyncapi/generator-components": "0.5.0"
1717
},
1818
"devDependencies": {
1919
"@asyncapi/parser": "^3.4.0",

packages/templates/clients/websocket/java/quarkus/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"lint:fix": "eslint --fix --max-warnings 0 --config ../../../../../../.eslintrc --ignore-path ../../../../../../.eslintignore ."
1919
},
2020
"dependencies": {
21-
"@asyncapi/generator-helpers": "1.0.1",
22-
"@asyncapi/generator-components": "0.4.1",
21+
"@asyncapi/generator-helpers": "1.1.0",
22+
"@asyncapi/generator-components": "0.5.0",
2323
"@asyncapi/generator-react-sdk": "^1.1.2"
2424
},
2525
"devDependencies": {

0 commit comments

Comments
 (0)