Skip to content

[python] fix casing enum - #10329

Merged
iscai-msft merged 5 commits into
microsoft:mainfrom
iscai-msft:python/fixCasingEnum
Oct 29, 2026
Merged

iscai-msft merged 5 commits into
microsoft:mainfrom
iscai-msft:python/fixCasingEnum

Conversation

@iscai-msft

Copy link
Copy Markdown
Member

fixes #10312

@pkg-pr-new

pkg-pr-new Bot commented Apr 9, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-client-python@10329

commit: 444e93d

@github-actions

github-actions Bot commented Apr 9, 2026 •

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • ✅ @typespec/http-client-python
Show changes

@typespec/http-client-python - fix ✏️

Preserve underscores before numeric enum segments and acronyms such as A2A without changing numeric identifiers such as int32.

@azure-sdk

Azure SDK Bot (azure-sdk) commented Apr 9, 2026 •

Copy link
Copy Markdown
Collaborator

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@iscai-msft

Copy link
Copy Markdown
Member Author

Yuchao Yan (@msyyc) I definitely will investigate this more. I think overall I like the new casing for enums better, but I'm going to go through the rest api specs repo to see how many specs would be affected. Also regardless, I think we need some kind of decorator in tcgc that is like "this is the exact client name, don't change casing or anything", what are your thgouths Chenjie Shi (@tadelesh). Something like @clientNameOverride

@tadelesh

Chenjie Shi (tadelesh) commented Apr 10, 2026 •

Copy link
Copy Markdown
Member

Yuchao Yan (@msyyc) I definitely will investigate this more. I think overall I like the new casing for enums better, but I'm going to go through the rest api specs repo to see how many specs would be affected. Also regardless, I think we need some kind of decorator in tcgc that is like "this is the exact client name, don't change casing or anything", what are your thgouths Chenjie Shi (@tadelesh). Something like @clientNameOverride

We had a issue to track this: Azure/typespec-azure#3607. Let's prioritize it. I don't think we need a new decorator. We could just add a flag to tell if the name has been customized.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the stale Mark a PR that hasn't been recently updated and will be closed. label May 11, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Hi @iscai-msft. Your PR has had no update for 30 days and it is marked as a stale PR. If it is not updated within 30 days, the PR will automatically be closed. If you want to refresh the PR, please remove the stale label.

@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Hi @iscai-msft. The PR will be closed since the PR has no update for 28 days. If this is still relevant please reopen.

Preserve enum casing changes and current utility regression tests.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: a56d520e-33f1-474a-aa6c-7f8d999656d8
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Python emitter diff

Baseline gh:cefb035e7721a6fdcb6de605b5f469b93055a880 vs this PR.

No changes to generated output.

Rendered diff: inline on the run summary, or the emitter-diff-html artifact.

Informational check (eng/emitter-diff); does not block the PR.

@dargilco

Copy link
Copy Markdown
Member

FYI Howie Leung (@howieleung)

Keep digits attached to preceding words and restore word boundaries after digits while preserving date separators and short alphanumeric acronyms.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: a56d520e-33f1-474a-aa6c-7f8d999656d8
Copilot AI balanced review requested due to automatic review settings October 27, 2026 17:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The shared conversion still introduces unintended underscores in plural-acronym numeric names, changing existing generated Python properties.

1 open issue
What changed in this PR

This PR addresses #10312 by updating Python emitter name conversion to preserve underscores before date segments and keep acronyms such as A2A intact.

Changes:

  • Adjusts numeric boundary handling in the shared naming utility.
  • Adds utility and emitter tests for enum members and numeric property names.
  • Adds a Python emitter changelog entry.
File Description
packages/​http-client-python/​emitter/​test/​utils.test.ts Adds numeric boundary and acronym conversion cases.
packages/​http-client-python/​emitter/​test/​emitter.test.ts Checks emitted enum and property names.
packages/​http-client-python/​emitter/​src/​utils.ts Revises digit splitting and preserves numeric separators.
.chronus/​changes/​python-fixCasingEnum-2026-3-9-16-6-39.md Documents the naming fix.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 28, 2026 18:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The Python enum naming change has no active review issues.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@msyyc

Copy link
Copy Markdown
Contributor

Yuchao Yan (Yuchao Yan (@msyyc)) I definitely will investigate this more. I think overall I like the new casing for enums better, but I'm going to go through the rest api specs repo to see how many specs would be affected. Also regardless, I think we need some kind of decorator in tcgc that is like "this is the exact client name, don't change casing or anything", what are your thgouths Chenjie Shi (Chenjie Shi (@tadelesh)). Something like @clientNameOverride

I expect this PR may introduce some breaking changes to enum names, but I believe the improvement is worthwhile because the new enum member name is clearer. To mitigate the impact on legacy enum cases, I will use clientName and exact.

@iscai-msft
iscai-msft added this pull request to the merge queue Oct 28, 2026
Merged via the queue into microsoft:main with commit 231125b Oct 29, 2026
37 checks passed
@iscai-msft
iscai-msft deleted the python/fixCasingEnum branch October 29, 2026 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:python Issue for the Python client emitter: @typespec/http-client-python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[python] Enum member names drop underscores before date segments

6 participants