mkdocs-render-swagger-plugin
This is the Mkdocs plugin for rendering swagger & openapi schemas using Swagger UI. It is written in Python.
Usage
Install the plugin using pip install mkdocs-render-swagger-plugin.
Add the following lines to your mkdocs.yml:
plugins:
- render_swagger
Example
Here's an example (courtesy of Scarf) of how the plugin renders swagger.
Referencing a local json
Place an OpenAPI json file in the same folder as the .md file.
Enter !!swagger FILENAME!! at the appropriate location inside the markdown file.
If you wish to reference any files on the filesytem (security risk), make sure
you enable allow_arbitrary_locations in the config (mkdocs.yml) like so:
plugins:
- render_swagger:
allow_arbitrary_locations : true
Referencing an external json
You may reference an external OpenAPI json using the following syntax: !!swagger-http URL!!.
Explicit declaration of the Swagger JS library
You can explicitly specify the swagger-ui css and js dependencies if you wish to not use the unpkg CDN.
To specify this use javascript and css in your mkdocs.yaml:
plugins:
- render_swagger:
javascript: assets/js/swagger-ui-bundle.js
css: assets/css/swagger-ui.css
Contributing & Developing Locally
After downloading and extracting the .tar.gz, install this package locally using pip and the --editable flag:
pip install --editable ".[dev]"
You'll then have the render-swagger package available to use in Mkdocs and pip will point the dependency to this folder. You are then able to run the docs using mkdocs serve. Make sure you restart the process between code changes as the plugin is loaded on startup.
MkDocs plugins and Swagger api
The Render Swagger MkDocs plugin uses a set of extensions and plugin APIs that MkDocs and Swagger UI supports. You can find more info about MkDocs plugins and Swagger UI on the official website of MkDocs and SwaggerUI.
The input OpenAPI files processed by the plugin should conform to the OpenAPI specification. It is generated by a few projects such as pydantic, FastAPI and others.
Disclaimer: This plugin is unofficial, and is not sponsored, owned or endorsed by mkdocs, swagger, or any other 3rd party.
Credits to @aviramha for starting this project.
Metadata
Release files for mkdocs-render-swagger-plugin 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mkdocs_render_swagger_plugin-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for mkdocs_render_swagger_plugin-0.1.2-py3-none-any.whl |
Release files / mkdocs_render_swagger_plugin-0.1.2-py3-none-any.whl
| Download URL | mkdocs_render_swagger_plugin-0.1.2-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0340d45e12a0f1633a4b8af2eb99ea75469006ddf418ef0f1acd51ed1e4969e4
|
|
BLAKE2b-256 checksum How to use checksums |
de0bcf5e4e9529a8068d4b2def4b38540f7a5762283bdd5b652ee083b8a7c9c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.12.0
|
Security for mkdocs-render-swagger-plugin 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.