event-catalog / generator-asyncapi

AsyncAPI generator for EventCatalog
https://www.eventcatalog.dev/docs/development/integrations/async-api/intro
Other
9 stars 3 forks source link

Better handling of service filename #42

Open hpatoio opened 2 days ago

hpatoio commented 2 days ago

Use Case

I run the command npm run generate with an AsyncAPI file whose info.title was:

info:
  title: Foo Service. See http://foo.com
  version: 1.0.0

Since generator uses title as filename this was created in services folder

├── Foo Service. See http:
│   └── foo.com
│       ├── index.md
│       └── inventory-service.yml

Proposed Solution

We can have different solution:

  1. We "sanitize" the value in info.title before use it as a filename.
  2. We allow an extra property x-eventcatalog-service-id that allow to specify a machine-friendly name for the service. If this is not set we can still fallback to point 1.

Something like:

info:
  title: Foo Service. See http://foo.com
  version: 1.0.0
  x-eventcatalog-service: foo-service

Implementation Notes

No response

Community Notes

boyney123 commented 22 hours ago

Thanks for raising @hpatoio .

I released a new version of the generator @eventcatalog/generator-asyncapi@1.0.4 with support for a new folderName property. Let me know if this helps.

https://www.eventcatalog.dev/docs/development/plugins/async-api/api#required-fields