Skip to content

Commit 3f907f9

Browse files
authored
Merge pull request #5 from e-gov/PH-642
PH-642 sample provider python rakendus panna tagastama api-docs faili
2 parents eeddb55 + e06b7ec commit 3f907f9

File tree

4 files changed

+1344
-2
lines changed

4 files changed

+1344
-2
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.idea
22
venv
3-
tests/postgres-volume
3+
tests/postgres-volume
4+
config/dev.cfg

api/app.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import yaml
44
from flask import Flask, jsonify, request
55
from flask_sqlalchemy import SQLAlchemy
6+
from flask_swagger_ui import get_swaggerui_blueprint
67

78
from api.exceptions import (CompanyCodeInvalid,
89
ErrorConfigBase, MandateDataInvalid,
@@ -40,6 +41,17 @@ def create_app():
4041
db.init_app(app)
4142
app.config['SETTINGS'] = parse_settings(app.config['SETTINGS_PATH'])
4243

44+
SWAGGER_URL = "/v1/api-docs"
45+
API_URL = "/static/aasaru-x-road-services-consumed-by-paasuke-0.9.3-resolved.json"
46+
SWAGGER_BLUEPRINT = get_swaggerui_blueprint(
47+
SWAGGER_URL,
48+
API_URL,
49+
config={
50+
'app_name': "X-road services consumed by Pääsuke"
51+
}
52+
)
53+
app.register_blueprint(SWAGGER_BLUEPRINT, url_prefix=SWAGGER_URL)
54+
4355
app.errorhandler(ActionInvalid)(create_error_handler(501))
4456
app.errorhandler(CompanyCodeInvalid)(create_error_handler(400))
4557
app.errorhandler(MandateDataInvalid)(create_error_handler(400))

0 commit comments

Comments
 (0)