event-catalog / eventcatalog

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

AsyncAPI generator - preserve consumers/externalLinks #285

Closed thim81 closed 5 days ago

thim81 commented 2 years ago

Have you read the Contributing Guidelines on issues?

Description

Currently the AsyncAPI generator does an excellent job, on generating new versions of the schema.json and updating the index.md files.

There is a small annoyance, the consumers & externalLinks get overwritten with each generation, while the rest of the index.md file remains untouched.

Example - before:

version: 1.0.0-BETA
producers:
    - 'Mobile Sdk'
consumers:
    - 'Messaging Platform'
externalLinks:
    - label: AsyncAPI Specification
      url: https://messaging.com/#message-mobile.sdk.events.clicked
---
### Producers / Consumers  diagram
<NodeGraph />

Example - after:

version: 1.0.0-BETA
producers:
    - 'Mobile Sdk'
consumers: []
externalLinks: []
---
### Producers / Consumers  diagram
<NodeGraph />

Is there a way to prevent the overwrite of the consumers/externalLinks when running npm run generate?

Motivation

It would lower the maintenance of keeping the Event Catalog & the AsyncAPI specification in sync.

Currently we have to restore the overwritten consumers & externalLinks definitions.

boyney123 commented 2 years ago

Hey @thim81

Looks like we have a way to keep/blast the producers/consumers https://github.com/boyney123/eventcatalog/blob/master/packages/eventcatalog-plugin-generator-asyncapi/src/index.ts#L112 at the moment the logic has been implemented to keep some and not others...

How many AsyncAPI files are you processing out of interest? Do you have an example file I can replicate the issue with?

Happy to add some more fields to the plugin to allow you to keep the producers or consumers, would that help?

yogel commented 1 year ago

Hey @boyney123

Adding in those fields would help me out a lot!

I'm currently working on something where we take AsyncAPI files from producers and consumers separately and then bring them together into one Event Catalog. Is this possible with the current version of the plugin?

Thanks for your great work on Event Catalog 😁

boyney123 commented 5 days ago

Going through issues now, and I'm marking this as an old issue.

Feel free to re-open if you want too and still think there is value here.

Thanks for spending the time opening in the first place, I appreciate it.