From a2ac1f3cffeb182d76eab260e7051775b36b7483 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 17 Sep 2026 22:29:26 +0000 Subject: [PATCH 1/2] Initial plan From 15103060c93417bae9c607c4353b05f8f4ed48c2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 17 Sep 2026 22:46:30 +0000 Subject: [PATCH 2/2] chore(http-client-csharp): bump TCGC to 0.72.1 Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> --- .../emitter/test/Unit/decorator-list.test.ts | 56 ++++++++++++++++++- packages/http-client-csharp/package-lock.json | 10 ++-- packages/http-client-csharp/package.json | 4 +- 3 files changed, 62 insertions(+), 8 deletions(-) diff --git a/packages/http-client-csharp/emitter/test/Unit/decorator-list.test.ts b/packages/http-client-csharp/emitter/test/Unit/decorator-list.test.ts index 14ccf8d5286..05039192bd4 100644 --- a/packages/http-client-csharp/emitter/test/Unit/decorator-list.test.ts +++ b/packages/http-client-csharp/emitter/test/Unit/decorator-list.test.ts @@ -1,6 +1,10 @@ vi.resetModules(); -import type { TestHost } from "@typespec/compiler/testing"; +import { + expectDiagnosticEmpty, + expectDiagnostics, + type TestHost, +} from "@typespec/compiler/testing"; import { deepStrictEqual, strictEqual } from "assert"; import { ok } from "assert/strict"; import { beforeEach, describe, it, vi } from "vitest"; @@ -110,6 +114,56 @@ describe("Test emitting decorator list", () => { ]); }); + it("does not convert model arguments on generic decorators to SDK models", async () => { + const program = await typeSpecCompile(`op test(): void;`, runner); + const context = createEmitterContext(program); + const sdkContext = await createCSharpSdkContext(context, { + additionalDecorators: ["TypeSpec\\.Http\\.@useAuth"], + }); + + expectDiagnostics(sdkContext.diagnostics, [ + { + code: "@azure-tools/typespec-client-generator-core/unsupported-generic-decorator-arg-type", + }, + ]); + const [root] = createModel(sdkContext); + strictEqual(root.models.length, 0); + }); + + it("preserves model arguments on clientOption decorators", async () => { + const program = await typeSpecCompile( + ` + model Options { + enabled: boolean; + } + + #suppress "@azure-tools/typespec-client-generator-core/client-option" "Testing model-valued client options." + @clientOption("options", Options, "csharp") + interface BookClient { + op test(): void; + } + `, + runner, + { IsTCGCNeeded: true }, + ); + const context = createEmitterContext(program); + const sdkContext = await createCSharpSdkContext(context); + + expectDiagnosticEmpty(sdkContext.diagnostics); + const [root] = createModel(sdkContext); + const childClient = root.clients[0].children?.[0]; + ok(childClient); + const decorator = childClient.decorators?.find( + (decorator) => decorator.name === "Azure.ClientGenerator.Core.@clientOption", + ); + ok(decorator); + strictEqual(decorator.arguments.name, "options"); + const value = decorator.arguments.value; + ok(value && typeof value === "object" && "kind" in value && "name" in value); + strictEqual(value.kind, "model"); + strictEqual(value.name, "Options"); + }); + it("emit decorator list on a model property", async () => { const program = await typeSpecCompile( ` diff --git a/packages/http-client-csharp/package-lock.json b/packages/http-client-csharp/package-lock.json index 2ed7106a39b..72f3360df9b 100644 --- a/packages/http-client-csharp/package-lock.json +++ b/packages/http-client-csharp/package-lock.json @@ -14,7 +14,7 @@ "devDependencies": { "@azure-tools/azure-http-specs": "0.1.0-alpha.45", "@azure-tools/typespec-azure-core": "0.72.0", - "@azure-tools/typespec-client-generator-core": "0.72.0", + "@azure-tools/typespec-client-generator-core": "0.72.1", "@microsoft/api-extractor": "^7.52.2", "@types/node": "~22.12.0", "@typespec/compiler": "1.16.0", @@ -41,7 +41,7 @@ }, "peerDependencies": { "@azure-tools/typespec-azure-core": ">=0.72.0 <0.73.0 || ~0.73.0-0", - "@azure-tools/typespec-client-generator-core": ">=0.72.0 <0.73.0 || ~0.73.0-0", + "@azure-tools/typespec-client-generator-core": ">=0.72.1 <0.73.0 || ~0.73.0-0", "@typespec/compiler": "^1.16.0", "@typespec/events": ">=0.86.0 <0.87.0 || ~0.87.0-0", "@typespec/http": "^1.16.0", @@ -123,9 +123,9 @@ } }, "node_modules/@azure-tools/typespec-client-generator-core": { - "version": "0.72.0", - "resolved": "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/@azure-tools/typespec-client-generator-core/-/typespec-client-generator-core-0.72.0.tgz", - "integrity": "sha1-IR38UekOb2cJZ54THxVkV49/pCM=", + "version": "0.72.1", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-client-generator-core/-/typespec-client-generator-core-0.72.1.tgz", + "integrity": "sha512-4KVYEtiqKDZFrMvLvD25oLZ/DfNu988PqiTGO+JgFiWN7nwnLGxyDBEsb1t6bip+FYkGN3CYzqTdCk5Y7ID8jQ==", "dev": true, "license": "MIT", "dependencies": { diff --git a/packages/http-client-csharp/package.json b/packages/http-client-csharp/package.json index 9f6356ef0f6..2fadb14156a 100644 --- a/packages/http-client-csharp/package.json +++ b/packages/http-client-csharp/package.json @@ -59,7 +59,7 @@ ], "peerDependencies": { "@azure-tools/typespec-azure-core": ">=0.72.0 <0.73.0 || ~0.73.0-0", - "@azure-tools/typespec-client-generator-core": ">=0.72.0 <0.73.0 || ~0.73.0-0", + "@azure-tools/typespec-client-generator-core": ">=0.72.1 <0.73.0 || ~0.73.0-0", "@typespec/compiler": "^1.16.0", "@typespec/events": ">=0.86.0 <0.87.0 || ~0.87.0-0", "@typespec/http": "^1.16.0", @@ -72,7 +72,7 @@ "devDependencies": { "@azure-tools/azure-http-specs": "0.1.0-alpha.45", "@azure-tools/typespec-azure-core": "0.72.0", - "@azure-tools/typespec-client-generator-core": "0.72.0", + "@azure-tools/typespec-client-generator-core": "0.72.1", "@microsoft/api-extractor": "^7.52.2", "@types/node": "~22.12.0", "@typespec/compiler": "1.16.0",