Skip to content

grid-x/discourse-swagger-theme-component

 
 

Repository files navigation

Discourse Swagger Theme Component

This is a Discourse theme component that uses Swagger UI to render OpenAPI specifications inline in Discourse topics.

Based off the nice official Discourse mermaid component.

To use it ...

  • install it into your Discourse instance
  • in a topic, create a code block and use apidoc as language tag and the URL of an OpenAPI specification url as the block's content.
```apidoc
https://petstore.swagger.io/v2/swagger.json

If specification is not publicly accessible, you can attach the specification file to your post and copy the URL after the file has been uploaded.

Here's how it could look like swagger in discourse

Development

Clone, yarn and yarn dev and play around with the swagger-ui API in ./playground/component.html. Review the locally served page.

The page is an approximation of how the component will be rendered within discourse. It renders the petstore sample file which can safely be replaced with any other valid OAS file.

Put the desired swagger-ui invocation into discourse-swagger-theme-component. Refer to the official Discourse theme component docs ☝️ for installation instructions.

About

Allows for embedding Swagger-UI into Discourse posts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 99.0%
  • Other 1.0%