This package provides pydantic models that allow validation of
JSONLogic.
It does not provide a means to execute/evaluate any JSONLogic.
An example of how this could be useful would be an API that accepts JSONLogic, the models provided by this package could then be used to generate API docs and/or to generate an API client.
In its current state it supports all the test cases that were available at the time of writing on https://jsonlogic.com/tests.json however those cases are limited and only cover a small portion of what is possible.
Over time the models will improve and will maybe someday be completely compliant. The best way to achieve this is of course to add any failing, but valid JSONLogic, to the test cases.
Feel free to contribute in any way you can.
Getting the project up and running can be achieved without much effort using Docker Compose. Doing so ensures that there should be very little difference in environment between all of us devs.
docker compose build
docker compose run --rm pydantic-jsonlogic sh
The last command gives you a shell within the container.
We shouldn't have any other dependencies other than python and pydantic.
However, we do have some dev dependencies like:
- black
- mypy
- isort
- pytest
We will do our best to keep those up to date. Should you want to upgrade them yourself, please do it from the shell inside the container using:
poetry update
Similarly, installing new dependencies is possible using the command:
poetry add
See https://python-poetry.org/ for more information on how poetry works.
We do have some conditions that we would our code to adhere to:
- Formatted using black
- Imports sorted using isort
- Static analysis using mypy on strict mode
- Test cases using pytest
These tools can all be executed inside the container.