jsonschema-path


Namejsonschema-path JSON
Version 0.3.1 PyPI version JSON
download
home_pagehttps://github.com/p1c2u/jsonschema-path
SummaryJSONSchema Spec with object-oriented paths
upload_time2023-10-13 09:49:40
maintainer
docs_urlNone
authorArtur Maciag
requires_python>=3.8.0,<4.0.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": "https://github.com/p1c2u/jsonschema-path",
    "name": "jsonschema-path",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8.0,<4.0.0",
    "maintainer_email": "",
    "keywords": "jsonschema,swagger,spec",
    "author": "Artur Maciag",
    "author_email": "maciag.artur@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/92/91/fbdab127309e70d60945ebec5ada96f5b2ff3c7f06011217d4e5eb6c56bf/jsonschema_path-0.3.1.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",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "JSONSchema Spec with object-oriented paths",
    "version": "0.3.1",
    "project_urls": {
        "Homepage": "https://github.com/p1c2u/jsonschema-path",
        "Repository": "https://github.com/p1c2u/jsonschema-path"
    },
    "split_keywords": [
        "jsonschema",
        "swagger",
        "spec"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "73922234549efe32f6275c945d04f2da1392a47f5cd8e31ce9430366de6d4290",
                "md5": "426230432805557d56ad86fec94689cf",
                "sha256": "06f01b1848a28963f49a17730e11204d252aa6ff5db4ef84ec77e5ac93cfa831"
            },
            "downloads": -1,
            "filename": "jsonschema_path-0.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "426230432805557d56ad86fec94689cf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.0,<4.0.0",
            "size": 14810,
            "upload_time": "2023-10-13T09:49:38",
            "upload_time_iso_8601": "2023-10-13T09:49:38.513261Z",
            "url": "https://files.pythonhosted.org/packages/73/92/2234549efe32f6275c945d04f2da1392a47f5cd8e31ce9430366de6d4290/jsonschema_path-0.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9291fbdab127309e70d60945ebec5ada96f5b2ff3c7f06011217d4e5eb6c56bf",
                "md5": "0bcf052c46071e3da830d58b6a81d862",
                "sha256": "07ea584b5c9b41a614b4d011c5575955676f48d0abbfd93d9ea8e933018d716d"
            },
            "downloads": -1,
            "filename": "jsonschema_path-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "0bcf052c46071e3da830d58b6a81d862",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.0,<4.0.0",
            "size": 11588,
            "upload_time": "2023-10-13T09:49:40",
            "upload_time_iso_8601": "2023-10-13T09:49:40.203173Z",
            "url": "https://files.pythonhosted.org/packages/92/91/fbdab127309e70d60945ebec5ada96f5b2ff3c7f06011217d4e5eb6c56bf/jsonschema_path-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-13 09:49:40",
    "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: 0.18375s