Metadata-Version: 2.1
Name: rac_schema_validator
Version: 1.0
Summary: Validator for RAC JSON Schemas
Home-page: http://github.com/RockefellerArchiveCenter/rac_schema_validator
Author: Rockefeller Archive Center
Author-email: archive@rockarch.org
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: jsonschema

# rac_schema_validator

Validators for RAC JSONSchemas.

## Requirements
- Python 3.10 or greater
- [jsonschema](https://python-jsonschema.readthedocs.io/en/stable/)
- [tox](https://tox.readthedocs.io/) (for running tests)
- [pre-commit](https://pre-commit.com/) (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](https://python-jsonschema.readthedocs.io/en/latest/references/))

```
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. See`LICENSE.md`.
