Skip to content

Fix camelCase ending with S incorrectly treated as plural#553

Merged
necusjz merged 2 commits into
Azure:devfrom
huiii99:fix/command-group-name-dangling-separator
Jun 19, 2026
Merged

Fix camelCase ending with S incorrectly treated as plural#553
necusjz merged 2 commits into
Azure:devfrom
huiii99:fix/command-group-name-dangling-separator

Conversation

@huiii99

@huiii99 huiii99 commented Jun 19, 2026

Copy link
Copy Markdown
Member

Description

generate_command_group_name_by_resource singularizes each path segment via to_singular. When a segment ends in an acronym whose final character is a capital letter (e.g. activateSaaS), camel_case_to_snake_case tokenizes it as activate-saa-s. to_singular then strips the trailing s token, producing activate-saa- — a name with a dangling - separator that is unusable as a command group name.

This change detects the case where singularization leaves a trailing separator and falls back to the original (un-singularized) name, so the generated name stays valid (e.g. activateSaaS -> activate-saa-s ). Ordinary plural segments (e.g. virtualMachines -> virtual-machine) are unaffected.

Testing Guide

cd src/aaz_dev && python -m pytest swagger/tests/controller_tests/test_command_generator.py::CommandGroupNameUnitTestCase -v

@huiii99 huiii99 marked this pull request as ready for review June 19, 2026 01:47
@necusjz necusjz changed the title Fix: Avoid dangling separators in command group names when singularizing abbreviations at the end. Fix camelCase ending with S incorrectly treated as plural Jun 19, 2026
Comment on lines +215 to +216
head, _, last_token = name.rpartition('-')
singular_name = head + last_token

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it covers xxxxT, etc. as well (won't cause the issue). but suppose to be workable.

LGTM.

@necusjz necusjz merged commit 42f1230 into Azure:dev Jun 19, 2026
5 checks passed
@necusjz necusjz mentioned this pull request Jun 19, 2026
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