Skip to content

Commit

Permalink
Merge pull request #8 from koxudaxi/fix_invalid_root_path_and_paramters
Browse files Browse the repository at this point in the history
fix invalid root_path and parameters
  • Loading branch information
koxudaxi authored Jun 16, 2020
2 parents c71d4b7 + 0c41436 commit 5fbaca8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fastapi_code_generator/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5fbaca8

Please sign in to comment.