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
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.5.5.tar.gz
(2.6 kB
view hashes)
Built Distribution
Close
Hashes for bottle_apispec-0.5.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57f2ccc25300f56a404b08b897564ecad91f27a08c5cf462ed8f3e3c4d748460 |
|
MD5 | 85ad155cc17fa6ca5b6c2f2711552fa5 |
|
BLAKE2b-256 | c549f4a0ee56c75772f2ec72c69f84737a58729a606aa9a21158987371bee22a |