Skip to content

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

Description

@unwork-ag

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions