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
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
Built Distribution
File details
Details for the file jsonschema2rst-0.1.6.tar.gz
.
File metadata
- Download URL: jsonschema2rst-0.1.6.tar.gz
- Upload date:
- Size: 27.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb41f9410a6a90fcdefec04d9a80396a637aca8b7d7b4e7e6621a4bf6742c019 |
|
MD5 | a599d642bf1552ecf66cd684dfcddb00 |
|
BLAKE2b-256 | f0d46cb1f48cedb4372522089cf7b8c20b87b7a26bddd484ebf25d1f88c41634 |
File details
Details for the file jsonschema2rst-0.1.6-py3-none-any.whl
.
File metadata
- Download URL: jsonschema2rst-0.1.6-py3-none-any.whl
- Upload date:
- Size: 33.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0646afc2060ae1ec07be8af599edc9f847234cab7d5561c00575d7011de61011 |
|
MD5 | 57677775074476666ec480ac2ad75a22 |
|
BLAKE2b-256 | 333e52c9bf0f0f030636189508931a9f060658ced1fe61adc227649a8499f02e |