OpenAPI Specification to AsciiDoc
Overview
The OpenAPI Specification to AsciiDoc is a set of Jinja2 templates that will help you create readable API documentation from a JSON OpenAPI Specification file.
AsciiDoc is a versatile plain-text writing format which you can use as it is, or can easily be converted to pdf.
Installation
To use the templates, you need to install the openapi_to_asciidoc module.
pip install -U openapi-to-asciidoc
Usage
To convert your OpenAPI Specification, type:
$ o2a -j <path-to-open-api-spec>.json -o <path-to-output-file>.adoc
or
$ openapi-to-asciidoc -j <path-to-open-api-spec>.json -o <path-to-output-file>.adoc
This will generate an AsciiDoc from your OpenAPI Specification.
The templates are created with the OpenAPI Specification v.3.1.0 as a base. If your specification contains sections that are not included or requires improvement, please feel to provide an PR or file an issue.
Objects
openapi-to-asciidoc creates objects with the help of Marshmallow in order to generate the templates. Each object of the specification follows the rules of its SchemaObject and can be generated independently, but most users will probably use the OpenAPISchema as their starting point.
All Objects of the OpenAPI specification are represented in objects.py and can be changed and modified depending on your needs. All but the OpenAPI object has their call to super() commented out to speed up processing. If you would like to just render a specific model, just enable the call to super() and you are good to go!
Example:
If you where to render and print just the Schema Object from an json string containing SchemaObject data, You would make the call to Super in the SchemaObject's init method, then you could just render it like this:
var data = get_json_data() # Get json data of the Schema object however you like
schema_as_asciidoc: SchemaObject = SchemaObjectSchema().load(data) # Render the SchemaObject
print(schema_as_asciidoc.result) # Print the asciidoc generated output
The code in convert.py is a good starting point to examine what's going on under the hood.
Requirements
In order to run the templates, you need to have following installed:
- Python
- pip
PIP Dependencies
Known bugs and issues
-
Nested objects and lists. Objects using it's own Schema to render fields (Like the SchemaObjectSchema) might get less than perfect output if it contains a lot of nested objects.
-
Page breaks. The generated document is just an AsciiDoc, so if you want to export it as a PDF for example, there is no functionality for page breaks.
-
Special characters. Sometimes JSON specifications contains characters that are used for styles in AsciiDoc (like quotes '', asterisk *, HTML tags etc.). There is no handling of these characters, so some sections may look a bit odd. These issues often appear when an object or list is too nested for the template.
-
Specification extensions There might be some inconsistencies in how the specification support is presented in the finished AsciiDoc document. If this is a feature that is widely used, the implementation may have to be tweaked to each individual template.
Limitations
The API Specification needs to be in JSON format, and built according to the OpenAPI Specification standard. If your specification contains sections that are not stated in the OpenAPI Specification, the template will not print that information in the generated document.
Possible improvements
-
Escaping of special characters Some characters like i.e html tags could possibly be handled better.
-
Schema object is referring to it self during parsing, which works fine for most use cases, but if you have Schema objects with nested properties for example, the output will look a bit strange. This could be handled differently, but given the Schema object's flexible structure, there might be a need to tweak this object to best suit your needs anyways.
Contribute
Want to help out? Read this.
Metadata
Release files for openapi-to-asciidoc 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| openapi_to_asciidoc-0.1.6.tar.gz | 21.3 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| openapi_to_asciidoc-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 46.7 kB
Release files / openapi_to_asciidoc-0.1.6.tar.gz
| Download URL | openapi_to_asciidoc-0.1.6.tar.gz |
|---|---|
| Size | 21.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6d069f08d693f4ab1f5961c97e6bcdcc962ff19821c341c16a6f88c93124ca48
|
|
BLAKE2b-256 checksum How to use checksums |
3a4acf274965b366d9b84c1a9d51afcd86997161e390ffe21869cc508ca3474a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 3, 2026.
Transparency logRelease files / openapi_to_asciidoc-0.1.6-py3-none-any.whl
| Download URL | openapi_to_asciidoc-0.1.6-py3-none-any.whl |
|---|---|
| Size | 25.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f4c1349e8444324f0193be8f0856aa9f3874a07dca98d8ebf94bcec5532bee0b
|
|
BLAKE2b-256 checksum How to use checksums |
c7ecf2bd1c600e204451a4b7d6731d74dd0ef8c6fc33884944ead4d43a307d9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 3, 2026.
Transparency logSecurity for openapi-to-asciidoc 0.1.6
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for openapi_to_asciidoc-0.1.6.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 3, 2026.
Transparency logA 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.