eventcatalog icon indicating copy to clipboard operation
eventcatalog copied to clipboard

AsyncAPI generator - preserve consumers/externalLinks

Open thim81 opened this issue 2 years ago • 2 comments

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.

thim81 avatar Jun 14 '22 14:06 thim81

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?

boyney123 avatar Jul 07 '22 16:07 boyney123

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 😁

yogel avatar Nov 22 '22 22:11 yogel