skillfed

swagger-spec-validator

Validation of Swagger specifications

swagger-spec-validator v3.0.4 809.7K downloads/30d#5,009 on PyPI102
Permissive license Apache License, Version 2.0 Active released

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-validator

uv

uv add swagger-spec-validator

poetry

poetry add swagger-spec-validator

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: Python :: 3.7Programming Language :: Python :: 3.8Topic :: Software Development :: Libraries :: Python Modules

Tags

swagger spec validationopenapi validatorswagger 2.0 validatorapi specification validatorswagger compliance checkervalidate swagger jsonswagger schema validation
api-validationswagger-openapi

More Python Modules packages