Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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

About

OpenAPI Spec Validator is a CLI, pre-commit hook and python package that validates OpenAPI Specs against the OpenAPI 2.0 (aka Swagger), OpenAPI 3.0 and OpenAPI 3.1 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

Installation

pip install openapi-spec-validator

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

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:

openapi-spec-validator openapi.yaml

pipes way:

cat openapi.yaml | openapi-spec-validator -

docker way:

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

or more pythonic way:

python -m openapi_spec_validator openapi.yaml

For more details, read about CLI (Command Line Interface).

pre-commit hook

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

For more details, read about pre-commit hook.

Python package

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.

License

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

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.8.0b3.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

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

openapi_spec_validator-0.8.0b3-py3-none-any.whl (39.7 kB view details)

Uploaded Python 3

File details

Details for the file openapi_spec_validator-0.8.0b3.tar.gz.

File metadata

  • Download URL: openapi_spec_validator-0.8.0b3.tar.gz
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for openapi_spec_validator-0.8.0b3.tar.gz
Algorithm Hash digest
SHA256 b8e6921028fc5848b1e717639a131b1315445a0fbf34c44f1d8106d5d65ed08b
MD5 8d0d9ce99609eee3c1540136e1c1cee5
BLAKE2b-256 820c66932a069bd832779e3469a4849ee99f9e10bf4fb21608543394ddb2af0b

See more details on using hashes here.

Provenance

The following attestation bundles were made for openapi_spec_validator-0.8.0b3.tar.gz:

Publisher: python-publish.yml on python-openapi/openapi-spec-validator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file openapi_spec_validator-0.8.0b3-py3-none-any.whl.

File metadata

File hashes

Hashes for openapi_spec_validator-0.8.0b3-py3-none-any.whl
Algorithm Hash digest
SHA256 75e0ad2c14eeb70d4e8d39cf87bc93450742dd9ca61226923468ec8e392cfac8
MD5 9f33923a18630b05b3daaa2734c50977
BLAKE2b-256 f39c5068935b807115165af139d29fad4ca1efaa4f8115531d5677b38c8eba6c

See more details on using hashes here.

Provenance

The following attestation bundles were made for openapi_spec_validator-0.8.0b3-py3-none-any.whl:

Publisher: python-publish.yml on python-openapi/openapi-spec-validator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.9.0

2 files

0.8.5

2 files

0.8.4

2 files

0.8.3

2 files

0.8.2

2 files

0.8.1

2 files

0.8.0

2 files

This release

0.8.0b3 This release

2 files

0.7.2

2 files

0.7.1

2 files

0.7.0

2 files

0.6.0

2 files

0.5.7

2 files

0.5.6

2 files

0.5.5

2 files

0.5.4

2 files

0.5.3

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.0

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

3 files

0.3.0

3 files

0.2.10

3 files

0.2.9

3 files

0.2.8

3 files

0.2.7

3 files

0.2.6

3 files

0.2.5

3 files

0.2.4

3 files

0.2.3

3 files

0.2.2

3 files

0.2.1

3 files

0.2.0

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

1 file

0.0.3

1 file

0.0.2

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page