Skip to main content

No project description provided

Project description

# OpenAPI Spec validator

[![Package Version](https://img.shields.io/pypi/v/openapi-spec-validator.svg)](https://pypi.python.org/pypi/openapi-spec-validator)
[![Build Status](https://travis-ci.org/p1c2u/openapi-spec-validator.svg?branch=master)](https://travis-ci.org/p1c2u/openapi-spec-validator)
[![Code Coverage](https://img.shields.io/codecov/c/github/p1c2u/openapi-spec-validator/master.svg?style=flat)](https://codecov.io/github/p1c2u/openapi-spec-validator?branch=master)
[![PyPI Version](https://img.shields.io/pypi/pyversions/openapi-spec-validator.svg)](https://pypi.python.org/pypi/openapi-spec-validator)
[![PyPI Format](https://img.shields.io/pypi/format/openapi-spec-validator.svg)](https://pypi.python.org/pypi/openapi-spec-validator)
[![PyPI Status](https://img.shields.io/pypi/status/openapi-spec-validator.svg)](https://pypi.python.org/pypi/openapi-spec-validator)

## About

OpenAPI Spec Validator is a Python library that validates OpenAPI Specs against the [OpenAPI 2.0 (aka Swagger)](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md) and [OpenAPI 3.0.0](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md) 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:

```bash
$ openapi-spec-validator some.yaml
```

or more pythonic way:

```bash
$ python -m openapi_spec_validator some.yaml
```

### Examples

Validate spec:

```python

from openapi_spec_validator import validate_spec

validate_spec(spec_dict)
```

Add `spec_url` to validate spec with relative files:

```python

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:

```python

from openapi_spec_validator import validate_spec_url

validate_spec_url('http://example.com/openapi.json')
```

If you want to iterate through validation errors:

```python

from openapi_spec_validator import openapi_v3_spec_validator

errors_iterator = openapi_v3_spec_validator.iter_errors(spec)
```

## Related projects

* [openapi-core](https://github.com/p1c2u/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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openapi-spec-validator-0.2.4.tar.gz (20.9 kB view details)

Uploaded Source

Built Distributions

openapi_spec_validator-0.2.4-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

openapi_spec_validator-0.2.4-py2-none-any.whl (20.7 kB view details)

Uploaded Python 2

File details

Details for the file openapi-spec-validator-0.2.4.tar.gz.

File metadata

  • Download URL: openapi-spec-validator-0.2.4.tar.gz
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/2.7.12

File hashes

Hashes for openapi-spec-validator-0.2.4.tar.gz
Algorithm Hash digest
SHA256 14684aaec4c4f30e911132ffad3c5863047908251647f49114d249dcc2d41f4e
MD5 de08730514e40ca0d569ddc51289adf7
BLAKE2b-256 057ec36db69b76e5141cf993087741d1847c73972fc671782d44af4f75e98a3a

See more details on using hashes here.

File details

Details for the file openapi_spec_validator-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: openapi_spec_validator-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 22.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/2.7.12

File hashes

Hashes for openapi_spec_validator-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5946bab0b5c0e4bd915dbcac308561cb7b2f1c219a9b447f93ae26752f9328c6
MD5 4ae8f6d094f9fef531179f4a4de61c33
BLAKE2b-256 71d5ac7f29d086444b473de678023b2c486c58de5b3d55b5fadd95a67cf7c416

See more details on using hashes here.

File details

Details for the file openapi_spec_validator-0.2.4-py2-none-any.whl.

File metadata

  • Download URL: openapi_spec_validator-0.2.4-py2-none-any.whl
  • Upload date:
  • Size: 20.7 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/2.7.12

File hashes

Hashes for openapi_spec_validator-0.2.4-py2-none-any.whl
Algorithm Hash digest
SHA256 48c83d77b98a1b046973e2cd26b441a6db60a858382e9c3d7d8e63c940a7878f
MD5 da1343417bdd6a6d8e4c2e8990a0c51a
BLAKE2b-256 6e028e436ff26d13dcae0f3b53acf19df7ddde91cbe0ebf98b8c37e884839253

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page