Metadata-Version: 2.1
Name: rac-schemas
Version: 0.30
Summary: RAC JSON Schemas and validators
Home-page: http://github.com/RockefellerArchiveCenter/rac_schemas
Author: Rockefeller Archive Center
Author-email: archive@rockarch.org
License: MIT
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: jsonschema

# rac_schemas

JSON schemas and validation helpers.

## Requirements
*   Python 3.4 or higher
*   [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)
    *   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.

## Documentation

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

A simplified overview of the data model is below:

![Simplified data model overwiew](Simplified_Data_Model.png "Data Model Overview")

### Requirements

*   Python 3.4 or higher
*   [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans)

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


