Skip to content

Inconsistent YAML front-matter escape between dependencies vs. Event Catalog SDK #1081

Closed
@craig0990

Description

I tried this:

Define channels as dependencies in eventcatalog.config.js using a template parameter at the beginning of the channel ID - e.g. {env}.my.kafka.channel

This happened:

The generated dependencies/channels/{env}.my.kafka.channel front-matter became invalid, because the id strings are unquoted

$ npx eventcatalog build
[...snipped...]
bad indentation of a mapping entry
  Location:
    /github.com/craig0990/event-catalog-dependencies-yaml/.eventcatalog-core/src/content/channels/{env}.another.channel/index.mdx:2:9
  Stack trace:
    at generateError (file:///github.com/craig0990/event-catalog-dependencies-yaml/node_modules/js-yaml/dist/js-yaml.mjs:1273:10)
    at readBlockMapping (file:///github.com/craig0990/event-catalog-dependencies-yaml/node_modules/js-yaml/dist/js-yaml.mjs:2272:7)
    at readDocument (file:///github.com/craig0990/event-catalog-dependencies-yaml/node_modules/js-yaml/dist/js-yaml.mjs:2715:3)
    at Object.load$1 [as load] (file:///github.com/craig0990/event-catalog-dependencies-yaml/node_modules/js-yaml/dist/js-yaml.mjs:2804:19)
    at safeParseFrontmatter (file:///github.com/craig0990/event-catalog-dependencies-yaml/node_modules/@astrojs/mdx/dist/utils.js:33:12)

I expected this:

The same quoting behaviour as the channels/services/etc. generated by the core using the Event Catalog SDK, which quotes the YAML frontmatter values

Is there a workaround?

Not that I can think off

Anything else?

When I say matching the Event Catalog SDK, I mean that the asyncapi-generator (for example) quotes the output YAML frontmatter correctly.

I've put a small rep repo up at https://github.com/craig0990/event-catalog-dependencies-yaml showing how the channels generated from the asyncapi-generator works as expected, but the dependencies don't when executing the build

I'm assuming using stringify from gray-matter in

would resolve this, and I'd like to try a Pull Request to sort that out if that's agreeable

EventCatalog Version

@eventcatalog/core@2.18.7

Node.js Version

v23.3.0

Platform(s)

Linux

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.

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions