Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output contain valid XML tags #365

Closed
kjaquier opened this issue Sep 5, 2023 · 8 comments · Fixed by #542
Closed

Output contain valid XML tags #365

kjaquier opened this issue Sep 5, 2023 · 8 comments · Fixed by #542
Labels
bug Something isn't working released

Comments

@kjaquier
Copy link

kjaquier commented Sep 5, 2023

Describe the bug

Context

I'm testing out templates for integrating an AsyncAPI spec into a Docusaurus website. Docusaurus uses MDX which allows integrating JSX components and code into Markdown documents. I assume it accepts XML tags as HTML/JSX components which other Markdown parsers might ignore and render as text.

Actual issue

The output contains elements like array<integer> that can look like unclosed HTML elements to some parsers.

How to Reproduce

Write an AsyncAPI schema that include a property like:

type: object
properties:
  prop1:
    type: object
    properties:
      prop2:
        type: array
        items:
            type: number

The generated document will contain a table with this:

... | array<number> | ...

Expected behavior

The line above should be formatted as code:

... | `array<number>` | ...

There should be no < and > in the generated document that isn't formatted as code or escaped appropriately.

@kjaquier kjaquier added the bug Something isn't working label Sep 5, 2023
@github-actions
Copy link

github-actions bot commented Sep 5, 2023

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@jonaslagoni
Copy link
Member

jonaslagoni commented Sep 5, 2023

Hey @kjaquier, pretty sure we just need to change these 2 lines:

return `array<${SchemaCustomTypes.ANY}>`;
}
return `array<${this.toSchemaType(items) || SchemaCustomTypes.UNKNOWN}>`;

Wanna help provide a fix for it?

@asyncapi-bot
Copy link
Contributor

Hello, @jonaslagoni! 👋🏼

I'm 🧞🧞🧞 Genie 🧞🧞🧞 from the magic lamp. Looks like somebody needs a hand!

At the moment the following comments are supported in issues:

  • /good-first-issue {js | ts | java | go | docs | design | ci-cd} or /gfi {js | ts | java | go | docs | design | ci-cd} - label an issue as a good first issue.
    example: /gfi js or /good-first-issue ci-cd

@kjaquier
Copy link
Author

kjaquier commented Sep 5, 2023

Ok this is what I got so far but some tests still need updating: 827bd0d

@derberg
Copy link
Member

derberg commented Dec 18, 2023

@kjaquier can you please open a PR, it would be easier this way to help providing a mergable PR 🙏🏼

@Gmin2
Copy link

Gmin2 commented Jan 9, 2024

should i raise a PR fixing it ?
cc @derberg @jonaslagoni

@derberg
Copy link
Member

derberg commented Jan 11, 2024

@Min2who go ahead please

@asyncapi-bot
Copy link
Contributor

🎉 This issue has been resolved in version 1.6.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants