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.1.2.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

jsonschema2rst-0.1.2-py2-none-any.whl (33.2 kB view details)

Uploaded Python 2

File details

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

File metadata

  • Download URL: jsonschema2rst-0.1.2.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

File hashes

Hashes for jsonschema2rst-0.1.2.tar.gz
Algorithm Hash digest
SHA256 30da035e2e719c7c30865e4c8cbafcd05618f9a711588a98c628bca2b378f4e7
MD5 3078c3401fbd22cc780c5b623e11ac3a
BLAKE2b-256 f875b141b9cf65654393d5143549c6a1d2982950aa0ed19249cf9c89c14c0f2f

See more details on using hashes here.

File details

Details for the file jsonschema2rst-0.1.2-py2-none-any.whl.

File metadata

  • Download URL: jsonschema2rst-0.1.2-py2-none-any.whl
  • Upload date:
  • Size: 33.2 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

File hashes

Hashes for jsonschema2rst-0.1.2-py2-none-any.whl
Algorithm Hash digest
SHA256 9700b98c8410fb83ca91a351a4204f5706c0bf08f474eda4bd22e11cb74a24d5
MD5 6a8b87b280dfd42464bd379988845a24
BLAKE2b-256 086fb09b99ecb5074e250431f934e3f5f15c1d5f0d03dd8c4e16bbfc5cc9024d

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