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.2.tar.gz
(2.7 kB
view hashes)
Built Distribution
Close
Hashes for bottle_apispec-0.8.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e608c5079282e2f6909a7bd212e7acd7c69ad1b1335976d9f3129ffa6d0fcb8d |
|
MD5 | acbdcaa3b3699c2939cf01dcc740669d |
|
BLAKE2b-256 | 77c135c004eb721d4ac5936c3be6edd2c60564d3d99145bd1a720bd2207073ec |