RAC JSON Schemas and validators
Project description
rac_schemas
JSON schemas and validation helpers.
Requirements
-
Python 3.4 or higher
-
tox (for running tests)
-
pre-commit (for running linters before committing)
- After installing pre-commit, install the git-hook scripts:
$ pre-commit install
Installation
The recommended way to install this package is using pip:
pip install rac_schemas
Usage
This library has one main public method, is_valid(), which takes a dict as the first argument and a schema filename as the second.
from rac_schemas import is_valid
data = {"key": "value" ... }
is_valid(data, "object.json")
rac_schemas will attempt to add an appropriate extension to schema filenames in cases where it is either missing or incorrect. For example, if either schema and schema.org as schema filenames, rac_schemas will attempt to open schema.json.
Invalid data will raise a jsonschema.exceptions.ValidationError, and an invalid schema filename will raise a FileNotFoundError.
Available schemas
All schemas are located in the schemas/ subdirectory of the rac_schemas/ directory.
Tests
rac_schemas comes with unit tests as well as linting. The easiest way to make sure all tests pass is to run tox from the root of the repository. This will execute all tests, and will also run autopep8 and flake8 linters against the codebase.
License
Code is released under an MIT license. SeeLICENSE.md.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rac_schemas-0.8.tar.gz.
File metadata
- Download URL: rac_schemas-0.8.tar.gz
- Upload date:
- Size: 9.2 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.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
474dfb6cbbbd3845d733dde693785228f7423bd05df551ba0fb7f5df3c74210b
|
|
| MD5 |
b006ee2dda80a1460780f34c953189ca
|
|
| BLAKE2b-256 |
f3b1fcba234feaf764fcd3f798c8c13002e31f70eae699d30ac1057c1b18d17a
|
File details
Details for the file rac_schemas-0.8-py3-none-any.whl.
File metadata
- Download URL: rac_schemas-0.8-py3-none-any.whl
- Upload date:
- Size: 12.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.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8388e19fb29e782c4e65626c965c7a93af4d56e97d5f8dbcf2ed153ca7d4604d
|
|
| MD5 |
5c7845a2cfa4b8f89fa40411b499c27a
|
|
| BLAKE2b-256 |
5e8e2c09942deff2c4de16f6ac8512db7c3a81aec1a819be457837a1f70e9da4
|