Django JSON Schema Field Validator
JSON Schema validation for Django JSONField.
Quickstart
Installation
pip install jsonfield-validation
Usage
from jsonfield_validation import JsonSchemaValidator
class MyModel(models.Model):
items = models.JSONField(
validators=[
JsonSchemaValidator({"maxItems": 2})
]
)
Like any Django model field validator, validation happens when clean_fields() is called on a model instance:
>>> instance = MyModel(items=[1, 2, 3])
>>> instance.clean_fields()
django.core.exceptions.ValidationError: {'items': ["[1, 2, 3] is too long"]}
Further documentation is gratiously hosted by Read the Docs
Credits
This package was created with Cookiecutter and the pymetrics/cookiecutter-python-library project template.
History
0.3.0 (2022-06-15)
Add path to invalid value to error_list message,
0.2.0 (2022-06-15)
Add check method.
0.1.0 (2022-06-14)
First release on PyPI.
Metadata
Release files for jsonfield-validation 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jsonfield_validation-0.3.0.tar.gz | 13.4 kB | Without provenance | Details for jsonfield_validation-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jsonfield_validation-0.3.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for jsonfield_validation-0.3.0-py2.py3-none-any.whl |
Total release size: 18.2 kB
Release files / jsonfield_validation-0.3.0.tar.gz
| Download URL | jsonfield_validation-0.3.0.tar.gz |
|---|---|
| Size | 13.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca63959d76d0b54cab904faa922cd7c93ba680e61bc051ee41dd873108fb123a
|
|
BLAKE2b-256 checksum How to use checksums |
9076a5da1f3f7ee53daac40728765936ad130e235f0ea3b495a9743a47f42fde
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.0
|
Release files / jsonfield_validation-0.3.0-py2.py3-none-any.whl
| Download URL | jsonfield_validation-0.3.0-py2.py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
077478c4ab292d4012e62c8f7cab06730297e023a72303cacf569b4cc47dc5ba
|
|
BLAKE2b-256 checksum How to use checksums |
9e15659127732e24cbd4f2460e7dda4f80c54f8d7a1881a7791888a87a2c38a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.0
|
Security for jsonfield-validation 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.