diff --git a/renovate.json b/renovate.json deleted file mode 100644 index c7a01cb..0000000 --- a/renovate.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": [ - "config:recommended", - ":enablePreCommit" - ] -} diff --git a/src/framex/plugin/on.py b/src/framex/plugin/on.py index b5dbfc6..361ee67 100644 --- a/src/framex/plugin/on.py +++ b/src/framex/plugin/on.py @@ -30,10 +30,11 @@ def decorator(cls: type) -> type: if getattr(func, "_on_request", False): call_type = func.__expose__call_type path = func.__expose_path__ + api_prefix = func.__api_prefix if not path: call_type = ApiType.FUNC - elif not path.startswith(API_STR): + elif api_prefix and not path.startswith(API_STR): path = f"{API_STR}{path}" if path.startswith("/") else f"{API_STR}/{path}" params = extract_method_params(func) @@ -64,7 +65,11 @@ def decorator(cls: type) -> type: def on_request( - path: str | None = None, methods: list[str] | None = None, call_type: ApiType = ApiType.HTTP, stream: bool = False + path: str | None = None, + methods: list[str] | None = None, + call_type: ApiType = ApiType.HTTP, + stream: bool = False, + api_prefix: bool = True, ) -> Callable: if methods is None: methods = ["GET"] @@ -96,6 +101,7 @@ def wrapper(func: Callable) -> Callable: func.__expose_methods_ = methods # type: ignore [attr-defined] func.__expose__call_type = call_type # type: ignore [attr-defined] func.__expose_stream = stream # type: ignore [attr-defined] + func.__api_prefix = api_prefix # type: ignore [attr-defined] return func return wrapper