Skip to main content

JSON schema model for django.

Project description

1 Welcome to django-json-schema-model’s documentation!

Version:

0.1.0

Source:

https://github.com/maykinmedia/django-json-schema-model

Keywords:

<keywords>

PythonVersion:

3.10

Build status Code quality checks black Coverage status Documentation Status

python-versions django-versions pypi-version

A reusable Django app to store JSON schemas.

2 Features

  • JsonSchemaModel consisting of
    • name CharField

    • schema JsonField

    • validate(json) method to validate JSON against the schema.

3 Installation

3.1 Requirements

  • Python 3.10 or above

  • Django 4.2 or newer

  • A database supporting django.db.models.JSONField

3.2 Install

pip install django-json-schema-model

4 Usage

from django_json_schema_model.models import JsonSchema

class ProductType(models.Model):
    schema = models.ForeignKey(JsonSchema, on_delete=models.PROTECT)

class Product(models.Model):
    json = models.JsonField()
    type = models.ForeignKey(ProductType, on_delete=models.CASCADE)

    def clean(self):
        self.type.schema.validate(self.json)

5 Local development

To install and develop the library locally, use:

.. code-block:: bash

pip install -e .[tests,coverage,docs,release]

When running management commands via django-admin, make sure to add the root directory to the python path (or use python -m django <command>):

export PYTHONPATH=. DJANGO_SETTINGS_MODULE=testapp.settings
django-admin check
# or other commands like:
# django-admin makemessages -l nl

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

django_json_schema_model-0.1.0.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_json_schema_model-0.1.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file django_json_schema_model-0.1.0.tar.gz.

File metadata

  • Download URL: django_json_schema_model-0.1.0.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for django_json_schema_model-0.1.0.tar.gz
Algorithm Hash digest
SHA256 46df2680f2600d4f650b5b3ca44252cda90647c0bc315b51eeca911fc53b31af
MD5 dceddeba5f3f4c1963a2ce0dbdfb845b
BLAKE2b-256 d17834bc8fca28086aa33d943b1e3b241f046fa2ad51231085bb5fb0494caaf4

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_json_schema_model-0.1.0.tar.gz:

Publisher: ci.yml on maykinmedia/django-json-schema-model

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_json_schema_model-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_json_schema_model-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 410aab367b93186590f051f0f9a1566366ce850763ac8d51eacc41d08ba04fc3
MD5 914499402dd592e06aa118c1520e3515
BLAKE2b-256 15e38a304ac57ba1c0aba4ae88b0cf27e236e74350c87321d21b211c0e7863c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_json_schema_model-0.1.0-py3-none-any.whl:

Publisher: ci.yml on maykinmedia/django-json-schema-model

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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