[add]: Swagger Documentation

This commit is contained in:
VivianDee
2025-03-24 08:44:57 +01:00
parent 7a4a9a9b99
commit dad8e68c9f
72 changed files with 1679 additions and 66 deletions
+1 -1
View File
@@ -1 +1 @@
from .handlers import method_not_allowed, unsupported_media_type
from .handlers import register_error_handlers
+19 -9
View File
@@ -1,14 +1,24 @@
from werkzeug.exceptions import HTTPException
from flask import jsonify
from app.helpers.response_helper import ResponseHelper
from app.api.helpers.response_helper import ResponseHelper
def method_not_allowed(error):
return jsonify({"message": "Method Not Allowed"}), 405
def register_error_handlers(app):
@app.errorhandler(HTTPException)
def handle_http_exception(e):
return jsonify({'error': e.description}), e.code
@app.errorhandler(405)
def method_not_allowed(error):
return jsonify({"message": "Method Not Allowed"}), 405
def not_found(error):
return jsonify({"message": "Resource not found"}), 404
@app.errorhandler(404)
def not_found(error):
return jsonify({"message": "Resource not found"}), 404
def bad_request(error):
return jsonify({"message": "Bad Request"}), 400
@app.errorhandler(400)
def bad_request(error):
return jsonify({"message": "Bad Request"}), 400
def unsupported_media_type(error):
return jsonify({"message": "Unsupported Media Type"}), 415
@app.errorhandler(415)
def unsupported_media_type(error):
return jsonify({"message": "Unsupported Media Type"}), 415