Skip to main content

No project description provided

Project description

https://img.shields.io/pypi/v/openapi-schema-validator.svg https://travis-ci.org/p1c2u/openapi-schema-validator.svg?branch=master https://img.shields.io/codecov/c/github/p1c2u/openapi-schema-validator/master.svg?style=flat https://img.shields.io/pypi/pyversions/openapi-schema-validator.svg https://img.shields.io/pypi/format/openapi-schema-validator.svg https://img.shields.io/pypi/status/openapi-schema-validator.svg

About

Openapi-schema-validator is a Python library that validates schema against the OpenAPI Schema Specification v3.0 which is an extended subset of the JSON Schema Specification Wright Draft 00.

Installation

Recommended way (via pip):

$ pip install openapi-schema-validator

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

$ pip install -e git+https://github.com/p1c2u/openapi-schema-validator.git#egg=openapi_schema_validator

Usage

Simple usage

from openapi_schema_validator import OAS30Validator, oas30_format_checker

# A sample schema
schema = {
    "type" : "object",
    "required": [
       "name"
    ],
    "properties": {
        "name": {
            "type": "string"
        },
        "age": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "nullable": True,
        },
    },
    "additionalProperties": False,
}

validator = OAS30Validator(schema)
# If no exception is raised by validate(), the instance is valid.
validator.validate({"name": "John", "age": 23})

validator.validate({"name": "John", "city": "London"})

Traceback (most recent call last):
    ...
ValidationError: Additional properties are not allowed ('city' was unexpected)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openapi-schema-validator-0.1.1.tar.gz (6.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

openapi_schema_validator-0.1.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

openapi_schema_validator-0.1.1-py2-none-any.whl (7.2 kB view details)

Uploaded Python 2

File details

Details for the file openapi-schema-validator-0.1.1.tar.gz.

File metadata

  • Download URL: openapi-schema-validator-0.1.1.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/2.7.16

File hashes

Hashes for openapi-schema-validator-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8fc97a575393d179d70e7c7ebd30ed9fc46eb6c5013f2790736c2e50ea150f06
MD5 b34f2b0bf05064b0cceb16162972631e
BLAKE2b-256 b4c03d7b9a9f51f0d1b396036d14749cc3f470dc7983253ca4a3c904d3b2496c

See more details on using hashes here.

File details

Details for the file openapi_schema_validator-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: openapi_schema_validator-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5

File hashes

Hashes for openapi_schema_validator-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b7afe93aff4a876781279b376c1ba5decb338483e9484af26b140ef215119e23
MD5 31a182e0ea1c6e63cd35f8a633213e3b
BLAKE2b-256 425d9149164c06a7dcb736d61d8c46eded3e9de7c097c4e660ff19981f063ca2

See more details on using hashes here.

File details

Details for the file openapi_schema_validator-0.1.1-py2-none-any.whl.

File metadata

  • Download URL: openapi_schema_validator-0.1.1-py2-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/2.7.16

File hashes

Hashes for openapi_schema_validator-0.1.1-py2-none-any.whl
Algorithm Hash digest
SHA256 3f0b0f9086e7d717a0413a462d3d9e6f82f7e80a744abf21943ee2e0d9e8c50d
MD5 50baa1d6e9e4570e82906facd049fce4
BLAKE2b-256 60d4a92ca5f5ffd5b6a256908755c101856c6600a83041f11ec976484030ff7b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page