Skip to content

Commit 19a7bd3

Browse files
add swagger _3
1 parent 52a1009 commit 19a7bd3

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1+
import os
2+
3+
import yaml
14
from flask_swagger_ui import get_swaggerui_blueprint
25

36
SWAGGER_URL="/swagger"
4-
API_URL="/static/swagger.yaml"
7+
8+
SCRIPT_PATH = os.path.dirname(os.path.realpath(__file__))
9+
API_URL=f"{SCRIPT_PATH}/../static/swagger.yaml"
10+
11+
cnf = {}
12+
with open(API_URL) as f:
13+
cnf = f.read()
14+
cnf = yaml.load(cnf, Loader=yaml.SafeLoader)
515

616
bp = get_swaggerui_blueprint(
717
SWAGGER_URL,
818
API_URL,
919
config={
10-
'app_name': 'Access API'
20+
'app_name': 'Access API',
21+
'spec': cnf,
1122
}
1223
)

0 commit comments

Comments
 (0)