From a1bfaf8f421b998a138ee7a9bd9c891c62e1debb Mon Sep 17 00:00:00 2001 From: VikasMastud Date: Mon, 3 Mar 2025 17:33:24 +0530 Subject: [PATCH] fix: prevent duplicate route names when importing swagger-blueprint in Sanic --- sanic_openapi/openapi2/blueprint.py | 2 +- sanic_openapi/openapi3/blueprint.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sanic_openapi/openapi2/blueprint.py b/sanic_openapi/openapi2/blueprint.py index 8878a99..68d1f46 100644 --- a/sanic_openapi/openapi2/blueprint.py +++ b/sanic_openapi/openapi2/blueprint.py @@ -22,7 +22,7 @@ def blueprint_factory(): dir_path = abspath(dir_path + "/ui") swagger_blueprint.static( - "/", dir_path + "/index.html", strict_slashes=True + "/", dir_path + "/index.html", strict_slashes=True, name="static-index" ) swagger_blueprint.static("", dir_path) diff --git a/sanic_openapi/openapi3/blueprint.py b/sanic_openapi/openapi3/blueprint.py index 343d662..66810d4 100644 --- a/sanic_openapi/openapi3/blueprint.py +++ b/sanic_openapi/openapi3/blueprint.py @@ -19,7 +19,7 @@ def blueprint_factory(): dir_path = dirname(dirname(realpath(__file__))) dir_path = abspath(dir_path + "/ui") - oas3_blueprint.static("/", dir_path + "/index.html", strict_slashes=True) + oas3_blueprint.static("/", dir_path + "/index.html", strict_slashes=True, name="static-index") oas3_blueprint.static("", dir_path) # Redirect "/swagger" to "/swagger/"