validate complex json data against rules you defined
Project description
Poseidon Rules
Validate complex json data against rules you defined.
Philosophy of this library
Business code has complex logic, and they can be wrapped deeply, so we need a DSL to define these rules in one place.
Every logic can have two basci relation, and or or, but the not logic is left to the rule evaluation written by developer.
Once one rule is not satisfied, the whole logic rule will be falsy, call the help function get_reason_stack will find the deepest name of rule, aka the exception message wrapped in the RuleFail.
Rules is defined in dict format, which is bad compared to the Haskell lazy evaluation. So you can pass a closure function to the "must" or "else_must", which will be called when "if" is evaluated to true ("must") or false ("else_must") at runtime, instead of define-time. This feature make you free from caring about the exception in some situations.
Usage
See test
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file poseidon_rules-0.1.4-py3-none-any.whl.
File metadata
- Download URL: poseidon_rules-0.1.4-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db51b818e2781b34c8495fce69e25abc7ac6f2437ba01f0234c79d6184c6ed5d
|
|
| MD5 |
4ad4c06bd3e836ec74ae2e6cd045e06b
|
|
| BLAKE2b-256 |
06871c5af644c5105b0c167a7a8a7da8ab0e5b30aef9ba4385f2cc0678b88b3a
|