From e440c77c0a236f0e131e47d0f18c762b3f453959 Mon Sep 17 00:00:00 2001 From: Hardik Kaurani Date: Wed, 21 Oct 2026 15:46:25 +0530 Subject: [PATCH 1/3] fix(http-client-python): preserve bytes type for raw bytes encoding --- packages/http-client-python/emitter/src/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/http-client-python/emitter/src/types.ts b/packages/http-client-python/emitter/src/types.ts index d3f1d6778de..8a063d53c82 100644 --- a/packages/http-client-python/emitter/src/types.ts +++ b/packages/http-client-python/emitter/src/types.ts @@ -477,7 +477,7 @@ const sdkScalarKindToPythonKind: Record = { const supportedPythonEncodings = new Map>([ ["boolean", new Set(["string"])], ["integer", new Set(["string"])], - ["bytes", new Set(["base64", "base64url"])], + ["bytes", new Set(["base64", "base64url", "bytes"])], ]); function emitBuiltInType( From 451b5bdb18abd559e00875a79b414412d48e294c Mon Sep 17 00:00:00 2001 From: Hardik Kaurani Date: Wed, 21 Oct 2026 15:46:30 +0530 Subject: [PATCH 2/3] test(http-client-python): add unit test for raw bytes encoding preservation --- packages/http-client-python/emitter/test/types.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/http-client-python/emitter/test/types.test.ts b/packages/http-client-python/emitter/test/types.test.ts index 750c357a670..9407691b11a 100644 --- a/packages/http-client-python/emitter/test/types.test.ts +++ b/packages/http-client-python/emitter/test/types.test.ts @@ -50,7 +50,7 @@ describe("typespec-python: built-in types", () => { }, ); - it.each(["base64", "base64url"] as const)("preserves bytes encoded as %s", (encode) => { + it.each(["base64", "base64url", "bytes"] as const)("preserves bytes encoded as %s", (encode) => { deepStrictEqual( emitBuiltInType(createBuiltInType("bytes", encode, createBuiltInType("string"))), { From c848963572eb4a8b15a1130947904fc9822c1e79 Mon Sep 17 00:00:00 2001 From: Hardik Kaurani Date: Wed, 21 Oct 2026 15:46:36 +0530 Subject: [PATCH 3/3] chore(http-client-python): add change description for raw bytes encoding fix --- .../changes/fix-python-raw-bytes-encoding-2026-10-21.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .chronus/changes/fix-python-raw-bytes-encoding-2026-10-21.md diff --git a/.chronus/changes/fix-python-raw-bytes-encoding-2026-10-21.md b/.chronus/changes/fix-python-raw-bytes-encoding-2026-10-21.md new file mode 100644 index 00000000000..be1c852eb45 --- /dev/null +++ b/.chronus/changes/fix-python-raw-bytes-encoding-2026-10-21.md @@ -0,0 +1,7 @@ +--- +changeKind: fix +packages: + - "@typespec/http-client-python" +--- + +Preserve the ytes type for raw bytes encoded as ytes with a wire type, preventing regression to string and preserving binary streaming. \ No newline at end of file