A utility to validate JSON schemas with jsonschema with simplejson
Project description
Package
This package is a wrapper for jsonschema and simplejson to simplyfy JSON schema validation specified by JSON Schema Draft 7 (link to IETF).
Example
from validator import validate
# Define the validation schema
schema = {
"type": "object",
"required": [
"name",
"age",
],
"properties": {
"name": { "type": "string" },
"age": { "type": "number" },
}
}
# Data to be validated
data = {
"name": "Daniel",
"age": 30,
}
# Validate and run
validation = validate(schema, data)
if validation==True:
# do something with data, e.g. create a new friend
else:
print(validation) # will show a well formated dict with errors
Note: More examples can be shown in the tests
Contribute
This package is intended to be used by private projects. But go ahead if you like and make comments and pull requests and I might look into it.
Install the package
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Run tests
python -m pytest -m validator -s
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 Distribution
Built Distribution
File details
Details for the file schema-validator-halpa-0.0.4.tar.gz
.
File metadata
- Download URL: schema-validator-halpa-0.0.4.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 578999a96b67209708e3b75ac5723f388bcf2e2be6209e143655fe63e8495e7c |
|
MD5 | a1bb5c39ec7ae0b3268c05caf1bbfcf9 |
|
BLAKE2b-256 | 779ff08d7b57ff32a93e3fd3ed59b7122372c40297e1fafa808a27cd1439d733 |
File details
Details for the file schema_validator_halpa-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: schema_validator_halpa-0.0.4-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b77412db36f04a8dbb7eaeae74e6e4bcdaefb8bec9ceef420000f0b864c67f8 |
|
MD5 | ab20a6a6e1bf223a21d099643bfceb58 |
|
BLAKE2b-256 | a0ec14dfff6257bf3bbb79f5bf54b2a0e8552bd04da9778be396467a4c2ed9f5 |