Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?


Failed to load latest commit information.
Latest commit message
Commit time
March 17, 2023 07:33
February 27, 2023 06:50
March 17, 2023 08:38
March 17, 2023 08:38
March 17, 2023 08:38
September 6, 2017 09:08
September 2, 2022 01:10
July 22, 2019 16:03
February 17, 2021 20:59
March 17, 2023 09:02
September 27, 2019 12:34
March 17, 2023 08:38

OpenAPI Spec validator


OpenAPI Spec Validator is a Python library 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.


Check documentation to see more details about the features. All documentation is in the "docs" directory and online at


pip install openapi-spec-validator

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

pip install -e git+


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 p1c2u/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).

Python package

from openapi_spec_validator import validate_spec
from openapi_spec_validator.readers import read_from_filename

spec_dict, spec_url = read_from_filename('openapi.yaml')

# If no exception is raised by validate_spec(), the spec is valid.

validate_spec({'openapi': '3.1.0'})

Traceback (most recent call last):
OpenAPIValidationError: 'info' is a required property

For more details, read about Python package.

Related projects

  • openapi-core
    Python library that adds client-side and server-side support for the OpenAPI v3.0 and OpenAPI v3.1 specification.
  • openapi-schema-validator
    Python library that validates schema against the OpenAPI Schema Specification v3.0 and OpenAPI Schema Specification v3.1.


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