Skip to main content

Tiny tool for Django JSONField validation

Project description

django-json-field-schema-validator

Build Status Coverage Status Code style: black

Tiny tool for Django JSONField validation through JSON Schema

Installation

pip install django-json-field-schema-validator

Example

from django.db import models
from django_json_field_schema_validator.validators import JSONFieldSchemaValidator

schema = {
    '$schema': f'http://json-schema.org/draft-07/schema#',
    'type': 'object',
    'properties': {
        'foo': {'type': 'number'},
        'bar': {'type': 'string'}
    },
    'required': ['foo', 'bar']
}

class SomeModel(models.Model):
    some_field = models.JSONField(validators=[JSONFieldSchemaValidator(schema)])

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 django-json-field-schema-validator-0.0.2.tar.gz.

File metadata

  • Download URL: django-json-field-schema-validator-0.0.2.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.4

File hashes

Hashes for django-json-field-schema-validator-0.0.2.tar.gz
Algorithm Hash digest
SHA256 3cb0323ad13ae5aa2e1d1ab3f4c02a8ea06aba7f9785f29cb568a4499d00c070
MD5 5d61437b3be3ecb1476535b19f29f93e
BLAKE2b-256 f27806bcab59e2af983ead5c08ec6de878cbc1f9a023d81cd7e08cc0f6de33a4

See more details on using hashes here.

File details

Details for the file django_json_field_schema_validator-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for django_json_field_schema_validator-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 92e87812c2fa1fc696ae2b74e2d90c66cfc5989fd38b05b479d7fa5d5dd01e67
MD5 04ed7d667dda9c9a02a87ef483378a72
BLAKE2b-256 9f588c0871e61637b7d9db19e5a3da8dfa1fa50c443c7f94ad746f03c950d839

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