Giter VIP home page Giter VIP logo

jsonschema-markdown's Introduction

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.  [default:
                            footer]
  --resolve / --no-resolve  [Experimental] Resolve $ref pointers.  [default:
                            no-resolve]
  --debug / --no-debug      Enable debug output.  [default: no-debug]
  --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.

jsonschema-markdown's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.