event-catalog / eventcatalog

An open source documentation tool to bring discoverability to your event-driven architectures
https://eventcatalog.dev
MIT License
1.67k stars 139 forks source link

[eventcatalog-plugin-generator-asyncapi] Switches producers and consumers #405

Open JoostvdB94 opened 1 year ago

JoostvdB94 commented 1 year ago

Have you read the Contributing Guidelines on issues?

Description

When using AsyncAPI for generating the eventcatalog pages, the consumer and producer statements are switched. When the asyncAPI states that an application produces an event, the generator will place that event in the "consumes" list.

This is either wildly confusing, or a bug.

Steps to reproduce

  1. Create an AsyncAPI document which states that an application produces an event. Or fetch the example in the plugin directory src/examples/kafka.yml
  2. Run the generation as described in the readme
  3. See that a service document has been made that states that Streetlights Kafka API consumes lightMeasured

Expected behavior

I would expect that:

Publishers of an event (as defined in asyncapi) would show up as producers of an event Subsribers to an event would show up as Consumers

Actual behavior

Publishers of an event (as defined in asyncapi) show up as consumers of an event Subsribers to an event show up as Producers

Your environment

Windows 10 Node v18

JoostvdB94 commented 1 year ago

After some more research, I've found that this is a longer running discussion. Other templates have functionality to switch the viewpoint. (as mentioned by https://www.asyncapi.com/blog/publish-subscribe-semantics). Perhaps the PR should add this instead of switching the verbs

susliko commented 1 year ago

Also stumbled upon this 🤯