openapi-spec-validator


Nameopenapi-spec-validator JSON
Version 0.7.1 PyPI version JSON
download
home_pagehttps://github.com/python-openapi/openapi-spec-validator
SummaryOpenAPI 2.0 (aka Swagger) and OpenAPI 3 spec validator
upload_time2023-10-13 11:43:40
maintainer
docs_urlNone
authorArtur Maciag
requires_python>=3.8.0,<4.0.0
licenseApache-2.0
keywords openapi swagger schema
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            **********************
OpenAPI Spec validator
**********************

.. image:: https://img.shields.io/docker/v/pythonopenapi/openapi-spec-validator.svg?color=%23086DD7&label=docker%20hub&sort=semver
     :target: https://hub.docker.com/r/pythonopenapi/openapi-spec-validator
.. image:: https://img.shields.io/pypi/v/openapi-spec-validator.svg
     :target: https://pypi.python.org/pypi/openapi-spec-validator
.. image:: https://travis-ci.org/python-openapi/openapi-spec-validator.svg?branch=master
     :target: https://travis-ci.org/python-openapi/openapi-spec-validator
.. image:: https://img.shields.io/codecov/c/github/python-openapi/openapi-spec-validator/master.svg?style=flat
     :target: https://codecov.io/github/python-openapi/openapi-spec-validator?branch=master
.. image:: https://img.shields.io/pypi/pyversions/openapi-spec-validator.svg
     :target: https://pypi.python.org/pypi/openapi-spec-validator
.. image:: https://img.shields.io/pypi/format/openapi-spec-validator.svg
     :target: https://pypi.python.org/pypi/openapi-spec-validator
.. image:: https://img.shields.io/pypi/status/openapi-spec-validator.svg
     :target: https://pypi.python.org/pypi/openapi-spec-validator

About
#####

OpenAPI Spec Validator is a CLI, pre-commit hook and python package that validates OpenAPI Specs
against the `OpenAPI 2.0 (aka Swagger)
<https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md>`__,
`OpenAPI 3.0 <https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md>`__
and `OpenAPI 3.1 <https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md>`__
specification. The validator aims to check for full compliance with the Specification.


Documentation
#############

Check documentation to see more details about the features. All documentation is in the "docs" directory and online at `openapi-spec-validator.readthedocs.io <https://openapi-spec-validator.readthedocs.io>`__


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

.. code-block:: console

    pip install openapi-spec-validator

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

.. code-block:: bash

   pip install -e git+https://github.com/python-openapi/openapi-spec-validator.git#egg=openapi_spec_validator


Usage
#####

CLI (Command Line Interface)
****************************

Straight forward way:

.. code-block:: bash

    openapi-spec-validator openapi.yaml

pipes way:

.. code-block:: bash

    cat openapi.yaml | openapi-spec-validator -

docker way:

.. code-block:: bash

    docker run -v path/to/openapi.yaml:/openapi.yaml --rm pythonopenapi/openapi-spec-validator /openapi.yaml

or more pythonic way:

.. code-block:: bash

    python -m openapi_spec_validator openapi.yaml

For more details, read about `CLI (Command Line Interface) <https://openapi-spec-validator.readthedocs.io/en/latest/cli.html>`__.

pre-commit hook
***************

.. code-block:: yaml

   repos:
   -   repo: https://github.com/python-openapi/openapi-spec-validator
       rev: 0.5.5 # The version to use or 'master' for latest
       hooks:
       -   id: openapi-spec-validator

For more details, read about `pre-commit hook <https://openapi-spec-validator.readthedocs.io/en/latest/hook.html>`__.

Python package
**************

.. code:: python

    from openapi_spec_validator import validate
    from openapi_spec_validator.readers import read_from_filename

    spec_dict, base_uri = read_from_filename('openapi.yaml')

    # If no exception is raised by validate(), the spec is valid.
    validate(spec_dict)

    validate({'openapi': '3.1.0'})

    Traceback (most recent call last):
        ...
    OpenAPIValidationError: 'info' is a required property

For more details, read about `Python package <https://openapi-spec-validator.readthedocs.io/en/latest/python.html>`__.

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

* `openapi-core <https://github.com/python-openapi/openapi-core>`__
   Python library that adds client-side and server-side support for the OpenAPI v3.0 and OpenAPI v3.1 specification.
* `openapi-schema-validator <https://github.com/python-openapi/openapi-schema-validator>`__
   Python library that validates schema against the OpenAPI Schema Specification v3.0 and OpenAPI Schema Specification v3.1.

License
#######

Copyright (c) 2017-2023, Artur Maciag, All rights reserved. Apache v2

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/python-openapi/openapi-spec-validator",
    "name": "openapi-spec-validator",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8.0,<4.0.0",
    "maintainer_email": "",
    "keywords": "openapi,swagger,schema",
    "author": "Artur Maciag",
    "author_email": "maciag.artur@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/67/fe/21954ff978239dc29ebb313f5c87eeb4ec929b694b9667323086730998e2/openapi_spec_validator-0.7.1.tar.gz",
    "platform": null,
    "description": "**********************\nOpenAPI Spec validator\n**********************\n\n.. image:: https://img.shields.io/docker/v/pythonopenapi/openapi-spec-validator.svg?color=%23086DD7&label=docker%20hub&sort=semver\n     :target: https://hub.docker.com/r/pythonopenapi/openapi-spec-validator\n.. image:: https://img.shields.io/pypi/v/openapi-spec-validator.svg\n     :target: https://pypi.python.org/pypi/openapi-spec-validator\n.. image:: https://travis-ci.org/python-openapi/openapi-spec-validator.svg?branch=master\n     :target: https://travis-ci.org/python-openapi/openapi-spec-validator\n.. image:: https://img.shields.io/codecov/c/github/python-openapi/openapi-spec-validator/master.svg?style=flat\n     :target: https://codecov.io/github/python-openapi/openapi-spec-validator?branch=master\n.. image:: https://img.shields.io/pypi/pyversions/openapi-spec-validator.svg\n     :target: https://pypi.python.org/pypi/openapi-spec-validator\n.. image:: https://img.shields.io/pypi/format/openapi-spec-validator.svg\n     :target: https://pypi.python.org/pypi/openapi-spec-validator\n.. image:: https://img.shields.io/pypi/status/openapi-spec-validator.svg\n     :target: https://pypi.python.org/pypi/openapi-spec-validator\n\nAbout\n#####\n\nOpenAPI Spec Validator is a CLI, pre-commit hook and python package that validates OpenAPI Specs\nagainst the `OpenAPI 2.0 (aka Swagger)\n<https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md>`__,\n`OpenAPI 3.0 <https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md>`__\nand `OpenAPI 3.1 <https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md>`__\nspecification. The validator aims to check for full compliance with the Specification.\n\n\nDocumentation\n#############\n\nCheck documentation to see more details about the features. All documentation is in the \"docs\" directory and online at `openapi-spec-validator.readthedocs.io <https://openapi-spec-validator.readthedocs.io>`__\n\n\nInstallation\n############\n\n.. code-block:: console\n\n    pip install openapi-spec-validator\n\nAlternatively you can download the code and install from the repository:\n\n.. code-block:: bash\n\n   pip install -e git+https://github.com/python-openapi/openapi-spec-validator.git#egg=openapi_spec_validator\n\n\nUsage\n#####\n\nCLI (Command Line Interface)\n****************************\n\nStraight forward way:\n\n.. code-block:: bash\n\n    openapi-spec-validator openapi.yaml\n\npipes way:\n\n.. code-block:: bash\n\n    cat openapi.yaml | openapi-spec-validator -\n\ndocker way:\n\n.. code-block:: bash\n\n    docker run -v path/to/openapi.yaml:/openapi.yaml --rm pythonopenapi/openapi-spec-validator /openapi.yaml\n\nor more pythonic way:\n\n.. code-block:: bash\n\n    python -m openapi_spec_validator openapi.yaml\n\nFor more details, read about `CLI (Command Line Interface) <https://openapi-spec-validator.readthedocs.io/en/latest/cli.html>`__.\n\npre-commit hook\n***************\n\n.. code-block:: yaml\n\n   repos:\n   -   repo: https://github.com/python-openapi/openapi-spec-validator\n       rev: 0.5.5 # The version to use or 'master' for latest\n       hooks:\n       -   id: openapi-spec-validator\n\nFor more details, read about `pre-commit hook <https://openapi-spec-validator.readthedocs.io/en/latest/hook.html>`__.\n\nPython package\n**************\n\n.. code:: python\n\n    from openapi_spec_validator import validate\n    from openapi_spec_validator.readers import read_from_filename\n\n    spec_dict, base_uri = read_from_filename('openapi.yaml')\n\n    # If no exception is raised by validate(), the spec is valid.\n    validate(spec_dict)\n\n    validate({'openapi': '3.1.0'})\n\n    Traceback (most recent call last):\n        ...\n    OpenAPIValidationError: 'info' is a required property\n\nFor more details, read about `Python package <https://openapi-spec-validator.readthedocs.io/en/latest/python.html>`__.\n\nRelated projects\n################\n\n* `openapi-core <https://github.com/python-openapi/openapi-core>`__\n   Python library that adds client-side and server-side support for the OpenAPI v3.0 and OpenAPI v3.1 specification.\n* `openapi-schema-validator <https://github.com/python-openapi/openapi-schema-validator>`__\n   Python library that validates schema against the OpenAPI Schema Specification v3.0 and OpenAPI Schema Specification v3.1.\n\nLicense\n#######\n\nCopyright (c) 2017-2023, Artur Maciag, All rights reserved. Apache v2\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "OpenAPI 2.0 (aka Swagger) and OpenAPI 3 spec validator",
    "version": "0.7.1",
    "project_urls": {
        "Homepage": "https://github.com/python-openapi/openapi-spec-validator",
        "Repository": "https://github.com/python-openapi/openapi-spec-validator"
    },
    "split_keywords": [
        "openapi",
        "swagger",
        "schema"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2b4de744fff95aaf3aeafc968d5ba7297c8cda0d1ecb8e3acd21b25adae4d835",
                "md5": "b4f36aeb83b00178cc30dc4061158b00",
                "sha256": "3c81825043f24ccbcd2f4b149b11e8231abce5ba84f37065e14ec947d8f4e959"
            },
            "downloads": -1,
            "filename": "openapi_spec_validator-0.7.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b4f36aeb83b00178cc30dc4061158b00",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.0,<4.0.0",
            "size": 38998,
            "upload_time": "2023-10-13T11:43:38",
            "upload_time_iso_8601": "2023-10-13T11:43:38.371830Z",
            "url": "https://files.pythonhosted.org/packages/2b/4d/e744fff95aaf3aeafc968d5ba7297c8cda0d1ecb8e3acd21b25adae4d835/openapi_spec_validator-0.7.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "67fe21954ff978239dc29ebb313f5c87eeb4ec929b694b9667323086730998e2",
                "md5": "74a8e9841ded18b8cc30ddd70b382080",
                "sha256": "8577b85a8268685da6f8aa30990b83b7960d4d1117e901d451b5d572605e5ec7"
            },
            "downloads": -1,
            "filename": "openapi_spec_validator-0.7.1.tar.gz",
            "has_sig": false,
            "md5_digest": "74a8e9841ded18b8cc30ddd70b382080",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.0,<4.0.0",
            "size": 37985,
            "upload_time": "2023-10-13T11:43:40",
            "upload_time_iso_8601": "2023-10-13T11:43:40.530708Z",
            "url": "https://files.pythonhosted.org/packages/67/fe/21954ff978239dc29ebb313f5c87eeb4ec929b694b9667323086730998e2/openapi_spec_validator-0.7.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-13 11:43:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "python-openapi",
    "github_project": "openapi-spec-validator",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "openapi-spec-validator"
}
        
Elapsed time: 0.16179s