swagger-spec-validator
Validation of Swagger specifications
What it is and what it does
Swagger Spec Validator is a Python library that checks Swagger API specifications for compliance with the official Swagger 1.2 or 2.0 specification. It takes a Swagger spec (typically loaded from a URL or file) and validates its structure, required fields, and data types against the specification schema. The validation catches structural errors, missing required fields, and type mismatches that would prevent the spec from being used by API tools and code generators.
The package is built on jsonschema and pyyaml to parse and validate YAML and JSON specs. It's commonly used in API development workflows to catch spec errors early, in CI/CD pipelines to gate spec changes, and by API frameworks that need to verify specs before generating client code or server stubs.
Use it for:
- Validate Swagger specs in CI/CD pipelines before deploying API documentation or code generators
- Check Swagger 2.0 specs programmatically during API development to catch schema errors early
- Verify Swagger 1.2 legacy specs for compliance when migrating or maintaining older APIs
- Integrate spec validation into API tooling or frameworks that consume Swagger definitions
- Validate specs fetched from remote URLs to ensure they meet Swagger specification requirements
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Validates Swagger/OpenAPI specifications (versions 1.2 and 2.0) against their official schema to ensure full compliance with the Swagger specification.
Yes. The package is production-stable, actively maintained with recent commits, has low install friction, carries no known vulnerabilities, and solves a concrete problem in API development. Install it if you work with Swagger 1.2 or 2.0 specs and need programmatic validation.
Install
swagger-spec-validator on PyPI
pip
pip install swagger-spec-validatoruv
uv add swagger-spec-validatorpoetry
poetry add swagger-spec-validatorInstalling swagger-spec-validator
Before you install
Low friction install with four lightweight runtime dependencies (jsonschema, pyyaml, typing-extensions, importlib-resources). Actively maintained with recent commits and production-stable status.
License in practice
Licensed under Apache License, Version 2.0 (permissive), allowing commercial use, modification, and distribution with minimal restrictions.
Quickstart
pip install swagger-spec-validator
from swagger_spec_validator import validate_spec_url
# Validate a Swagger 2.0 spec from a URL
validate_spec_url('http://petstore.swagger.io/v2/swagger.json')
Verify before relying
- Whether the validator supports OpenAPI 3.0+ specifications or only Swagger 1.2 and 2.0
- Performance characteristics when validating large or complex specifications
Package facts
| License | Apache License, Version 2.0 (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — jsonschema, pyyaml, typing-extensions, importlib-resources |
| Maintenance | actively maintained — 778 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 809,689/month — #5,009 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: swagger_spec_validator-3.0.4-py2.py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
flexValidates Swagger 2.0 API specifications…
permissive · top 15,000 on PyPI
prancePrance parses and validates Swagger/OpenAPI 2.0…
unclear · top 5,000 on PyPI
openapi-spec-validatorValidates OpenAPI specifications (versions 2.0,…
permissive · top 1,000 on PyPI
openapi3Parses and validates OpenAPI 3 specifications,…
permissive · top 15,000 on PyPI
bravado-corebravado-core validates, marshals, and…
permissive · top 15,000 on PyPI
bagit-profileValidates BagIt bags against BagIt profile…
permissive · top 15,000 on PyPI
openapi-schema-validatorValidates data and schemas against OpenAPI…
permissive · top 1,000 on PyPI
openapi-codecConverts between OpenAPI/Swagger schemas and…
permissive · top 15,000 on PyPI
CerberusCerberus validates Python dictionaries and…
permissive · top 5,000 on PyPI
kubernetes-validateValidates Kubernetes resource definitions…
permissive · top 15,000 on PyPI