A package that constructs JsonSchema validation error into error tree for Django Rest Framework with custom error message in compliance with the DRF error message.
Project description
drf-jsonschema, created by Kiratech from extending jsonschema package. This package provides JsonSchemaField and constructs JsonSchema validation error into error tree for Django Rest Framework with custom error message.
This package will install jsonschema automatically so manual installation is not necessary.
Quick Start
You can use JsonSchemaFieldValidator in Django’s models.py as such:
from drf_jsonschema import JsonSchemaFieldValidator ... ... json_data = models.JSONField(validators=[JsonSchemaFieldValidator(schema=your_json_schema)])
On serializers.py, modify the serializer field mapping from JSONField to JSONSchemaField as the example below:
from drf_jsonschema.serializers import JsonSchemaModelSerializer class YourSerializer(JsonSchemaModelSerializer): ...
For more information, visit jsonschema
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
Built Distribution
File details
Details for the file drf-jsonschema-0.1.3.tar.gz
.
File metadata
- Download URL: drf-jsonschema-0.1.3.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8219087dd6b7f6a264275371aee61c96f6fc19a1478f70deaa5e7c8121b7a9c4 |
|
MD5 | 57ea7b0e9cf3747c07f925b43242e6d8 |
|
BLAKE2b-256 | 0e8dee13978750afda748a98d9e31278c7019449013ff8a27624700a39d4d008 |
File details
Details for the file drf_jsonschema-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: drf_jsonschema-0.1.3-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02228e144ab4a70467697b70632dc02d921cfc30aa6a508486535bb5c59fa416 |
|
MD5 | fe99ea170461018307a4eac4660ec613 |
|
BLAKE2b-256 | e486941c1fc79e13212e15f15df92d341377b0986a954bc267347b3eea2bd4a7 |