From ffb82c115485b6240ff354b1b05548878f9ce6a6 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Mon, 3 Feb 2025 20:58:02 -0500 Subject: [PATCH] added swagger test --- app/app.py | 25 +++++++++++++++++++++++++ app/requirements.txt | 3 ++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/app/app.py b/app/app.py index 4a8d043..ed45b11 100644 --- a/app/app.py +++ b/app/app.py @@ -1,6 +1,31 @@ from flask import Flask +from flask_swagger_ui import get_swaggerui_blueprint + app = Flask(__name__) +SWAGGER_URL = '/api/docs' # URL for exposing Swagger UI (without trailing '/') +API_URL = 'http://petstore.swagger.io/v2/swagger.json' # Our API url (can of course be a local resource) + +# Call factory function to create our blueprint +swaggerui_blueprint = get_swaggerui_blueprint( + SWAGGER_URL, # Swagger UI static files will be mapped to '{SWAGGER_URL}/dist/' + API_URL, + config={ # Swagger UI config overrides + 'app_name': "Test application" + }, + # oauth_config={ # OAuth config. See https://github.com/swagger-api/swagger-ui#oauth2-configuration . + # 'clientId': "your-client-id", + # 'clientSecret': "your-client-secret-if-required", + # 'realm': "your-realms", + # 'appName': "your-app-name", + # 'scopeSeparator': " ", + # 'additionalQueryStringParams': {'test': "hello"} + # } +) + +app.register_blueprint(swaggerui_blueprint) + + @app.route('/') def hello(): return "Hello World!" diff --git a/app/requirements.txt b/app/requirements.txt index e6e63d7..6685afc 100644 --- a/app/requirements.txt +++ b/app/requirements.txt @@ -12,4 +12,5 @@ flasgger sqlalchemy flask-socketio Flask-Mail -pycountry \ No newline at end of file +pycountry +flask-swagger-ui \ No newline at end of file