Skip to main content

Pitt JSON Schemas and validators

Reason this release was yanked:

typing error

Project description

pitt_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 pitt_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 pitt_schemas import is_valid

data = {"key": "value" ... }
is_valid(data, "object.json")

pitt_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, pitt_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 pitt_schemas/ directory.

Tests

pitt_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.

Documentation

Automatically generated HTML documentation in the docs/ directory based upon .json files in the schemas/ subdirectory of the pitt_schemas/ directory.

Requirements

Usage

Running generate_docs.py will iterate over the schemas/ subdirectory and write updated docs files to the docs/ directory.

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

pitt_schemas-0.11.tar.gz (11.8 kB view details)

Uploaded Source

File details

Details for the file pitt_schemas-0.11.tar.gz.

File metadata

  • Download URL: pitt_schemas-0.11.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.5

File hashes

Hashes for pitt_schemas-0.11.tar.gz
Algorithm Hash digest
SHA256 67a9597d19562044b8c51d5b6a264382dfc8a6a57f891158eebec49618eb544d
MD5 a527ef9ac2b13b298bc1b80a881969d8
BLAKE2b-256 f936cc38f01092e3c9e0e66ba53f5f6ad9f1c67ecbff20d05e19b3a688830ede

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