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.7.0.tar.gz
(2.7 kB
view hashes)
Built Distribution
Close
Hashes for bottle_apispec-0.7.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 665cc1920c57066b80855debe66a37363eb556e4fc5196add585e823c293385f |
|
MD5 | 1a5dfc279bcc85b9164f81aa8f2cc484 |
|
BLAKE2b-256 | bc83bfb641f5866db915ee1c27dd694ed33ffd632aad36ddc90fc299b3553928 |