************************
openapi-schema-validator
************************
.. image:: https://img.shields.io/pypi/v/openapi-schema-validator.svg
:target: https://pypi.python.org/pypi/openapi-schema-validator
.. image:: https://travis-ci.org/python-openapi/openapi-schema-validator.svg?branch=master
:target: https://travis-ci.org/python-openapi/openapi-schema-validator
.. image:: https://img.shields.io/codecov/c/github/python-openapi/openapi-schema-validator/master.svg?style=flat
:target: https://codecov.io/github/python-openapi/openapi-schema-validator?branch=master
.. image:: https://img.shields.io/pypi/pyversions/openapi-schema-validator.svg
:target: https://pypi.python.org/pypi/openapi-schema-validator
.. image:: https://img.shields.io/pypi/format/openapi-schema-validator.svg
:target: https://pypi.python.org/pypi/openapi-schema-validator
.. image:: https://img.shields.io/pypi/status/openapi-schema-validator.svg
:target: https://pypi.python.org/pypi/openapi-schema-validator
About
#####
Openapi-schema-validator is a Python library that validates schema against:
* `OpenAPI Schema Specification v3.0 <https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#schemaObject>`__ which is an extended subset of the `JSON Schema Specification Wright Draft 00 <http://json-schema.org/>`__.
* `OpenAPI Schema Specification v3.1 <https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#schemaObject>`__ which is an extended superset of the `JSON Schema Specification Draft 2020-12 <http://json-schema.org/>`__.
Documentation
#############
Check documentation to see more details about the features. All documentation is in the "docs" directory and online at `openapi-schema-validator.readthedocs.io <https://openapi-schema-validator.readthedocs.io>`__
Installation
############
Recommended way (via pip):
.. code-block:: console
pip install openapi-schema-validator
Alternatively you can download the code and install from the repository:
.. code-block:: console
pip install -e git+https://github.com/python-openapi/openapi-schema-validator.git#egg=openapi_schema_validator
Usage
#####
To validate an OpenAPI v3.1 schema:
.. code-block:: python
from openapi_schema_validator import validate
# A sample schema
schema = {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string"
},
"age": {
"type": ["integer", "null"],
"format": "int32",
"minimum": 0,
},
"birth-date": {
"type": "string",
"format": "date",
},
"address": {
"type": 'array',
"prefixItems": [
{ "type": "number" },
{ "type": "string" },
{ "enum": ["Street", "Avenue", "Boulevard"] },
{ "enum": ["NW", "NE", "SW", "SE"] }
],
"items": False,
}
},
"additionalProperties": False,
}
# If no exception is raised by validate(), the instance is valid.
validate({"name": "John", "age": 23, "address": [1600, "Pennsylvania", "Avenue"]}, schema)
validate({"name": "John", "city": "London"}, schema)
Traceback (most recent call last):
...
ValidationError: Additional properties are not allowed ('city' was unexpected)
By default, the latest OpenAPI schema syntax is expected.
For more details read about `Validation <https://openapi-schema-validator.readthedocs.io/en/latest/validation.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.
* `openapi-spec-validator <https://github.com/python-openapi/openapi-spec-validator>`__
Python library that validates OpenAPI Specs against the OpenAPI 2.0 (aka Swagger) and OpenAPI 3.0 specification
Raw data
{
"_id": null,
"home_page": "https://github.com/python-openapi/openapi-schema-validator",
"name": "openapi-schema-validator",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0.0,>=3.8.0",
"maintainer_email": null,
"keywords": "openapi, swagger, schema",
"author": "Artur Maciag",
"author_email": "maciag.artur@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/8b/f3/5507ad3325169347cd8ced61c232ff3df70e2b250c49f0fe140edb4973c6/openapi_schema_validator-0.6.3.tar.gz",
"platform": null,
"description": "************************\nopenapi-schema-validator\n************************\n\n.. image:: https://img.shields.io/pypi/v/openapi-schema-validator.svg\n :target: https://pypi.python.org/pypi/openapi-schema-validator\n.. image:: https://travis-ci.org/python-openapi/openapi-schema-validator.svg?branch=master\n :target: https://travis-ci.org/python-openapi/openapi-schema-validator\n.. image:: https://img.shields.io/codecov/c/github/python-openapi/openapi-schema-validator/master.svg?style=flat\n :target: https://codecov.io/github/python-openapi/openapi-schema-validator?branch=master\n.. image:: https://img.shields.io/pypi/pyversions/openapi-schema-validator.svg\n :target: https://pypi.python.org/pypi/openapi-schema-validator\n.. image:: https://img.shields.io/pypi/format/openapi-schema-validator.svg\n :target: https://pypi.python.org/pypi/openapi-schema-validator\n.. image:: https://img.shields.io/pypi/status/openapi-schema-validator.svg\n :target: https://pypi.python.org/pypi/openapi-schema-validator\n\nAbout\n#####\n\nOpenapi-schema-validator is a Python library that validates schema against:\n\n* `OpenAPI Schema Specification v3.0 <https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#schemaObject>`__ which is an extended subset of the `JSON Schema Specification Wright Draft 00 <http://json-schema.org/>`__.\n* `OpenAPI Schema Specification v3.1 <https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#schemaObject>`__ which is an extended superset of the `JSON Schema Specification Draft 2020-12 <http://json-schema.org/>`__.\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-schema-validator.readthedocs.io <https://openapi-schema-validator.readthedocs.io>`__\n\n\nInstallation\n############\n\nRecommended way (via pip):\n\n.. code-block:: console\n\n pip install openapi-schema-validator\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/python-openapi/openapi-schema-validator.git#egg=openapi_schema_validator\n\n\nUsage\n#####\n\nTo validate an OpenAPI v3.1 schema:\n\n.. code-block:: python\n\n from openapi_schema_validator import validate\n\n # A sample schema\n schema = {\n \"type\": \"object\",\n \"required\": [\n \"name\"\n ],\n \"properties\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"age\": {\n \"type\": [\"integer\", \"null\"],\n \"format\": \"int32\",\n \"minimum\": 0,\n },\n \"birth-date\": {\n \"type\": \"string\",\n \"format\": \"date\",\n },\n \"address\": {\n \"type\": 'array',\n \"prefixItems\": [\n { \"type\": \"number\" },\n { \"type\": \"string\" },\n { \"enum\": [\"Street\", \"Avenue\", \"Boulevard\"] },\n { \"enum\": [\"NW\", \"NE\", \"SW\", \"SE\"] }\n ],\n \"items\": False,\n }\n },\n \"additionalProperties\": False,\n }\n\n # If no exception is raised by validate(), the instance is valid.\n validate({\"name\": \"John\", \"age\": 23, \"address\": [1600, \"Pennsylvania\", \"Avenue\"]}, schema)\n\n validate({\"name\": \"John\", \"city\": \"London\"}, schema)\n\n Traceback (most recent call last):\n ...\n ValidationError: Additional properties are not allowed ('city' was unexpected)\n\nBy default, the latest OpenAPI schema syntax is expected.\n\nFor more details read about `Validation <https://openapi-schema-validator.readthedocs.io/en/latest/validation.html>`__.\n\nRelated projects\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.\n* `openapi-spec-validator <https://github.com/python-openapi/openapi-spec-validator>`__\n Python library that validates OpenAPI Specs against the OpenAPI 2.0 (aka Swagger) and OpenAPI 3.0 specification\n\n",
"bugtrack_url": null,
"license": "BSD-3-Clause",
"summary": "OpenAPI schema validation for Python",
"version": "0.6.3",
"project_urls": {
"Homepage": "https://github.com/python-openapi/openapi-schema-validator",
"Repository": "https://github.com/python-openapi/openapi-schema-validator"
},
"split_keywords": [
"openapi",
" swagger",
" schema"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "21c6ad0fba32775ae749016829dace42ed80f4407b171da41313d1a3a5f102e4",
"md5": "baf7393e57c351de2b83a6ab0b0c237d",
"sha256": "f3b9870f4e556b5a62a1c39da72a6b4b16f3ad9c73dc80084b1b11e74ba148a3"
},
"downloads": -1,
"filename": "openapi_schema_validator-0.6.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "baf7393e57c351de2b83a6ab0b0c237d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0.0,>=3.8.0",
"size": 8755,
"upload_time": "2025-01-10T18:08:19",
"upload_time_iso_8601": "2025-01-10T18:08:19.758187Z",
"url": "https://files.pythonhosted.org/packages/21/c6/ad0fba32775ae749016829dace42ed80f4407b171da41313d1a3a5f102e4/openapi_schema_validator-0.6.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8bf35507ad3325169347cd8ced61c232ff3df70e2b250c49f0fe140edb4973c6",
"md5": "7076003c896e5270079d7e9dc33f1498",
"sha256": "f37bace4fc2a5d96692f4f8b31dc0f8d7400fd04f3a937798eaf880d425de6ee"
},
"downloads": -1,
"filename": "openapi_schema_validator-0.6.3.tar.gz",
"has_sig": false,
"md5_digest": "7076003c896e5270079d7e9dc33f1498",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0.0,>=3.8.0",
"size": 11550,
"upload_time": "2025-01-10T18:08:22",
"upload_time_iso_8601": "2025-01-10T18:08:22.268525Z",
"url": "https://files.pythonhosted.org/packages/8b/f3/5507ad3325169347cd8ced61c232ff3df70e2b250c49f0fe140edb4973c6/openapi_schema_validator-0.6.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-10 18:08:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "python-openapi",
"github_project": "openapi-schema-validator",
"travis_ci": true,
"coveralls": false,
"github_actions": true,
"lcname": "openapi-schema-validator"
}