Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

OpenAPI Spec Validator is a CLI, pre-commit hook and python package that validates OpenAPI Specs against the OpenAPI 2.0 (aka Swagger), OpenAPI 3.0 and OpenAPI 3.1 specification.

License

NotificationsYou must be signed in to change notification settings

python-openapi/openapi-spec-validator

Repository files navigation

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

About

OpenAPI Spec Validator is a CLI, pre-commit hook and python package that validates OpenAPI Specsagainst theOpenAPI 2.0 (aka Swagger),OpenAPI 3.0andOpenAPI 3.1specification. 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 atopenapi-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 pythonopenapi/openapi-spec-validator /openapi.yaml

or more pythonic way:

python -m openapi_spec_validator openapi.yaml

For more details, read aboutCLI (Command Line Interface).

pre-commit hook

repos:-repo:https://github.com/python-openapi/openapi-spec-validatorrev:0.5.5# The version to use or 'master' for latesthooks:    -id:openapi-spec-validator

For more details, read aboutpre-commit hook.

Python package

fromopenapi_spec_validatorimportvalidatefromopenapi_spec_validator.readersimportread_from_filenamespec_dict,base_uri=read_from_filename('openapi.yaml')# If no exception is raised by validate(), the spec is valid.validate(spec_dict)validate({'openapi':'3.1.0'})Traceback (mostrecentcalllast):    ...OpenAPIValidationError:'info'isarequiredproperty

For more details, read aboutPython 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

About

OpenAPI Spec Validator is a CLI, pre-commit hook and python package that validates OpenAPI Specs against the OpenAPI 2.0 (aka Swagger), OpenAPI 3.0 and OpenAPI 3.1 specification.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

    Packages

    No packages published

    [8]ページ先頭

    ©2009-2025 Movatter.jp