Skip to content

Commit

Permalink
Add url_prefix to paths in OpenAPI definition
Browse files Browse the repository at this point in the history
  • Loading branch information
louise-davies committed Apr 24, 2023
1 parent d88d295 commit 0ed0078
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions datagateway_api/src/swagger/apispec_flask_restful.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from apispec.exceptions import APISpecError
import yaml

from datagateway_api.src.common.config import Config


def deduce_path(resource, **kwargs):
"""Find resource path using provided API or path itself"""
Expand Down Expand Up @@ -73,6 +75,7 @@ def path_helper(self, path=None, operations=None, parameters=None, **kwargs):
resource = kwargs.pop("resource")
path = deduce_path(resource, **kwargs)
path = re.sub(r"<(?:[^:<>]+:)?([^<>]+)>", r"{\1}", path)
path = f"{Config.config.url_prefix}{path}"
return path
except Exception as exc:
logging.getLogger(__name__).exception(
Expand Down

0 comments on commit 0ed0078

Please sign in to comment.