django-json-schema-model


Namedjango-json-schema-model JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryJSON schema model for django.
upload_time2025-01-17 11:34:37
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseCopyright 2025 Maykin Media Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords django json schema
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            

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| |black| |coverage| |docs|

|python-versions| |django-versions| |pypi-version|

A reusable Django app to store JSON schemas.

.. contents::

.. section-numbering::

Features
========

* JsonSchemaModel consisting of
    - name CharField
    - schema JsonField
    - validate(json) method to validate JSON against the schema.

Installation
============

Requirements
------------

* Python 3.10 or above
* Django 4.2 or newer
* A database supporting django.db.models.JSONField


Install
-------

.. code-block:: bash

    pip install django-json-schema-model


Usage
=====

.. code-block:: python

    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)

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>``):

.. code-block:: bash

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


.. |build-status| image:: https://github.com/maykinmedia/django-json-schema-model/workflows/Run%20CI/badge.svg
    :alt: Build status
    :target: https://github.com/maykinmedia/django-json-schema-model/actions?query=workflow%3A%22Run+CI%22

.. |code-quality| image:: https://github.com/maykinmedia/django-json-schema-model/workflows/Code%20quality%20checks/badge.svg
     :alt: Code quality checks
     :target: https://github.com/maykinmedia/django-json-schema-model/actions?query=workflow%3A%22Code+quality+checks%22

.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/psf/black

.. |coverage| image:: https://codecov.io/gh/maykinmedia/django-json-schema-model/branch/main/graph/badge.svg
    :target: https://codecov.io/gh/maykinmedia/django-json-schema-model
    :alt: Coverage status

.. |docs| image:: https://readthedocs.org/projects/django-json-schema-model/badge/?version=latest
    :target: https://django-json-schema-model.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation Status

.. |python-versions| image:: https://img.shields.io/pypi/pyversions/django-json-schema-model.svg

.. |django-versions| image:: https://img.shields.io/pypi/djversions/django-json-schema-model.svg

.. |pypi-version| image:: https://img.shields.io/pypi/v/django-json-schema-model.svg
    :target: https://pypi.org/project/django-json-schema-model/

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "django-json-schema-model",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "django, json schema",
    "author": null,
    "author_email": "Maykin Media <support@maykinmedia.nl>",
    "download_url": "https://files.pythonhosted.org/packages/d1/78/34bc8fca28086aa33d943b1e3b241f046fa2ad51231085bb5fb0494caaf4/django_json_schema_model-0.1.0.tar.gz",
    "platform": null,
    "description": "\n\nWelcome to django-json-schema-model's documentation!\n====================================================\n\n:Version: 0.1.0\n:Source: https://github.com/maykinmedia/django-json-schema-model\n:Keywords: ``<keywords>``\n:PythonVersion: 3.10\n\n|build-status| |code-quality| |black| |coverage| |docs|\n\n|python-versions| |django-versions| |pypi-version|\n\nA reusable Django app to store JSON schemas.\n\n.. contents::\n\n.. section-numbering::\n\nFeatures\n========\n\n* JsonSchemaModel consisting of\n    - name CharField\n    - schema JsonField\n    - validate(json) method to validate JSON against the schema.\n\nInstallation\n============\n\nRequirements\n------------\n\n* Python 3.10 or above\n* Django 4.2 or newer\n* A database supporting django.db.models.JSONField\n\n\nInstall\n-------\n\n.. code-block:: bash\n\n    pip install django-json-schema-model\n\n\nUsage\n=====\n\n.. code-block:: python\n\n    from django_json_schema_model.models import JsonSchema\n\n    class ProductType(models.Model):\n        schema = models.ForeignKey(JsonSchema, on_delete=models.PROTECT)\n\n    class Product(models.Model):\n        json = models.JsonField()\n        type = models.ForeignKey(ProductType, on_delete=models.CASCADE)\n\n        def clean(self):\n            self.type.schema.validate(self.json)\n\nLocal development\n=================\n\nTo install and develop the library locally, use::\n\n.. code-block:: bash\n\n    pip install -e .[tests,coverage,docs,release]\n\nWhen running management commands via ``django-admin``, make sure to add the root\ndirectory to the python path (or use ``python -m django <command>``):\n\n.. code-block:: bash\n\n    export PYTHONPATH=. DJANGO_SETTINGS_MODULE=testapp.settings\n    django-admin check\n    # or other commands like:\n    # django-admin makemessages -l nl\n\n\n.. |build-status| image:: https://github.com/maykinmedia/django-json-schema-model/workflows/Run%20CI/badge.svg\n    :alt: Build status\n    :target: https://github.com/maykinmedia/django-json-schema-model/actions?query=workflow%3A%22Run+CI%22\n\n.. |code-quality| image:: https://github.com/maykinmedia/django-json-schema-model/workflows/Code%20quality%20checks/badge.svg\n     :alt: Code quality checks\n     :target: https://github.com/maykinmedia/django-json-schema-model/actions?query=workflow%3A%22Code+quality+checks%22\n\n.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :target: https://github.com/psf/black\n\n.. |coverage| image:: https://codecov.io/gh/maykinmedia/django-json-schema-model/branch/main/graph/badge.svg\n    :target: https://codecov.io/gh/maykinmedia/django-json-schema-model\n    :alt: Coverage status\n\n.. |docs| image:: https://readthedocs.org/projects/django-json-schema-model/badge/?version=latest\n    :target: https://django-json-schema-model.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n\n.. |python-versions| image:: https://img.shields.io/pypi/pyversions/django-json-schema-model.svg\n\n.. |django-versions| image:: https://img.shields.io/pypi/djversions/django-json-schema-model.svg\n\n.. |pypi-version| image:: https://img.shields.io/pypi/v/django-json-schema-model.svg\n    :target: https://pypi.org/project/django-json-schema-model/\n",
    "bugtrack_url": null,
    "license": "Copyright 2025 Maykin Media  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "JSON schema model for django.",
    "version": "0.1.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/maykinmedia/django-json-schema-model/issues",
        "Homepage": "https://github.com/maykinmedia/django-json-schema-model",
        "Source Code": "https://github.com/maykinmedia/django-json-schema-model"
    },
    "split_keywords": [
        "django",
        " json schema"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "15e38a304ac57ba1c0aba4ae88b0cf27e236e74350c87321d21b211c0e7863c0",
                "md5": "914499402dd592e06aa118c1520e3515",
                "sha256": "410aab367b93186590f051f0f9a1566366ce850763ac8d51eacc41d08ba04fc3"
            },
            "downloads": -1,
            "filename": "django_json_schema_model-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "914499402dd592e06aa118c1520e3515",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 7478,
            "upload_time": "2025-01-17T11:34:35",
            "upload_time_iso_8601": "2025-01-17T11:34:35.885223Z",
            "url": "https://files.pythonhosted.org/packages/15/e3/8a304ac57ba1c0aba4ae88b0cf27e236e74350c87321d21b211c0e7863c0/django_json_schema_model-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d17834bc8fca28086aa33d943b1e3b241f046fa2ad51231085bb5fb0494caaf4",
                "md5": "dceddeba5f3f4c1963a2ce0dbdfb845b",
                "sha256": "46df2680f2600d4f650b5b3ca44252cda90647c0bc315b51eeca911fc53b31af"
            },
            "downloads": -1,
            "filename": "django_json_schema_model-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "dceddeba5f3f4c1963a2ce0dbdfb845b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 8340,
            "upload_time": "2025-01-17T11:34:37",
            "upload_time_iso_8601": "2025-01-17T11:34:37.443838Z",
            "url": "https://files.pythonhosted.org/packages/d1/78/34bc8fca28086aa33d943b1e3b241f046fa2ad51231085bb5fb0494caaf4/django_json_schema_model-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-17 11:34:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "maykinmedia",
    "github_project": "django-json-schema-model",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "django-json-schema-model"
}
        
Elapsed time: 0.48406s