forked from flasgger/flasgger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathno_routes.py
48 lines (35 loc) · 794 Bytes
/
no_routes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""
In this example nothing is swagged
this is useful for testing if Swagger is ignoring
no swagabble views.
"""
from flask import Flask
from flask.views import MethodView
from flasgger import Swagger
app = Flask(__name__)
swag = Swagger()
@app.route('/')
def index():
return 'Hello World'
class TestView(MethodView):
def get(self):
return 'Hello World'
class Meow(MethodView):
"""
This is to ensure Swagger does not break with empty MethodViews
issue #76
"""
pass
app.add_url_rule(
'/meow/<int:param>/',
view_func=Meow.as_view('meow'),
methods=['DELETE']
)
app.add_url_rule(
'/testview',
view_func=TestView.as_view('testview'),
methods=['GET']
)
if __name__ == '__main__':
swag.init_app(app)
app.run(debug=True)