jsonschema-spec


Namejsonschema-spec JSON
Version 0.2.4 PyPI version JSON
download
home_pagehttps://github.com/p1c2u/jsonschema-spec
SummaryJSONSchema Spec with object-oriented paths
upload_time2023-08-16 17:47:24
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 Spec
***************

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

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-spec

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

.. code-block:: console

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


Usage
#####

.. code-block:: python

   >>> from jsonschema_spec 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-spec",
    "name": "jsonschema-spec",
    "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/85/bf/5e9a059f611e8950eec986385892f9d596e4936fa58a37bf295789197f77/jsonschema_spec-0.2.4.tar.gz",
    "platform": null,
    "description": "***************\nJSONSchema Spec\n***************\n\n.. image:: https://img.shields.io/pypi/v/jsonschema-spec.svg\n     :target: https://pypi.python.org/pypi/jsonschema-spec\n.. image:: https://travis-ci.org/p1c2u/jsonschema-spec.svg?branch=master\n     :target: https://travis-ci.org/p1c2u/jsonschema-spec\n.. image:: https://img.shields.io/codecov/c/github/p1c2u/jsonschema-spec/master.svg?style=flat\n     :target: https://codecov.io/github/p1c2u/jsonschema-spec?branch=master\n.. image:: https://img.shields.io/pypi/pyversions/jsonschema-spec.svg\n     :target: https://pypi.python.org/pypi/jsonschema-spec\n.. image:: https://img.shields.io/pypi/format/jsonschema-spec.svg\n     :target: https://pypi.python.org/pypi/jsonschema-spec\n.. image:: https://img.shields.io/pypi/status/jsonschema-spec.svg\n     :target: https://pypi.python.org/pypi/jsonschema-spec\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-spec\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-spec.git#egg=jsonschema_spec\n\n\nUsage\n#####\n\n.. code-block:: python\n\n   >>> from jsonschema_spec 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.2.4",
    "project_urls": {
        "Homepage": "https://github.com/p1c2u/jsonschema-spec",
        "Repository": "https://github.com/p1c2u/jsonschema-spec"
    },
    "split_keywords": [
        "jsonschema",
        "swagger",
        "spec"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d9a27759a4268e1d6d74559de8fb5be6c77d621b822ae64d28ab4f7467c22f63",
                "md5": "9f22d87fabc256ec0b0506c58cf17328",
                "sha256": "e6dcf7056734ec6854f7888da6c08ce6c421f28aeeddce96bb90de0fb6d711ef"
            },
            "downloads": -1,
            "filename": "jsonschema_spec-0.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9f22d87fabc256ec0b0506c58cf17328",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.0,<4.0.0",
            "size": 14739,
            "upload_time": "2023-08-16T17:47:23",
            "upload_time_iso_8601": "2023-08-16T17:47:23.071999Z",
            "url": "https://files.pythonhosted.org/packages/d9/a2/7759a4268e1d6d74559de8fb5be6c77d621b822ae64d28ab4f7467c22f63/jsonschema_spec-0.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "85bf5e9a059f611e8950eec986385892f9d596e4936fa58a37bf295789197f77",
                "md5": "83fb894426da3d4a5a4b36e40d46172b",
                "sha256": "873e396ad1ba6edf9f52d6174c110d4fafb7b5f5894744246a53fe75e5251ec2"
            },
            "downloads": -1,
            "filename": "jsonschema_spec-0.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "83fb894426da3d4a5a4b36e40d46172b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.0,<4.0.0",
            "size": 11477,
            "upload_time": "2023-08-16T17:47:24",
            "upload_time_iso_8601": "2023-08-16T17:47:24.747463Z",
            "url": "https://files.pythonhosted.org/packages/85/bf/5e9a059f611e8950eec986385892f9d596e4936fa58a37bf295789197f77/jsonschema_spec-0.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-16 17:47:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "p1c2u",
    "github_project": "jsonschema-spec",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "jsonschema-spec"
}
        
Elapsed time: 0.10358s