Skip to main content

Documentation generator for Swagger API

Project description

Swagger API Docs Generator for Foliant

This preprocessor generates Markdown documentation from JSON generated by Swagger. It uses Jinja2 templating engine for customizing the layout.

Installation

$ pip install foliantcontrib.swaggerdoc

Config

To enable the preprocessor, add pgsqldoc to preprocessors section in the project config:

preprocessors:
    - swaggerdoc

The preprocessor has a number of options:

preprocessors:
    - swaggerdoc:
        swagger_json_urls: http://localhost/swagger.json
        swagger_json_paths: swagger.json
        template: swagger.j2

swagger_json_urls : URL to JSON generated by Swagger or several such urls (in this case use yaml list format).

swagger_json_paths : path to JSON generated by Swagger relative to project dir or several such paths (in this case use yaml list format).

Important notice about those json files. Preprocessor would start parsing JSONS from the first url, subsequently merging data from following JSONS in the same order they are declared in config. First URLs, then paths.

template : Path to jinja-template for rendering the generated documentation. Path is relative to the project directory. Default: swagger.j2

Usage

Add a <<swaggerdoc></swaggerdoc> tag at the position in the document where the generated documentation should be inserted:

# Introduction

This document contains the automatically generated documentation of our API.

<<swaggerdoc></swaggerdoc>

Each time the preprocessor encounters the tag <<swaggerdoc></swaggerdoc> it inserts the whole generated documentation text instead of it. The paths or urls to swagger.json are taken from the config-file.

You can also specify some parameters (or all of them) in the tag options:

# Introduction

Introduction text for API documentation.

<swaggerdoc swagger_json_urls="http://localhost/swagger.json"
            template="swagger.j2">
</swaggerdoc>

Tag parameters have the highest priority.

Use comma to have several urls\paths in tag options.

This way you can have documentation from several different JSON files in one foliant project (even in one md-file if you like it so).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

foliantcontrib.swaggerdoc-1.0.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file foliantcontrib.swaggerdoc-1.0.0.tar.gz.

File metadata

  • Download URL: foliantcontrib.swaggerdoc-1.0.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.14.2 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.1

File hashes

Hashes for foliantcontrib.swaggerdoc-1.0.0.tar.gz
Algorithm Hash digest
SHA256 1d55797b341d7462081d4bf8a73fd30cc271b00d24c903e3595d21d2ebfb0512
MD5 121c7d6a88d4aa5eececd5579a2ea457
BLAKE2b-256 3e64b853d12ae7077ae54b172b2246a0d64edfb68a202a70b6687b701a133c22

See more details on using hashes here.

File details

Details for the file foliantcontrib.swaggerdoc-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: foliantcontrib.swaggerdoc-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.14.2 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.1

File hashes

Hashes for foliantcontrib.swaggerdoc-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a175ee545990503a3085e4dd84a0c226e51949003d835d6d9a2cb37e76ea6f8
MD5 8ec10cbcd257a23cf15315367f68abc2
BLAKE2b-256 b0ba4923916aad2d6dc6e8a8018dfcb891992109270368c033e658bb4b2967d4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page