Bottle + APISpec + Marshmallow integration
Project description
bottle-apispec
Simple plugin to easily enable integrate Bottle, APISpec and Marshmallow.
Example
from bottle import Bottle, run
from truckpad.bottle.apispec import APISpecPlugin
app = Bottle()
class MySchema(Schema):
id = String()
value = String()
@app.get('/')
def index():
"""API endpoint that return MySchema
---
get:
description: API endpoint that return MySchema
responses:
200:
description: It works!!!!
schema: MySchema
"""
data, error = MySchema.load('id', 'value')
return data
app.install(APISpecPlugin(
title='Example API',
version='1.0.0',
openapi_version='2.0',
plugins=(
MarshmallowPlugin(),
),
scan_package='.')
)
run(app)
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
bottle-apispec-0.5.2.tar.gz
(2.6 kB
view hashes)
Built Distribution
Close
Hashes for bottle_apispec-0.5.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ef1e43c7eb54ff24f031d11dc3fe05d855f979b500035764028fc9ea09f2e2e |
|
MD5 | 358d9a758c3071576cc17597116a9ac6 |
|
BLAKE2b-256 | 22bc0e1d6b0f7ed6ec091007b9d40da0a29623311b2ea16fcc2987205e9cf21a |