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.3.1.tar.gz (9.0 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.3.1-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rac_schemas-0.3.1.tar.gz
  • Upload date:
  • Size: 9.0 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.43.0 CPython/3.8.2

File hashes

Hashes for rac_schemas-0.3.1.tar.gz
Algorithm Hash digest
SHA256 2539ddaefb64ebed99e2bc7da324bbd6329c60a76fb81dc79af8305855efda17
MD5 d4c8085c2f3180deb0ea5b47af330abe
BLAKE2b-256 a3c6d7be304255fdfb6d735f38b201414a3e35cd74003ec993348033711ee44f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rac_schemas-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 12.4 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.43.0 CPython/3.8.2

File hashes

Hashes for rac_schemas-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9df8c236483aafb7f49c6a4c90005e7d685f1bea945d33ffc85305a74bae28b7
MD5 6ce5d2eea322a39c33bf31d13e5f25a3
BLAKE2b-256 173ab843fe3a36209023643b94e5c89d11a3f56198e4b3716c54a6c70464b35c

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