Skip to content
Snippets Groups Projects
Commit 0e97ee793c1e authored by Frank Bessou's avatar Frank Bessou :spider_web:
Browse files

refactor: allow api-path-prefix to start/end by a '/'

parent 65d6f4ed0cbf
No related branches found
No related tags found
2 merge requests!34feat: remove 'api-server-name' configuration,!30chore: avoid request pre-released version of black
......@@ -96,6 +96,6 @@
repo = get_cw_repo(config)
path_prefix: str = (
repo.get_option_value("api-path-prefix") or API_PATH_DEFAULT_PREFIX
)
match = re.match("^/[a-zA-Z0-9-_@.&+!*(),/]{1,29}$", path_prefix)
).strip("/")
match = re.match("^[a-zA-Z0-9-_@.&+!*(),/]{1,29}$", path_prefix)
if match:
......@@ -101,5 +101,5 @@
if match:
return f"{path_prefix.rstrip('/')}/v1"
return f"{path_prefix}/v1"
else:
if len(path_prefix) > 30:
raise ConfigurationError(
......@@ -107,11 +107,6 @@
"Max size allowed is 30 characters. "
f"Current size is {len(path_prefix)}."
)
if not path_prefix.startswith("/"):
raise ConfigurationError(
f"api-path-prefix '{path_prefix}' does not start with '/'. "
"Prefix should start with '/' to be validated by openapi"
)
raise ConfigurationError(
f"api-path-prefix '{path_prefix}' contains invalid characters. "
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment