Export a JSON Schema document to Markdown documentation.
Project description
jsonschema-markdown
Generate markdown documentation from JSON Schema files. The main goal is to generate documentation that is easy to read and understand.
Can be used as a command line tool or as a library.
Installation
pip3 install jsonschema-markdown
Usage
To use jsonschema-markdown
as a CLI, just pass the filename as an argument and redirect
the output to a file.
$ jsonschema-markdown --help
Usage: jsonschema-markdown [OPTIONS] FILENAME
Load a file and output the markdown.
Options:
--version Show the version and exit.
--help Show this message and exit.
# Example
$ jsonschema-markdown schema.json > schema.md
Usage as a library
To use it as a library, load your JSON schema file as Python dict
and pass it to generate.
The function will return a string with the markdown.
import jsonschema_markdown
with open('schema.json') as f:
schema = json.load(f)
markdown = jsonschema_markdown.generate(schema)
Features
Partially inspired by json-schema-for-humans, this project does not currently support all features of JSON Schema, but it should support:
- Required fields
- String patterns
- Enumerations
- Default values
- Descriptions and titles
- Nested objects
- Basic OneOf, AnyOf, AllOf functionality
- Arrays
- Integers with minimum, maximum values and exclusives
- Boolean values
- Deprecation notices (searches for case-insensitive
deprecated
in the field description)
Caveats
- This project is still in early development, and the output may change in the future.
- Custom definitions are expected to be in the same file as the schema that uses them,
in the
definitions
or$defs
parameter at the root of the document.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file jsonschema_markdown-0.1.6-py3-none-any.whl
.
File metadata
- Download URL: jsonschema_markdown-0.1.6-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-1042-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a70b922f295f02b9c9c1281cfc193fe04617d8a607ca004fd60cf30f81e5eec8 |
|
MD5 | 4d168891a7b700e2f221ad610903ebba |
|
BLAKE2b-256 | ab504d045d6134da625e838cd6eae17916e5fb7c544b5e32cf4619830824a9c6 |