event-catalog / eventcatalog

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

Enable External URL Support for AsyncAPI Files in Services Configuration #848

Open Nayra-Neves opened 2 days ago

Nayra-Neves commented 2 days ago

Use Case

I would like to propose an enhancement to the existing configuration of services in the EventCatalog, specifically regarding the integration with AsyncAPI files. Currently, the services property in the eventcatalog.config.api file only accepts local file paths for the AsyncAPI definitions (At least as far as I understand from the documentation and testing). Below is an example of the current configuration structure:

[
  '@eventcatalog/generator-asyncapi',
  {
    services: [
      { path: path.join(__dirname, 'asyncapi-files', 'new-uc-service.yml'), id: 'Client Service'},
    ],
    domain: { id: 'clients', name: 'Client', version: '0.0.1' },
    debug: true
  },
],

Proposed Enhancement: I would like to suggest extending this feature to allow referencing external AsyncAPI files via URLs (for example, https://raw.githubusercontent.com/asyncapi/asyncapi/2.0.0/examples/2.0.0/streetlights.yml). This feature would significantly improve collaboration and integration across teams.

Proposed Solution

User story suggestion Title: Allow External URL References for AsyncAPI Files in EventCatalog

Description: As an EventCatalog user, I want to reference AsyncAPI files through external URLs, so that different teams can easily collaborate and keep the event documentation always up-to-date without the need to copy files locally.

Acceptance Criteria:

Implementation Notes

Possible Implementation Flow:

  1. Detect if the path is a URL.
  2. Make the HTTP request to fetch the file.
  3. Process the file based on the format (YAML or JSON).
  4. Validate the AsyncAPI file to ensure it is correct.
  5. Integrate the AsyncAPI file into EventCatalog as is done with local files.
  6. Handle errors like invalid or inaccessible URLs.

Conclusion: This approach will allow EventCatalog to be more flexible and enable easier collaboration between teams that manage AsyncAPI files in a decentralized manner, simplifying access to externally hosted files.

Community Notes

gimmebytes commented 9 hours ago

Hello @Nayra-Neves & event-catalog community 👋,

the lack of this feature let to the situation at my former company, that we started creating tooling around syncing/pushing changed/updated spec files from any given repo in the central eventcatalog repo. While this approach worked, it required a lot of tooling around.

So I would also totally opt for having the ability, to link to existing files outside the catalog repo. I only see the challenge, that proper authn/authz needs to be put in place too, because in corporate environments you would never see private spec files sitting on the webs without auth.

What I would be interested in is, how this feature would be different when the event catalog actually would get a real backend, instead of being generator locally @boyney123 ?

If support on this issue is required, we can help ✌️

Cheers, Marvin