event-catalog / event-catalog/generators

OpenAPI (probably AsyncAPI as well): curly brackets in descriptions not escaped in mdx - error during build

Open
#210 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
15
Forks
16
Avg merge
25m
Merged PRs (30d)
4

Description

### I tried this:

In our OpenAPI files we often have examples of json payload in descriptions.
```
For example "instrumentName" : {"Value" : "Instrument123", "DisplayName" : "Name of instrument"}
```

### This happened:

While the generate step works and produces the following mdx:
```
For example "instrumentName" : {"Value" : "Instrument123", "DisplayName" : "Name of instrument"}
```
during the build step Astro is trying to parse this as JS and fails to do so. Thus the build step aborts with an error:
```
[@mdx-js/rollup] Could not parse expression with acorn
file: E:/_/event-catalog/eventcatalog-sandbox/domains/activitylog/services/activitylog-service/versioned/1.0.0/commands/PostActivityLog/index.mdx:20:103
Location:
E:/_/event-catalog/eventcatalog-sandbox/domains/activitylog/services/activitylog-service/versioned/1.0.0/commands/PostActivityLog/index.mdx:20:103
Stack trace:
at Object.transform (file:///E:/_/event-catalog/eventcatalog-sandbox/node_modules/@astrojs/mdx/dist/vite-plugin-mdx.js:62:15)
```

### I expected this:

Ideally users can write this into their OpenAPI yamls (it is valid yaml) without having to worry about escaping this themselves. I don't know how the output looks like if the individual characters (i.e. curly brackets) are escaped, but that's probably the best that can be done automatically.

### Is there a workaround?

Escape this already in the OpenAPI yaml (e.g. through backticks).

### Anything else?

_No response_

### EventCatalog Version

2.25.1

### Node.js Version

22.11

### Platform(s)

Windows

### 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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.