Skip to content

Commit

Permalink
Fix: Ignore routes under swagger blueprint
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjr0719 committed Jun 20, 2019
1 parent 215d1c1 commit ed932cc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sanic_openapi/swagger.py
Expand Up @@ -10,7 +10,7 @@
from .doc import route as doc_route
from .doc import route_specs, serialize_schema

blueprint = Blueprint("swagger", url_prefix="swagger")
blueprint = Blueprint("swagger", url_prefix="/swagger")

dir_path = os.path.dirname(os.path.realpath(__file__))
dir_path = os.path.abspath(dir_path + "/ui")
Expand Down Expand Up @@ -95,6 +95,10 @@ def build_spec(app, loop):
paths = {}
for uri, route in app.router.routes_all.items():

# Ignore routes under swagger blueprint
if route.uri.startswith(blueprint.url_prefix):
continue

if "static" in route.name:
# TODO: add static flag in sanic routes
continue
Expand Down

0 comments on commit ed932cc

Please sign in to comment.