Skip to main content

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:
  --footer / --no-footer  Add a footer with the time the markdown was
                          generated and a link to the project.
  --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


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

jsonschema_markdown-0.1.8-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file jsonschema_markdown-0.1.8-py3-none-any.whl.

File metadata

File hashes

Hashes for jsonschema_markdown-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 4d2b4155c2ede119dfb51d1540b8aa9ed7aa8abe25ee6b640c64fc10dc87111d
MD5 4bcc0ab5e23ac1645827cb0340e0c92f
BLAKE2b-256 f125f1fa49c4aeae99340c9e7d9924cced4706938bbe16a32a4aaf380672d396

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 Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page