]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
:zap: Optimize regexp pattern in get_path_param_names (#1243)
authorKazantcev Andrey <45011689+heckad@users.noreply.github.com>
Fri, 12 Jun 2020 19:59:32 +0000 (22:59 +0300)
committerGitHub <noreply@github.com>
Fri, 12 Jun 2020 19:59:32 +0000 (21:59 +0200)
fastapi/utils.py

index c9022fbc3b43b3cb6565c7d4b4e57219d85da823..89bf861a57cd6ec276d5c12610cc47f7a7817de1 100644 (file)
@@ -67,7 +67,7 @@ def get_model_definitions(
 
 
 def get_path_param_names(path: str) -> Set[str]:
-    return {item.strip("{}") for item in re.findall("{[^}]*}", path)}
+    return set(re.findall("{(.*?)}", path))
 
 
 def create_response_field(