swagger-ui icon indicating copy to clipboard operation
swagger-ui copied to clipboard

AsyncAPI

Open bufferoverflow opened this issue 3 years ago • 5 comments

Content & configuration

AsyncAPI became quite popular and rendering AsyncAPI's within swagger-ui would be awesome!

From a concept point of view it is very similar to OpenAPI, see https://www.asyncapi.com/docs/getting-started/coming-from-openapi

Are there any plans to add AsyncAPI capabilities to swagger-ui?

Describe the solution you'd like

Support of AsycAPI within swagger-ui

Describe alternatives you've considered

using another tool then swagger-ui, see https://www.asyncapi.com/docs/community/tooling#documentation-generators

Additional context

  • GitLab uses swagger-ui to render API specs: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/21106
  • I'm of course ready to add similar support for AsyncAPI based filename pattern as with OpenAPI

bufferoverflow avatar Nov 18 '20 16:11 bufferoverflow

I have analyzed this a bit further but I am new to AsyncAPI so I have concentrated on the basic integration:

  • there is the need for a util that converts AsyncAPI Documents to OAS. I have written a little PoC to test a basic conversion into basic OAS structure.
  • Need of a new selector to allow publish and subscribe as valid method to be wrapped via plugin api to support this
  • then we could hook into the spec selection process and convert AsyncAPI to OAS spec
    1. on initial load
    2. on subtree resolve

Besides that it would need further analysis of AsyncAPI to integrate into the TryOut part. I think for documentation purpose it should be fine to convert the AsyncApi Spec into proper structure.

mathis-m avatar Feb 01 '21 09:02 mathis-m

@mathis-m That's awesome, I'm happy to see this!

@tim-lai What do you think about this approach and in general about support of AsyncAPI within swagger-ui.

bufferoverflow avatar Feb 01 '21 15:02 bufferoverflow

Hi folks, Any news about this support of AsyncAPI within swagger-ui ? Thanks

Hassen-BENNOUR avatar Jan 19 '22 20:01 Hassen-BENNOUR

Hi everybody,

Support for rendering AsyncAPI 2.x in SwaggerUI can be achieved by integrating plugins from SwaggerEditor@next. Here is how to achieve that:

image

You can find more information here: https://github.com/swagger-api/swagger-editor/tree/next#using-preview-plugins-in-swaggerui

char0n avatar Jul 26 '22 15:07 char0n

Does somebody implements it? I want to use swagger-ui-dist because I don't really need to implement a complex frontend (with React installed or making a pre compiled interface) on my APIs.

dgmike avatar Sep 14 '22 14:09 dgmike

Hi everybody,

Support for rendering AsyncAPI 2.x in SwaggerUI can be achieved by integrating plugins from SwaggerEditor@next. Here is how to achieve that:

image

You can find more information here: https://github.com/swagger-api/swagger-editor/tree/next#using-preview-plugins-in-swaggerui

I tried the solution with plugins in an Angular app but it did not work. Below is the error I face. Also, when trying to use AsyncApiStandalone component, the types are not available so this seems to be working only for react based apps ?

image

ImPacific avatar May 12 '23 10:05 ImPacific

Does somebody implements it? I want to use swagger-ui-dist because I don't really need to implement a complex frontend (with React installed or making a pre compiled interface) on my APIs.

@dgmike Working on having a separate npm package for this. Will update here when ready.


@ImPacific I've tested just now and it worked as described. I've update the documentation to use swagger-ui instead of swagger-ui-react: https://github.com/swagger-api/swagger-editor/tree/next#using-preview-plugins-in-swaggerui.

I've also added section describing how to achieve standalone mode.

char0n avatar Aug 19 '23 19:08 char0n