Pythonish object scheme validator
Project description
# pythonish-validator
[![Build Status](https://travis-ci.org/bugov/pythonish-validator.svg?branch=master)](https://travis-ci.org/bugov/pythonish-validator)
Data validation library for Python without complex schemas.
It's how you write Python code:
```Python
from pythonish_validator.common import Validator
validator = Validator({
'name': str,
'age': int,
'skills': [str]
})
validator.is_valid({
'name': 'Georgy',
'age': 29,
'skills': ['Python', 'Perl', 'C']
})
```
What can be easier?
# Install
```bash
pip3 install pythonish-validator
```
## Error messages
```Python
from pythonish_validator.common import validate
validator = validate({
'name': str,
'age': int,
'skills': [str]
}, {
'name': 'Georgy',
'age': None,
'skills': ['Python', 'Perl', 42]
})
assert validator.repr_errors() == [
"{'age'}->NoneType(None)",
"{'skills'}->[2]->int(42)"
]
```
If you find any mistake – please write to the [issue list 🐨](https://github.com/bugov/pythonish-validator/issues).
[![Build Status](https://travis-ci.org/bugov/pythonish-validator.svg?branch=master)](https://travis-ci.org/bugov/pythonish-validator)
Data validation library for Python without complex schemas.
It's how you write Python code:
```Python
from pythonish_validator.common import Validator
validator = Validator({
'name': str,
'age': int,
'skills': [str]
})
validator.is_valid({
'name': 'Georgy',
'age': 29,
'skills': ['Python', 'Perl', 'C']
})
```
What can be easier?
# Install
```bash
pip3 install pythonish-validator
```
## Error messages
```Python
from pythonish_validator.common import validate
validator = validate({
'name': str,
'age': int,
'skills': [str]
}, {
'name': 'Georgy',
'age': None,
'skills': ['Python', 'Perl', 42]
})
assert validator.repr_errors() == [
"{'age'}->NoneType(None)",
"{'skills'}->[2]->int(42)"
]
```
If you find any mistake – please write to the [issue list 🐨](https://github.com/bugov/pythonish-validator/issues).
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file pythonish-validator-0.1.tar.gz
.
File metadata
- Download URL: pythonish-validator-0.1.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 607c86335db1b8450349feee47298cee70b4e99216866762fedfb13c13f6cec3 |
|
MD5 | 5c684aec57eea09d2bb0bc3c1a67ea4f |
|
BLAKE2b-256 | e655dd9d24e116ab36b5ac5fd378897f1f072e016fa414f2730e5bf20484f70b |