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.6.0.tar.gz
(2.6 kB
view hashes)
Built Distribution
Close
Hashes for bottle_apispec-0.6.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c789e84030d3b184fa7efca4824fb4b6927630fddb41c308e4497a8cd571640c |
|
MD5 | 30e2945cc0819361eb790c13dc513f41 |
|
BLAKE2b-256 | 3c55822022210b2ad01da8b7333958d4c59a244abff78fed57b3c4d7ae386a62 |