Skip to main content

OpenAPI 2.0 (aka Swagger) and OpenAPI 3.0.0 spec validator

Project description

OpenAPI Spec validator

Package Version Build Status Code Coverage PyPI Version PyPI Format PyPI Status

About

OpenAPI Spec Validator is a Python library that validates OpenAPI Specs against the OpenAPI 2.0 (aka Swagger) and OpenAPI 3.0.0 specification. The validator aims to check for full compliance with the Specification.

Installation

$ pip install openapi-spec-validator

Usage

Command Line Interface

Straight forward way:

$ openapi-spec-validator some.yaml

pipes way:

$ cat some.yaml | openapi-spec-validator -

docker way:

$ docker run -v path/to/some.yaml:/some.yaml --rm p1c2u/openapi-spec-validator /some.yaml

or more pythonic way:

$ python -m openapi_spec_validator some.yaml

Examples

Validate spec:

from openapi_spec_validator import validate_spec

validate_spec(spec_dict)

Add spec_url to validate spec with relative files:

from openapi_spec_validator import validate_spec

validate_spec(spec_dict, spec_url='file:///path/to/spec/openapi.yaml')

You can also validate spec from url:

from openapi_spec_validator import validate_spec_url

validate_spec_url('http://example.com/openapi.json')

If you want to iterate through validation errors:

from openapi_spec_validator import openapi_v3_spec_validator

errors_iterator = openapi_v3_spec_validator.iter_errors(spec)

Related projects

  • openapi-core is a Python library that adds client-side and server-side support for the OpenAPI.

License

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

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-spec-validator-0.2.9.tar.gz (22.5 kB view details)

Uploaded Source

Built Distributions

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

openapi_spec_validator-0.2.9-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

openapi_spec_validator-0.2.9-py2-none-any.whl (25.3 kB view details)

Uploaded Python 2

File details

Details for the file openapi-spec-validator-0.2.9.tar.gz.

File metadata

  • Download URL: openapi-spec-validator-0.2.9.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.5

File hashes

Hashes for openapi-spec-validator-0.2.9.tar.gz
Algorithm Hash digest
SHA256 79381a69b33423ee400ae1624a461dae7725e450e2e306e32f2dd8d16a4d85cb
MD5 3589c9cf40497849fc3a0160f0fe0213
BLAKE2b-256 879d016a76d6949287b3860f337faae745e5f77563a60b241d9c472305a721a1

See more details on using hashes here.

File details

Details for the file openapi_spec_validator-0.2.9-py3-none-any.whl.

File metadata

  • Download URL: openapi_spec_validator-0.2.9-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.5

File hashes

Hashes for openapi_spec_validator-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 ec1b01a00e20955a527358886991ae34b4b791b253027ee9f7df5f84b59d91c7
MD5 2dfdc4bd49286b95cd2020d0e2289f46
BLAKE2b-256 104cb2aece7b557dc79f02537e857510f277afac44825b13d331fbfc259ea96b

See more details on using hashes here.

File details

Details for the file openapi_spec_validator-0.2.9-py2-none-any.whl.

File metadata

  • Download URL: openapi_spec_validator-0.2.9-py2-none-any.whl
  • Upload date:
  • Size: 25.3 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_spec_validator-0.2.9-py2-none-any.whl
Algorithm Hash digest
SHA256 6dd75e50c94f1bb454d0e374a56418e7e06a07affb2c7f1df88564c5d728dac3
MD5 4ed6b7ecd211c52e65c446c76297fe87
BLAKE2b-256 87d51e8deaaebf29672e2df4fc5244b56d2fefe01a6c7bdd6b2990cfefcdae9a

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