json-schema-gendoc

JSON Schema documentation generator

Usage no npm install needed!

<script type="module">
  import jsonSchemaGendoc from 'https://cdn.skypack.dev/json-schema-gendoc';
</script>

README

JSON Schema documentation generator

Basic tool used to generate human-readable Markdown documentation from a JSON Schema Validation file. Can be used as a standalone CLI-tool, or imported into an existing JavaScript-project.

Currently, only a small part of the standard is supported.

Preview

Configuration.md is generated from config.schema.json in this repository.

Installation

npm install -g json-schema-gendoc

Usage

Use the following command to genearate a Markdown document from a JSON Schema Validation file.

json-schema-gendoc /path/to/json-schema-file.json

Configuration

json-schema-gendoc can be configured using by creating a file named .json-schema-gendoc.json in the current working directory. The default configuration is included below. All properties are optional. Use translations to translate standard messages into your preferred language if it does not exist in the translations folder (or, even better, create a translation file and send me a PR), and schemaFile to define which file you'd like to generate documentation from.

See Configuration.md for details.

{
    "schemaFile": null,
    "title": null,
    "outputFormat": "markdown",
    "language": "en",
    "translations": {
        "examples": "Examples",
        "properties": "Properties",
        "enum": "Possible values",
        "default": "Default value"
    }
}

Usage without CLI

TODO Document this feature.

See cli.js for an example on how this can be used directly.