No project description provided
Project description
OpenAPI Spec validator
About
OpenAPI Spec Validator is a Python library that validates OpenAPI Specs against the OpenAPI 2.0 (aka Swagger) and OpenAPI 3.0.0 specification. The validator aims to check for full compliance with the Specification.
Installation
$ pip install openapi-spec-validator
Usage
Command Line Interface
Straight forward way:
$ openapi-spec-validator some.yaml
pipes way:
$ cat some.yaml | openapi-spec-validator -
or more pythonic way:
$ python -m openapi_spec_validator some.yaml
Examples
Validate spec:
from openapi_spec_validator import validate_spec
validate_spec(spec_dict)
Add spec_url
to validate spec with relative files:
from openapi_spec_validator import validate_spec
validate_spec(spec_dict, spec_url='file:///path/to/spec/openapi.yaml')
You can also validate spec from url:
from openapi_spec_validator import validate_spec_url
validate_spec_url('http://example.com/openapi.json')
If you want to iterate through validation errors:
from openapi_spec_validator import openapi_v3_spec_validator
errors_iterator = openapi_v3_spec_validator.iter_errors(spec)
Related projects
- openapi-core is a Python library that adds client-side and server-side support for the OpenAPI.
License
Copyright (c) 2017, Artur Maciag, All rights reserved. Apache v2
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Close
Hashes for openapi-spec-validator-0.2.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e489c7a273284bc78277ac22791482e8058d323b4a265015e9fcddf6a8045bcd |
|
MD5 | 0b5a16d27b5ef20972d9d729c7aa2e07 |
|
BLAKE2b-256 | 682c22f3d3d04a0cdb1d0a1389bd7efaa1488e65eca236957a94442325571b7e |
Close
Hashes for openapi_spec_validator-0.2.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0caacd9829e9e3051e830165367bf58d436d9487b29a09220fa7edb9f47ff81b |
|
MD5 | 45328a4767760965b14423fff7af49c4 |
|
BLAKE2b-256 | 4aef7ec6c49367faea4c666e536fcb5d4165a677220ccae882e861d2c2f02878 |
Close
Hashes for openapi_spec_validator-0.2.8-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4da8aef72bf5be40cf0df444abd20009a41baf9048a8e03750c07a934f1bdd8 |
|
MD5 | 3b4298b44d3a43b95386b430b7e670ca |
|
BLAKE2b-256 | 6f99a9b931021c2cf6eaaa760fee80b8b65a8a3d25af2d7ab97c61444654250d |