Skip to main content

Generate static HTML documentation from JSON schemas

Project description

JSON Schema for Humans

Quickly generate a beautiful HTML static page documenting a JSON schema

Documentation

Installation

pip install json-schema-for-humans

Usage

generate-schema-doc [OPTIONS] SCHEMA_FILE [RESULT_FILE]

SCHEMA_FILE must be a valid JSON Schema

A CSS file will be copied in the same directory as RESULT_FILE

The default value for RESULT_FILE is schema_doc.html

Options

--minify/--no-minify

On by default

Minify the output HTML document

--deprecated-from-description

Off by default

Mark a property as deprecated (with a big red badge) if the description contains the string [Deprecated

--default-from-description

Off by default

Extract the default value of a property from the description like this: [Default `the_default_value`]

The default value from the "default" attribute will be used in priority

What's supported

See the excellent Understanding JSON Schema to understand what are those checks

The following are supported:

  • Types
  • Regular expressions
  • Numeric types multiples and range
  • Constant and enumerated values
  • Required properties
  • Default values
  • Array minItems, maxItems, uniqueItems, items (schema that must apply to all of the array items), and contains
  • Combining schema with oneOf, allOf, anyOf, and not

These are not supported at the moment (PRs welcome!):

  • String length and format
  • Property names, size, and pattern
  • Array items at specific index (for example, first item must be a string and second must be an integer)
  • Property dependencies
  • Examples
  • Media
  • Conditional subschemas

References from inside a schema and to schemas in other files are supported (for example { $ref: "#/definitions/something" } will be replaced by the content of schema["definitions"]["something"]).

Development

Testing

Just run tox

tox

Generating doc

The documentation is generated using jekyll and hosted on GitHub Pages

  • Change your current working directory to docs
  • Run python generate_examples.py. This will get all examples from tests/cases, render the resulting HTML and include it in the appropriate folders in the jekyll site.
  • If you have added an example, add the file name (without .json), the display name and description in _data/examples.yaml

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 Distribution

json-schema-for-humans-0.4.1.tar.gz (23.6 kB view details)

Uploaded Source

Built Distribution

json_schema_for_humans-0.4.1-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file json-schema-for-humans-0.4.1.tar.gz.

File metadata

  • Download URL: json-schema-for-humans-0.4.1.tar.gz
  • Upload date:
  • Size: 23.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6

File hashes

Hashes for json-schema-for-humans-0.4.1.tar.gz
Algorithm Hash digest
SHA256 3d9212c2f181443afbab863971404811973fba0278f120f9601fb76a3a9df8a8
MD5 ceb2e2af0e22f4638912665513e62891
BLAKE2b-256 74e2a65f8c0a48c6fa6ef54b9f3f53e52be561bf77d7fe40de6c54ec328bb704

See more details on using hashes here.

File details

Details for the file json_schema_for_humans-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: json_schema_for_humans-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6

File hashes

Hashes for json_schema_for_humans-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 117fbf1dc3a55b04091b83a1014bfd1ddb01930f5383c3523253a80849eaeb19
MD5 75b9da571b32ad441b41cf41aefc4c85
BLAKE2b-256 37a5d7b93938502f351896fda0959199c232fcc9087051e5ad51ff21cf7a4253

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