event-catalog / event-catalog/generators

Event page content depends on order in which AsyncAPI files are processed

Open
#407 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
15
Forks
16
Avg merge
25m
Merged PRs (30d)
4

Description

### I tried this:

We have multiple AsyncAPI files generated for the same EventCatalog — for example, one for a producer service and one for a subscriber service — that reference the same event/message. The producer's AsyncAPI defines bindings and other attributes on the message; the subscriber's does not.

We expected the generator to merge information across runs so that attributes defined on the producer side end up on the resulting event page, regardless of which AsyncAPI file is processed first.

Generator config (simplified):

```js
[
'@eventcatalog/generator-asyncapi',
{
services: [
{ path: 'producer.yaml', id: 'producer-service' },
{ path: 'subscriber.yaml', id: 'subscriber-service' },
],
},
]
```

### This happened:

The content of the generated event page depends on the order in which the AsyncAPI files are processed.

Looking at the code, attributes (including the bindings support that was added previously) are only written to the event's markdown here:

https://github.com/event-catalog/generators/blob/main/packages/generator-asyncapi/src/index.ts#L540

So when the subscriber's AsyncAPI is processed first and the producer's second, the subscriber's version of the message wins and the bindings/attributes from the producer are lost on the final event page. Reversing the order in the config produces the correct output.

I don't think this is specific to bindings — it looks like any information written at that point is sensitive to processing order, since later runs don't merge into or override the previously-written event content consistently.

### I expected this:

_No response_

### Is there a workaround?

_No response_

### Anything else?

_No response_

### EventCatalog Version

_No response_

### Node.js Version

_No response_

### Platform(s)

_No response_

### Community Notes

* Please vote by adding a 👍 reaction to the issue to help us prioritize.
* If you are interested to work on this issue, please leave a comment.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.