Skip to main content

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

  1. 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)])
  2. 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):
        ...
  3. 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

drf-jsonschema-0.1.3.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

drf_jsonschema-0.1.3-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

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

Hashes for drf-jsonschema-0.1.3.tar.gz
Algorithm Hash digest
SHA256 8219087dd6b7f6a264275371aee61c96f6fc19a1478f70deaa5e7c8121b7a9c4
MD5 57ea7b0e9cf3747c07f925b43242e6d8
BLAKE2b-256 0e8dee13978750afda748a98d9e31278c7019449013ff8a27624700a39d4d008

See more details on using hashes here.

File details

Details for the file drf_jsonschema-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for drf_jsonschema-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 02228e144ab4a70467697b70632dc02d921cfc30aa6a508486535bb5c59fa416
MD5 fe99ea170461018307a4eac4660ec613
BLAKE2b-256 e486941c1fc79e13212e15f15df92d341377b0986a954bc267347b3eea2bd4a7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page