Skip to main content

client-side and server-side support for the OpenAPI Specification v3

Project description

https://img.shields.io/pypi/v/openapi-core.svg https://travis-ci.org/python-openapi/openapi-core.svg?branch=master https://img.shields.io/codecov/c/github/python-openapi/openapi-core/master.svg?style=flat https://img.shields.io/pypi/pyversions/openapi-core.svg https://img.shields.io/pypi/format/openapi-core.svg https://img.shields.io/pypi/status/openapi-core.svg

About

Openapi-core is a Python library that adds client-side and server-side support for the OpenAPI v3.0 and OpenAPI v3.1 specification.

Key features

  • Validation and unmarshalling of request and response data (including webhooks)

  • Integration with popular libraries (Requests, Werkzeug) and frameworks (Django, Falcon, Flask, Starlette)

  • Customization with media type deserializers and format unmarshallers

  • Security data providers (API keys, Cookie, Basic and Bearer HTTP authentications)

Documentation

Check documentation to see more details about the features. All documentation is in the “docs” directory and online at openapi-core.readthedocs.io

Installation

Recommended way (via pip):

pip install openapi-core

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

pip install -e git+https://github.com/python-openapi/openapi-core.git#egg=openapi_core

First steps

Firstly create your OpenAPI object.

from openapi_core import OpenAPI

openapi = OpenAPI.from_file_path('openapi.json')

Now you can use it to validate and unmarshal against requests and/or responses.

# raises error if request is invalid
result = openapi.unmarshal_request(request)

Retrieve validated and unmarshalled request data

# get parameters
path_params = result.parameters.path
query_params = result.parameters.query
cookies_params = result.parameters.cookies
headers_params = result.parameters.headers
# get body
body = result.body
# get security data
security = result.security

Request object should implement OpenAPI Request protocol. Check Integrations to find officially supported implementations.

For more details read about Unmarshalling process.

If you just want to validate your request/response data without unmarshalling, read about Validation instead.

License

The project is under the terms of BSD 3-Clause License.

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

openapi_core-0.19.0a1.tar.gz (103.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openapi_core-0.19.0a1-py3-none-any.whl (99.6 kB view details)

Uploaded Python 3

File details

Details for the file openapi_core-0.19.0a1.tar.gz.

File metadata

  • Download URL: openapi_core-0.19.0a1.tar.gz
  • Upload date:
  • Size: 103.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.0 Linux/6.2.0-1016-azure

File hashes

Hashes for openapi_core-0.19.0a1.tar.gz
Algorithm Hash digest
SHA256 76414ebd43aea54a0f34c603ee986470293fe7bcde53fb74f4ba41a8f76746ac
MD5 beb9433cf27086fff824a9d5dcb103cc
BLAKE2b-256 ea51ec2a7c8ea1ee0c886ec2afba5ef9e2ec65558c78a2bf2ab78f44577a074d

See more details on using hashes here.

File details

Details for the file openapi_core-0.19.0a1-py3-none-any.whl.

File metadata

  • Download URL: openapi_core-0.19.0a1-py3-none-any.whl
  • Upload date:
  • Size: 99.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.0 Linux/6.2.0-1016-azure

File hashes

Hashes for openapi_core-0.19.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 3d339c12f0da2948b19d196203651592314fef4c7c9f88e0fa81bf47cc86deed
MD5 42fee6d3484b529775ea3abddd8f4993
BLAKE2b-256 4e6dcc6a8f6bbc57f33cf0d61f2026c9aa88e2748bd0b45e6418a3735c436053

See more details on using hashes here.

Supported by

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