From 0c41436669a3cb849551e9612322eae832fa323a Mon Sep 17 00:00:00 2001 From: Koudai Aono Date: Wed, 17 Jun 2020 04:42:06 +0900 Subject: [PATCH] fix invalid root_path and parameters --- fastapi_code_generator/parser.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fastapi_code_generator/parser.py b/fastapi_code_generator/parser.py index 30980da..224cfff 100644 --- a/fastapi_code_generator/parser.py +++ b/fastapi_code_generator/parser.py @@ -83,7 +83,8 @@ class Operation(CachedPropertyModel): @cached_property def root_path(self) -> UsefulStr: - return UsefulStr(self.path.split("/")[1:]) + paths = self.path.split("/") + return UsefulStr(paths[1] if len(paths) > 1 else '') @cached_property def snake_case_path(self) -> str: @@ -309,6 +310,7 @@ def inject_path_and_type_to_operation(cls, values: Dict[str, Any]) -> Any: if (v := values.get(o)) }, path=path, + parameters=values.get('parameters', []), ) @root_validator