| 1 |
""" |
| 2 |
Test compatibility with pre 0.5.14 version |
| 3 |
|
| 4 |
- produces was accepted as string |
| 5 |
- definitions references had method prefix |
| 6 |
""" |
| 7 |
|
| 8 |
|
| 9 |
from flask import Flask, jsonify, request |
| 10 |
|
| 11 |
from flasgger import Swagger |
| 12 |
|
| 13 |
app = Flask(__name__) |
| 14 |
app.config['SWAGGER'] = { |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
'prefix_ids': True |
| 20 |
} |
| 21 |
swag = Swagger(app) |
| 22 |
|
| 23 |
|
| 24 |
@app.route('/', methods=['POST']) |
| 25 |
def index(): |
| 26 |
""" |
| 27 |
Test the compatibility |
| 28 |
This is just a test for flasgger 0.5.14 compat |
| 29 |
--- |
| 30 |
parameters: |
| 31 |
- in: body |
| 32 |
name: body |
| 33 |
schema: |
| 34 |
id: alert |
| 35 |
properties: |
| 36 |
message: |
| 37 |
type: string |
| 38 |
produces: |
| 39 |
application/json |
| 40 |
responses: |
| 41 |
200: |
| 42 |
description: Alert |
| 43 |
schema: |
| 44 |
$ref: '#/definitions/index_post_alert' |
| 45 |
""" |
| 46 |
return jsonify({'message': request.json.get('message')}) |
| 47 |
|
| 48 |
|
| 49 |
if __name__ == '__main__': |
| 50 |
app.run(debug=True) |