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.2.2.tar.gz
.
File metadata
- Download URL: drf-jsonschema-0.2.2.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69f25382b82f86c8131d09231058deb5ba5e1a460a15474c6ece0734d365a9f2 |
|
MD5 | 3586c1921a39ae612c4d69af35bd5956 |
|
BLAKE2b-256 | a6db5f901b477af43fd41f49ec058c0a007df3e06ca081d050aa9de5c7405022 |
File details
Details for the file drf_jsonschema-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: drf_jsonschema-0.2.2-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29f08e2f8e15f4175563086066a02f21fa779f2eb12d02a4ba5359432b20fdde |
|
MD5 | 5ba28bca91efa8a78f9d929dca90f57a |
|
BLAKE2b-256 | a934c88c9e82d8b6896819f3c93425d2e7e1e6de1a0d56c8e9f79ec52b235fa7 |