This release is a pre-release and may not be stable for production use.
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.0b1 # 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
Release files for openapi-spec-validator 0.8.0b1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| openapi_spec_validator-0.8.0b1.tar.gz | 37.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| openapi_spec_validator-0.8.0b1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 76.8 kB
Release files / openapi_spec_validator-0.8.0b1.tar.gz
| Download URL | openapi_spec_validator-0.8.0b1.tar.gz |
|---|---|
| Size | 37.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
084367ad26fff9101f5e6a09fdee7b31b2a0bc66e72f38560a986a7369766f57
|
|
BLAKE2b-256 checksum How to use checksums |
30f9d07c38d888e2d55852ec93e0d213e5ba7d16c915c702b38ab827f89c5919
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 7, 2025.
Transparency logRelease files / openapi_spec_validator-0.8.0b1-py3-none-any.whl
| Download URL | openapi_spec_validator-0.8.0b1-py3-none-any.whl |
|---|---|
| Size | 39.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e07b10bf43125a964e828319c6104acc6fda8bd2d01eea1b717e614c2bbacc42
|
|
BLAKE2b-256 checksum How to use checksums |
8d278c49827f33e30784cfb4baaba1b362b007ccf07b3690a1b147ac5dbde692
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 7, 2025.
Transparency log