Skip to main content

About

The Bottle OpenAPI 3 Plugin is a toolkit for performing validation of requests against an OpenAPI document for Bottle applications. It is built on the openapi-core and openapi-spec-validator libraries, and supports the OpenAPI 3 specification.

License

This codebase is MIT licensed.

Requirements

A relatively recent version of Python (3.5+) is required. This plugin depends on the aforementioned openapi-core and openapi-spec-validator libraries, and also requires a relatively recent version of bottle (0.12+).

Quickstart

The Bottle OpenAPI 3 plugin may either be installed from pypi as the bottle-openapi-3 package:

pip install bottle-openapi-3

or may be installed from source from the git repository:

python setup.py install

Once the plugin is installed, it may be used in a Bottle application by loading the OpenAPI schema and installing the plugin. An example:

import bottle
import yaml
from bottle_openapi_3 import OpenAPIPlugin

app = bottle.Bottle()

with open("swagger.yaml") as f:
    spec = yaml.load(f)

@app.route("/api/foo")
def foo_handler():
    return {"foo": "bar"}

app.install(OpenAPIPlugin(spec))

app.run()

The example’s specification:

openapi: 3.0.0
info:
  title: My API
servers:
  - url: /api
paths:
  /foo:
    get:
       summary: Fetch an object
       responses:
         "200":
            description: "An object was successfully generated."
            content:
              application/json:
                schema: {"type": "object"}

Advanced Usage

TODO

Changelog

0.1.2 (May 2021)

Fixed an issue decoding the request body for HTTP methods like POST, PUT, etc.

0.1.0 (Jan 2021)

Initial alpha release of the OpenAPI 3 plugin for Bottle. Most functionality should be implemented.

Metadata

Release files for bottle-openapi-3 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bottle-openapi-3 0.1.2
File Size Uploaded
bottle-openapi-3-0.1.2.tar.gz 1.0 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for bottle-openapi-3 0.1.2
File Interpreter ABI Platform
bottle_openapi_3-0.1.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 2.1 MB

Release files / bottle-openapi-3-0.1.2.tar.gz

Download URL bottle-openapi-3-0.1.2.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
e7c59ab94d6ece693bdac55f7aeaffc78fec1f5400588f38d3e8a055a47334bf
BLAKE2b-256 checksum
How to use checksums
a822ba85c62b7e83b2261e332f506397bd534813bd67991e50a23073930c72cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.9

Release files / bottle_openapi_3-0.1.2-py2.py3-none-any.whl

Download URL bottle_openapi_3-0.1.2-py2.py3-none-any.whl
Size 1.1 MB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
a908546f6f00271cf9eda9d2c5e548dcb41edb705c00cda791bd2288ade6d923
BLAKE2b-256 checksum
How to use checksums
d6f675892b69b7760010784e8ee46ee4901c2bda409301c4506e943b91e477f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.9

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page