Giter Site home page Giter Site logo

openapi-spec-validator's Introduction

OpenAPI Spec validator

https://img.shields.io/docker/v/p1c2u/openapi-spec-validator.svg?color=%23086DD7&label=docker%20hub&sort=semver https://travis-ci.org/python-openapi/openapi-spec-validator.svg?branch=master https://img.shields.io/codecov/c/github/python-openapi/openapi-spec-validator/master.svg?style=flat

About

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.

Documentation

Check documentation to see more details about the features. All documentation is in the "docs" directory and online at openapi-spec-validator.readthedocs.io

Installation

pip install openapi-spec-validator

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

pip install -e git+https://github.com/python-openapi/openapi-spec-validator.git#egg=openapi_spec_validator

Usage

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(spec_dict)

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.

License

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

openapi-spec-validator's People

Contributors

adammkelly avatar arcivanov avatar arthurzam avatar avisat avatar beirdo avatar bollwyvl avatar chyzzqo avatar dependabot[bot] avatar dtkav avatar gregor-d avatar grimlock257 avatar hlobit avatar jayvdb avatar jfinkhaeuser avatar julien-lecomte avatar julienpalard avatar mattisg avatar mgorny avatar miguelgf avatar musicinmybrain avatar nezhar avatar nicktimko avatar p1c2u avatar robbesneyders avatar samdbmg avatar sisp avatar smarlowucf avatar stanislavlevin avatar venthur avatar wim-de-clercq avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.