Skip to main content

Parser for yaml/json schemas to rst

Project description

This project aims to parse JSON schemas or YAML schemas in order to create RestructuredText documentation. Using a tool like Sphinx, it is possible to create high readable documentation from the files generated, which are RST formatted text.

The outcome RST can be customized by defining a blacklist in csv and using a custom CSS file. that will inherit the Sphinx one. For the latter, an example is provided.

Usage

To create RST files from JSON schemas (or YAML) run the command:

jsonschema2rst input_folder output_folder

This command will take all JSON or YAML files in this path, sub-folders included, and wll create a new directory - removing it if already exists - where all parsed RST file will be placed.

Example

Let’s assume you run the following command:

jsonschema2rst json_folder rst_output_folder

and also let’s assume the folder json_folder contains the file url.json, which contains the following schema:

{
    "title": "URL of related document",
    "properties": {
        "description": {
            "type": "string"
        },
        "value": {
            "format": "url",
            "type": "string"
        }
    },
    "type": "object"
}

As result, jsonschema2rst will create a file called url.rst in the rst_output_folder that will contain the following rst code:

.. contents:: Table of Contents
.. section-numbering::
.. container:: section-title
 url.json

.. container:: title

 URL of related document

**type** : ``object``

**Properties:** description_, value_


.. description:

description
+++++++++++

**type** : ``string``


.. value:

value
+++++


**type** : ``string``

**format** : ``url``

Extra

In case you want to generate HTML documentation using a tool like Sphinx, we suggest you to try the custom.css file in the contribution folder to make your schemas documentation looking better. What you need is just replace the default css used by Sphinx in the conf.py file with the one proposed, then enjoy!

Project details


Download files

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

Source Distribution

jsonschema2rst-0.0.9.tar.gz (14.0 kB view details)

Uploaded Source

File details

Details for the file jsonschema2rst-0.0.9.tar.gz.

File metadata

File hashes

Hashes for jsonschema2rst-0.0.9.tar.gz
Algorithm Hash digest
SHA256 74ef01479d75cc9e1efd77412e89f4d76fb2d40628cf27f8039f04c41d162f75
MD5 326a3be2db053ab4ef1cbdaf3aba027b
BLAKE2b-256 b41b4f72167fa0a5c190cf061b86b4fb3282964f0c877b97ea9ff947f0a2fd51

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