Metadata-Version: 2.1
Name: kaiju-config-validator
Version: 0.1.0
Summary: Application config validation library using JSONSchema
Home-page: https://github.com/violet-black/kaiju-config-validator
Author: violetblackdev@gmail.com
License: MIT
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: Implementation :: CPython
Requires-Python: >=3.12
Description-Content-Type: text/markdown
Requires-Dist: kaiju-app
Requires-Dist: jsonschema-gen
Requires-Dist: fastjsonschema
Provides-Extra: dev
Requires-Dist: pip-tools ; extra == 'dev'
Requires-Dist: tox ; extra == 'dev'
Requires-Dist: mypy ; extra == 'dev'
Requires-Dist: isort ; extra == 'dev'
Requires-Dist: black ; extra == 'dev'
Requires-Dist: pylint ; extra == 'dev'
Requires-Dist: pre-commit ; extra == 'dev'
Provides-Extra: docs
Requires-Dist: sphinx ; extra == 'docs'
Requires-Dist: python-docs-theme ; extra == 'docs'
Requires-Dist: m2r2 ; extra == 'docs'
Provides-Extra: test
Requires-Dist: pytest ; extra == 'test'
Requires-Dist: coverage ; extra == 'test'

[![pypi](https://img.shields.io/pypi/v/kaiju-config-validator.svg)](https://pypi.python.org/pypi/kaiju-config-validator/)
[![codecov](https://codecov.io/gh/violet-black/kaiju-config-validator/graph/badge.svg?token=FEUUMQELFX)](https://codecov.io/gh/violet-black/kaiju-config-validator)
[![tests](https://github.com/violet-black/kaiju-config-validator/actions/workflows/tests.yaml/badge.svg)](https://github.com/violet-black/kaiju-config-validator/actions/workflows/tests.yaml)
[![code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

[![python](https://img.shields.io/pypi/pyversions/kaiju-config-validator.svg)](https://pypi.python.org/pypi/kaiju-config-validator/)

**kaiju-config-validator** is designed to work with [kaiju-app](https://kaiju-app.readthedocs.io) library to validate
project configuration dictionary for a set of application service classes. It analyzes `__init__` methods of services
to check the input data before creating an app object.

[fastjsonschema](https://github.com/horejsek/python-fastjsonschema) library is used to validate JSONSchema files.

# Installation

With pip and python 3.12+:

```bash
pip3 install kaiju-config-validator
```

# How to use

The configuration process is straightforward.
Use the standard application configuration process as described in the [kaiju-app documentation](https://kaiju-app.readthedocs.io).

```python
from kaiju_config_validator import ConfigValidator
from kaiju_app import Application, ApplicationLoader, Configurator

loader = ApplicationLoader()
loader.service_classes[...] = ...
config = Configurator().create_configuration([...], [...])
```

As soon as a project config dict is produced you can pass it to the validator method along with service classes
map and an application class. The validator will either raise a `InvalidConfiguration` or return `None` if everything
is fine.

```python
ConfigValidator().validate_project_config(Application, loader.service_classes, config)
```
