Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add enum extension #366

Merged
merged 14 commits into from
Jun 6, 2024
Merged

Add enum extension #366

merged 14 commits into from
Jun 6, 2024

Conversation

AllyW
Copy link
Member

@AllyW AllyW commented May 28, 2024

No description provided.

@AllyW
Copy link
Member Author

AllyW commented May 28, 2024

image

@@ -172,7 +172,7 @@ def parse_arg_help(help):
if not help.lines and not help.ref_commands:
if not help.short:
raise exceptions.InvalidAPIUsage("Invalid argument help, short summary is miss.")
return help.short
return help.short.replace("\r", "").replace("\n", "")
Copy link
Collaborator

@kairu-ms kairu-ms May 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For short summary, I think it's better keep only the first line. And append the rests into long summary when generate the arg help. Please do not add these logic in the cli generators. It should be fixed when generate the commands.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can revoke the change and arise another PR.

@kairu-ms
Copy link
Collaborator

please update the doc as well

@AllyW
Copy link
Member Author

AllyW commented Jun 5, 2024

image

@@ -36,6 +36,7 @@ class CMDArgEnum(Model):

# properties as nodes
items = ListType(ModelType(CMDArgEnumItem), min_size=1)
supportExtension = CMDBooleanField()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reference this way using serialized_name and deserialize_from

command_groups = DictType(
field=ModelType("CMDCommandTreeNode"),
serialized_name='commandGroups',
deserialize_from='commandGroups'
)

@@ -50,6 +54,7 @@ def build_enum(cls, schema_enum, ref_enum):
break
item = CMDArgEnumItem.build_enum_item(schema_item, ref_enum_item)
enum.items.append(item)
enum.support_extension = schema_enum.support_extension
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line could cause problem. Did you try reload button after set the True value in editor? After reload, the value may be false. BTW, please also verify the inherent function.

Comment on lines 71 to 74
support_extension = CMDBooleanField(
serialized_name="supportExtension",
deserialize_from="supportExtension",
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems in current design, this property may not be needed in Schema

@AllyW AllyW force-pushed the add-enum-extension branch from 5ce5de6 to 7b1862c Compare June 5, 2024 09:36
Co-authored-by: kai ru <69238381+kairu-ms@users.noreply.github.com>
@kairu-ms kairu-ms merged commit 9136326 into dev Jun 6, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants