Fix Python wire encoding type regression - #11619
Fix Python wire encoding type regression#11619Libba Lawrence (l0lawrence) wants to merge 3 commits into
Conversation
Preserve supported client-facing types when TCGC supplies wire types for boolean, integer, and byte encodings. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f0bffcdc-e290-4621-980a-834a1e67bdc2
commit: |
|
All changed packages have been documented.
Show changes
|
|
You can try these changes here
|
There was a problem hiding this comment.
Pull request overview
Fixes a regression in the TypeSpec Python HTTP client emitter where the presence of wireType on encoded built-in scalars caused the emitter to treat otherwise-supported encodings as unsupported, incorrectly changing the client-facing type (notably for booleans, integers, and bytes).
Changes:
- Preserve the original Python client type for supported encodings (boolean/integer encoded as
"string", bytes encoded as"base64"/"base64url") even whenwireTypeis present. - Keep the existing fallback behavior: for unknown/custom encodings, expose the
wireType-based type while retaining theencodevalue. - Add focused unit tests covering the supported combinations and the custom-encoding fallback, plus a Chronus changelog entry.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/http-client-python/emitter/src/types.ts | Updates built-in type emission to preserve supported encoded client types while keeping wire-type fallback for unsupported/custom encodings. |
| packages/http-client-python/emitter/test/types.test.ts | Adds unit tests validating supported encoding preservation and the custom-encoding wire-type fallback path. |
| .chronus/changes/fix-python-wire-encoding-2026-08-11.md | Adds a changelog entry documenting the regression fix for Python wire encoding handling. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f0bffcdc-e290-4621-980a-834a1e67bdc2
|
Superseded by #11637, which is based on a branch in microsoft/typespec (not a fork) so the emitter-diff check runs. Closing this one. |
TCGC now supplies `wireType` for boolean, integer, and bytes encodings. The Python emitter treated every encoded type with a wire type as unsupported, replacing the client-facing type and regressing existing boolean, numeric, and byte serialization behavior. This change preserves the normal Python type for supported string, base64, and base64url encodings while retaining the wire-type fallback for custom or unsupported encodings. It also documents that fallback behavior and adds focused emitter coverage for the supported combinations and custom-encoding path. This PR supersedes microsoft#11619 (which was opened from a fork and therefore skipped the emitter-diff check). ## Validation - `npm run build` - `npm run format` - `npm run lint -- --emitter` - `npm run test:emitter` (13 tests) - `npm run regenerate` (Azure and unbranded) - Targeted boolean, numeric, and bytes mock tests (26 tests per flavor) --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: Yuchao Yan <yuchaoyan@microsoft.com> Copilot-Session: f0bffcdc-e290-4621-980a-834a1e67bdc2
TCGC now supplies
wireTypefor boolean, integer, and bytes encodings. The Python emitter treated every encoded type with a wire type as unsupported, replacing the client-facing type and regressing existing boolean, numeric, and byte serialization behavior.This change preserves the normal Python type for supported string, base64, and base64url encodings while retaining the wire-type fallback for custom or unsupported encodings. It also documents that fallback behavior and adds focused emitter coverage for the supported combinations and custom-encoding path.
Validation
npm run buildnpm run formatnpm run lint -- --emitternpm run test:emitter(13 tests)npm run regenerate(Azure and unbranded)