Converter from Swagger to Sphinx HTTP domain.
Project description
Swagger is an open specification for documenting REST APIs in JSON or YAML. Imperfect as it is, it’s de facto a standard for many API developers.
This extension lets you render your swagger.json file as a Sphinx document. It uses HTTP domain directives for paths and a glossary for definitions.
Warning
This extension was created for a particular project and thus is only guaranteed to work with this particular project! It is very much likely you’ll have to modify swagger-api.rst for your project.
Usage
Install the extension:
$ pip install sphinxcontrib-swagger2sphinx
Copy the content of swagger-api.rst to the file where you want your Swagger file rendered.
Add the extension to your conf.py:
extensions = [ 'sphinxcontrib.swagger2sphinx', ... ]
Specify the path to your Swagger file in conf.py. It can be a local path or a URL:
swagger2sphinx_swagger_location = "swagger.json" # swagger2sphinx_swagger_location = "http://example.com/swagger.json"
Testimonials
Thanks to Eric Holscher for writing an excellent blog post about extending Sphinx with Jinja2 templating.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size sphinxcontrib_swagger2sphinx-0.1.2-py3-none-any.whl (4.6 kB) | File type Wheel | Python version 3.5 | Upload date | Hashes View |
Hashes for sphinxcontrib_swagger2sphinx-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6d4847ac5f066d2da741a450ae8cee60c6c9a5905af4320dd16e45081f64f3e |
|
MD5 | 9a08afda0e9e3206f6f585646da8b91d |
|
BLAKE2-256 | abb5c8f5b9567c1c65cda024abb916f45e2051325f09ddd7fa28ece23bccc9cd |