Validator for RAC JSON Schemas
Project description
rac_schema_validator
Validators for RAC JSONSchemas.
Requirements
- Python 3.9 or higher
- jsonschema
- tox (for running tests)
- pre-commit (for running linters before committing)
Installation
The recommended way to install this package is using pip
:
pip install rac_schema_validator
After installing pre-commit, install the git-hook scripts:
$ pre-commit install
Usage
This library has one main public method, is_valid()
, which takes two required
arguments:
- the data to be validated
- the JSONSchema to validate against
and a third optional argument:
- a base schema to resolve references against (see official docs)
from rac_schema_validator import is_valid
data = {"key": "value" ... }
schema = { ... }
is_valid(data, schema)
Invalid data will raise a rac_schema_validator.exceptions.ValidationError
, and
an invalid schema will raise a jsonschema.exceptions.SchemaError
.
Tests
rac_schema_validator
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
File details
Details for the file rac_schema_validator-0.1.tar.gz
.
File metadata
- Download URL: rac_schema_validator-0.1.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d8a940fc790a5daa6f9ba797805efeb5068a294f9e639c84f5c02ae1ba32421 |
|
MD5 | b3b6bbc8034594eacc26c064bd11247d |
|
BLAKE2b-256 | f5c126ae825824bc7853e1b57b48f86522b3418ca2ce1282f372de5b0e6b98e3 |
File details
Details for the file rac_schema_validator-0.1-py3-none-any.whl
.
File metadata
- Download URL: rac_schema_validator-0.1-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f90831715b33b0a4a77904e699b115d66248d8e30e8f1748adb3931b206d2b0 |
|
MD5 | a75ed527ec170fa7c8c46ef6b11e7439 |
|
BLAKE2b-256 | ae3f92ad3a87aa6e5cc855be4ebaf06f303210c218d51534b15c3b57516231cf |