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 bottle_apispec import APISpecPlugin
from marshmallow import Schema
from marshmallow.fields import String
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',
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.8.3.tar.gz
(2.7 kB
view hashes)
Built Distribution
Close
Hashes for bottle_apispec-0.8.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b376d42f94571355ad87e0ecdf0b47c35fcc6c27357a055e94c84fbe42bc07c |
|
MD5 | 11bd685de2a41d8658b2ce841a3e47c3 |
|
BLAKE2b-256 | 10f03b4bf54ef9a1306091d9ac81dd20e3bcfd97b5e63ebe3837ca50b09f7b52 |