jsonschema-path


Namejsonschema-path JSON
Version 0.3.4 PyPI version JSON
download
home_pageNone
SummaryJSONSchema Spec with object-oriented paths
upload_time2025-01-24 14:33:16
maintainerNone
docs_urlNone
authorArtur Maciag
requires_python<4.0.0,>=3.8.0
licenseApache-2.0
keywords jsonschema swagger spec
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ***************
JSONSchema Path
***************

.. image:: https://img.shields.io/pypi/v/jsonschema-path.svg
     :target: https://pypi.python.org/pypi/jsonschema-path
.. image:: https://travis-ci.org/p1c2u/jsonschema-path.svg?branch=master
     :target: https://travis-ci.org/p1c2u/jsonschema-path
.. image:: https://img.shields.io/codecov/c/github/p1c2u/jsonschema-path/master.svg?style=flat
     :target: https://codecov.io/github/p1c2u/jsonschema-path?branch=master
.. image:: https://img.shields.io/pypi/pyversions/jsonschema-path.svg
     :target: https://pypi.python.org/pypi/jsonschema-path
.. image:: https://img.shields.io/pypi/format/jsonschema-path.svg
     :target: https://pypi.python.org/pypi/jsonschema-path
.. image:: https://img.shields.io/pypi/status/jsonschema-path.svg
     :target: https://pypi.python.org/pypi/jsonschema-path

About
#####

Object-oriented JSONSchema

Key features
############

* Traverse schema like paths
* Access schema on demand with separate dereferencing accessor layer

Installation
############

.. code-block:: console

   pip install jsonschema-path

Alternatively you can download the code and install from the repository:

.. code-block:: console

   pip install -e git+https://github.com/p1c2u/jsonschema-path.git#egg=jsonschema_path


Usage
#####

.. code-block:: python

   >>> from jsonschema_path import SchemaPath
   
   >>> d = {
   ...     "properties": {
   ...        "info": {
   ...            "$ref": "#/$defs/Info",
   ...        },
   ...     },
   ...     "$defs": {
   ...         "Info": {
   ...             "properties": {
   ...                 "title": {
   ...                     "$ref": "http://example.com",
   ...                 },
   ...                 "version": {
   ...                     "type": "string",
   ...                     "default": "1.0",
   ...                 },
   ...             },
   ...         },
   ...     },
   ... }
   
   >>> path = SchemaPath.from_dict(d)
   
   >>> # Stat keys
   >>> "properties" in path
   True
   
   >>> # Concatenate paths with /
   >>> info_path = path / "properties" / "info"
   
   >>> # Stat keys with implicit dereferencing
   >>> "properties" in info_path
   True
   
   >>> # Concatenate paths with implicit dereferencing
   >>> version_path = info_path / "properties" / "version"
   
   >>> # Open content with implicit dereferencing
   >>> with version_path.open() as contents:
   ...     print(contents)
   {'type': 'string', 'default': '1.0'}


Related projects
################

* `openapi-core <https://github.com/p1c2u/openapi-core>`__
   Python library that adds client-side and server-side support for the OpenAPI.
* `openapi-spec-validator <https://github.com/p1c2u/openapi-spec-validator>`__
   Python library that validates OpenAPI Specs against the OpenAPI 2.0 (aka Swagger) and OpenAPI 3.0 specification
* `openapi-schema-validator <https://github.com/p1c2u/openapi-schema-validator>`__
   Python library that validates schema against the OpenAPI Schema Specification v3.0.

License
#######

Copyright (c) 2017-2022, Artur Maciag, All rights reserved. Apache-2.0


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "jsonschema-path",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0.0,>=3.8.0",
    "maintainer_email": null,
    "keywords": "jsonschema, swagger, spec",
    "author": "Artur Maciag",
    "author_email": "maciag.artur@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/6e/45/41ebc679c2a4fced6a722f624c18d658dee42612b83ea24c1caf7c0eb3a8/jsonschema_path-0.3.4.tar.gz",
    "platform": null,
    "description": "***************\nJSONSchema Path\n***************\n\n.. image:: https://img.shields.io/pypi/v/jsonschema-path.svg\n     :target: https://pypi.python.org/pypi/jsonschema-path\n.. image:: https://travis-ci.org/p1c2u/jsonschema-path.svg?branch=master\n     :target: https://travis-ci.org/p1c2u/jsonschema-path\n.. image:: https://img.shields.io/codecov/c/github/p1c2u/jsonschema-path/master.svg?style=flat\n     :target: https://codecov.io/github/p1c2u/jsonschema-path?branch=master\n.. image:: https://img.shields.io/pypi/pyversions/jsonschema-path.svg\n     :target: https://pypi.python.org/pypi/jsonschema-path\n.. image:: https://img.shields.io/pypi/format/jsonschema-path.svg\n     :target: https://pypi.python.org/pypi/jsonschema-path\n.. image:: https://img.shields.io/pypi/status/jsonschema-path.svg\n     :target: https://pypi.python.org/pypi/jsonschema-path\n\nAbout\n#####\n\nObject-oriented JSONSchema\n\nKey features\n############\n\n* Traverse schema like paths\n* Access schema on demand with separate dereferencing accessor layer\n\nInstallation\n############\n\n.. code-block:: console\n\n   pip install jsonschema-path\n\nAlternatively you can download the code and install from the repository:\n\n.. code-block:: console\n\n   pip install -e git+https://github.com/p1c2u/jsonschema-path.git#egg=jsonschema_path\n\n\nUsage\n#####\n\n.. code-block:: python\n\n   >>> from jsonschema_path import SchemaPath\n   \n   >>> d = {\n   ...     \"properties\": {\n   ...        \"info\": {\n   ...            \"$ref\": \"#/$defs/Info\",\n   ...        },\n   ...     },\n   ...     \"$defs\": {\n   ...         \"Info\": {\n   ...             \"properties\": {\n   ...                 \"title\": {\n   ...                     \"$ref\": \"http://example.com\",\n   ...                 },\n   ...                 \"version\": {\n   ...                     \"type\": \"string\",\n   ...                     \"default\": \"1.0\",\n   ...                 },\n   ...             },\n   ...         },\n   ...     },\n   ... }\n   \n   >>> path = SchemaPath.from_dict(d)\n   \n   >>> # Stat keys\n   >>> \"properties\" in path\n   True\n   \n   >>> # Concatenate paths with /\n   >>> info_path = path / \"properties\" / \"info\"\n   \n   >>> # Stat keys with implicit dereferencing\n   >>> \"properties\" in info_path\n   True\n   \n   >>> # Concatenate paths with implicit dereferencing\n   >>> version_path = info_path / \"properties\" / \"version\"\n   \n   >>> # Open content with implicit dereferencing\n   >>> with version_path.open() as contents:\n   ...     print(contents)\n   {'type': 'string', 'default': '1.0'}\n\n\nRelated projects\n################\n\n* `openapi-core <https://github.com/p1c2u/openapi-core>`__\n   Python library that adds client-side and server-side support for the OpenAPI.\n* `openapi-spec-validator <https://github.com/p1c2u/openapi-spec-validator>`__\n   Python library that validates OpenAPI Specs against the OpenAPI 2.0 (aka Swagger) and OpenAPI 3.0 specification\n* `openapi-schema-validator <https://github.com/p1c2u/openapi-schema-validator>`__\n   Python library that validates schema against the OpenAPI Schema Specification v3.0.\n\nLicense\n#######\n\nCopyright (c) 2017-2022, Artur Maciag, All rights reserved. Apache-2.0\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "JSONSchema Spec with object-oriented paths",
    "version": "0.3.4",
    "project_urls": {
        "Repository": "https://github.com/p1c2u/jsonschema-path"
    },
    "split_keywords": [
        "jsonschema",
        " swagger",
        " spec"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "cb583485da8cb93d2f393bce453adeef16896751f14ba3e2024bc21dc9597646",
                "md5": "3d31da164d834a32d4b4226e5be116d5",
                "sha256": "f502191fdc2b22050f9a81c9237be9d27145b9001c55842bece5e94e382e52f8"
            },
            "downloads": -1,
            "filename": "jsonschema_path-0.3.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3d31da164d834a32d4b4226e5be116d5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0.0,>=3.8.0",
            "size": 14810,
            "upload_time": "2025-01-24T14:33:14",
            "upload_time_iso_8601": "2025-01-24T14:33:14.652507Z",
            "url": "https://files.pythonhosted.org/packages/cb/58/3485da8cb93d2f393bce453adeef16896751f14ba3e2024bc21dc9597646/jsonschema_path-0.3.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "6e4541ebc679c2a4fced6a722f624c18d658dee42612b83ea24c1caf7c0eb3a8",
                "md5": "e4a1b0d9967124b71c237e868fe819b5",
                "sha256": "8365356039f16cc65fddffafda5f58766e34bebab7d6d105616ab52bc4297001"
            },
            "downloads": -1,
            "filename": "jsonschema_path-0.3.4.tar.gz",
            "has_sig": false,
            "md5_digest": "e4a1b0d9967124b71c237e868fe819b5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0.0,>=3.8.0",
            "size": 11159,
            "upload_time": "2025-01-24T14:33:16",
            "upload_time_iso_8601": "2025-01-24T14:33:16.547748Z",
            "url": "https://files.pythonhosted.org/packages/6e/45/41ebc679c2a4fced6a722f624c18d658dee42612b83ea24c1caf7c0eb3a8/jsonschema_path-0.3.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-24 14:33:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "p1c2u",
    "github_project": "jsonschema-path",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "jsonschema-path"
}
        
Elapsed time: 1.97684s