Skip to content

[http-client-python] Fix enum member names with hyphens generating invalid Python identifiers#10399

Open
Copilot wants to merge 4 commits intomainfrom
copilot/fix-enum-name-compile-error
Open

[http-client-python] Fix enum member names with hyphens generating invalid Python identifiers#10399
Copilot wants to merge 4 commits intomainfrom
copilot/fix-enum-name-compile-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 16, 2026

  • Understand the issue: Python emitter generates enum member names with hyphens (e.g., EAP-TLS) which are invalid Python identifiers
  • Identify the root cause: enumName() function in emitter/src/types.ts returns name as-is when already uppercase, skipping hyphen-to-underscore conversion
  • Fix the enumName() function to always use camelToSnakeCase which handles non-word characters via split
  • Add test coverage for hyphenated enum names in camelToSnakeCase tests
  • Run tests to verify - all pass
  • Add changelog entry
  • Fix cspell issue: replace domain-specific test names (EAP-TLS, TTLS, PEAP) with common words (FOO-BAR, etc.)

Copilot AI and others added 2 commits April 16, 2026 05:51
Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/7af9fbbf-509c-43ad-b46f-8453e38951c0

Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service bot added the emitter:client:python Issue for the Python client emitter: @typespec/http-client-python label Apr 16, 2026
Copilot AI changed the title [WIP] Fix enum name to avoid compile error in python emitter [http-client-python] Fix enum member names with hyphens generating invalid Python identifiers Apr 16, 2026
Copilot AI requested a review from tadelesh April 16, 2026 05:55
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 16, 2026

Open in StackBlitz

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

commit: b87392d

@tadelesh
Copy link
Copy Markdown
Member

@copilot Change the enum name in tests to prevent cspell issue.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 16, 2026

@copilot Change the enum name in tests to prevent cspell issue.

Replaced EAP-TLS, EAP-TTLS, EAP-FAST, and PEAP with FOO-BAR, FOO-BAR-BAZ, and A-B in the test cases to avoid cspell issues. See b87392d.

@azure-sdk
Copy link
Copy Markdown
Collaborator

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

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.

[http-client-python] Enum name cause compile error

3 participants