Skip to content

Commit

Permalink
Group by parent
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarber-akamai committed Sep 1, 2024
1 parent 03715f9 commit 5239b95
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 0 additions & 2 deletions linodecli/baked/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,6 @@ def __simplify(sentence: str) -> Optional[str]:
if simplified is not None
)

print(result)

if result is None:
raise ValueError(
f"description does not contain any relevant lines: {description}",
Expand Down
17 changes: 11 additions & 6 deletions linodecli/documentation/template_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,17 @@ def from_openapi(cls, arg: OpenAPIRequestArg) -> Self:
:returns: The initialized object.
"""

type_str = arg.datatype
if arg.item_type is not None:
type_str = f"{arg.datatype}[{arg.item_type}]"

if arg.format == "json":
type_str = "json"

return cls(
path=arg.path,
required=arg.required,
type=(
arg.datatype
if arg.item_type is None
else f"{arg.datatype}[{arg.item_type}]"
),
type=type_str,
is_json=arg.format == "json",
is_nullable=arg.nullable,
is_parent=arg.is_parent,
Expand Down Expand Up @@ -224,7 +227,9 @@ def from_openapi(cls, operation: OpenAPIOperation) -> Self:
if not isinstance(arg, OpenAPIRequestArg):
continue

sections[arg.prefix or ""].append(Argument.from_openapi(arg))
sections[arg.parent if arg.is_child else ""].append(
Argument.from_openapi(arg)
)

result.argument_sections = sorted(
[
Expand Down

0 comments on commit 5239b95

Please sign in to comment.