asyncapi / asyncapi/parser-js

"messageId" must be unique across all the messages.

Open
#793 16 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
144
Forks
144
Avg merge
6m
Merged PRs (30d)
11

Description

### Describe the bug
One message cannot be reused in publish and subscribe in the same channel, if a messageId is defined on the message

### To Reproduce
Steps to reproduce the behavior:

0. Assume someMessage has messageId defined.
1. Create a document with a channel like so:
```
channels:
someChannel:
publish:
message:
$ref: "#/components/messages/someMessage"
subscribe:
message:
$ref: "#/components/messages/someMessage"
bindings:
eventstore:
# This is not autogenerated to go code unfortunately
streamName: "someStream"
```
2. Try to `asyncapi generate models golang`
3. See error `error asyncapi2-message-messageId-uniqueness "messageId" must be unique across all the messages.`

### Expected behavior
This should be possible. My usecase is that i want the same service to publish and subscribe to the same eventstore channel, that is used to persist data

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with `asyncapi generate models golang` using the channel and shared `components/messages/someMessage` reference described here. Start at the `asyncapi2-message-messageId-uniqueness` validation path; done means the same message can be referenced by both publish and subscribe without this error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.