Skip to main content

RAC JSON Schemas and validators

Project description

rac_schemas

JSON schemas and validation helpers.

Requirements

  • Python 3.4 or higher

  • jsonschema

  • 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


Download files

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

Source Distribution

rac_schemas-0.15.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rac_schemas-0.15-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file rac_schemas-0.15.tar.gz.

File metadata

  • Download URL: rac_schemas-0.15.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for rac_schemas-0.15.tar.gz
Algorithm Hash digest
SHA256 cb811554c3c833235b335de13069b89400bf44537f5a430fa484b9529584484e
MD5 2837ae79fcbcb234465f6df001c22b0a
BLAKE2b-256 c0d7d66ce8ff5fb178d49e4a824e9de9a1233988800d2d25fef7d530eae2e9c3

See more details on using hashes here.

File details

Details for the file rac_schemas-0.15-py3-none-any.whl.

File metadata

  • Download URL: rac_schemas-0.15-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for rac_schemas-0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 a0501cb8590b23f1a1c6f68b7bf8cd461d4f4c6a37534cdcf547ddb93736576f
MD5 c725e4c2e22a3dfdd59a990cd3f93fb9
BLAKE2b-256 b5bf82f8994ee8d44bd19a34cd5925c3b6a466e92012289ecfe2c12db29bb749

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page