generator icon indicating copy to clipboard operation
generator copied to clipboard

Resolve and combine allOf before rendering

Open BTOdell opened this issue 2 years ago • 2 comments

Reason/Context

Please try answering few of those questions

  • Why we need this improvement?
  • How will this change help?
  • What is the motivation?

With the current HTML template, all of the "combination" keywords are rendered as-in instead of being resolved before rendering. My schemas heavily use references to avoid duplication; allOf is used everywhere. When my schema is rendered with asyncapi/generator, I end up with output like this:

asyncapi-allOf

Just a bunch of internal composition structure and no substance of the actual schema. (Of course, if you dig down deep enough you eventually get to the schema properties...)

For comparison with a similar tool, ReDoc (for OpenAPI) automatically resolves the allOf composition and only renders the final schema. And for oneOf it provides a nice toggle switch:

openapi-oneOf-string openapi-oneOf-object

Description

Please try answering few of those questions

  • What changes have to be introduced?
  • Will this be a breaking change?
  • How could it be implemented/designed?

I'm not sure how ReDoc does it, but any composition keywords would need to be processed and essentially inline/merge the schemas before rendering. It would be a breaking change unless we could put it behind an optional CLI flag.

BTOdell avatar Apr 02 '22 00:04 BTOdell

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.

github-actions[bot] avatar Apr 02 '22 00:04 github-actions[bot]

This issue has been automatically marked as stale because it has not had recent activity :sleeping:

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience :heart:

github-actions[bot] avatar Jul 31 '22 00:07 github-actions[bot]

Should have been posted in the asyncapi/asyncapi-react repo.

BTOdell avatar Aug 18 '22 21:08 BTOdell