Skip to content

Commit 471ca7e

Browse files
Copilotjorgerangel-msftJoshLove-msft
authored
Bump TCGC to 0.67.1 for http-client-csharp (#10309)
Bump `@azure-tools/typespec-client-generator-core` from 0.66.3 to 0.67.1 and all related dependencies for the http-client-csharp emitter. ### Dependency bumps - **TCGC**: 0.66.3 → 0.67.1, **Azure Core**: 0.66.0 → 0.67.0 - **@typespec/compiler, http, openapi**: 1.10.0 → 1.11.0 - **@typespec/rest, sse, streams, versioning, xml, json-schema, library-linter**: 0.80.0 → 0.81.0 - **http-specs, azure-http-specs, spector**: bumped to latest compatible alphas - Peer dependency ranges updated accordingly ### Breaking change fixes - **`utils.ts`** — `__raw.service` renamed to `__raw.services` (now always `Namespace[]`): ```ts // before return Array.isArray(client.__raw.service) && client.__raw.service.length > 1; // after return client.__raw.services.length > 1; ``` - **`type-converter.ts`** — Guard `sdkType.__raw` before calling `getAccessOverride()`. Synthetic enums (content-type/accept params) created by TCGC 0.67.0 have `__raw === undefined`. ### Test updates - Multi-service tests now use `autoMergeService: true` on `@client` (required in 0.67.0 for sub-client merging across services) - Removed `@useDependency` from multi-service tests (no longer used for API version declaration per <a href="https://github.com/Azure/typespec-azure/blob/main/packages/typespec-client-generator-core/CHANGELOG.md#breaking-changes">migration guide</a>) ### Regenerated test libraries Regenerated all Spector specs, Sample-TypeSpec (Local), and launch settings via `Generate.ps1`. No changes to `Generate.ps1` or `SampleService/package.json`. Expected code model diffs: doc string updates removing `@operationGroup` references, fully-qualified `crossLanguageDefinitionId` paths, synthetic enums for content-type/accept parameters, improved constant naming. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> Co-authored-by: Jorge Rangel <jorgerangel@microsoft.com> Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
1 parent 76466bf commit 471ca7e

16 files changed

Lines changed: 782 additions & 692 deletions

File tree

packages/http-client-csharp/emitter/src/lib/type-converter.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,9 @@ function createEnumType(
329329
values: values,
330330
// constantType.access, TODO - constant type now does not have access. TCGC will add it later
331331
access:
332-
sdkType.kind === "enum" ? getAccessOverride(sdkContext, sdkType.__raw as any) : undefined,
332+
sdkType.kind === "enum" && sdkType.__raw
333+
? getAccessOverride(sdkContext, sdkType.__raw as any)
334+
: undefined,
333335
namespace: namespace,
334336
deprecation: sdkType.deprecation,
335337
summary: sdkType.summary,

packages/http-client-csharp/emitter/src/lib/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,5 +234,5 @@ export function containsMultiServiceClient(
234234
* @beta
235235
*/
236236
export function isMultiServiceClient(client: SdkClientType<SdkHttpOperation>): boolean {
237-
return Array.isArray(client.__raw.service) && client.__raw.service.length > 1;
237+
return client.__raw.services.length > 1;
238238
}

packages/http-client-csharp/emitter/test/Unit/client-converter.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ describe("isMultiServiceClient", () => {
7272
@client({
7373
name: "CombinedClient",
7474
service: [ServiceA, ServiceB],
75+
autoMergeService: true,
7576
})
76-
@useDependency(ServiceA.VersionsA.av1, ServiceB.VersionsB.bv2)
7777
namespace Service.MultiService {}
7878
`,
7979
runner,
@@ -210,6 +210,7 @@ describe("isMultiServiceClient", () => {
210210
@client({
211211
name: "CombinedClient",
212212
service: [ServiceA, ServiceB],
213+
autoMergeService: true,
213214
})
214215
215216
namespace Service.MultiService {}
@@ -426,8 +427,8 @@ describe("client name suffix", () => {
426427
@client({
427428
name: "Combined",
428429
service: [ServiceA, ServiceB],
430+
autoMergeService: true,
429431
})
430-
@useDependency(ServiceA.VersionsA.av1, ServiceB.VersionsB.bv1)
431432
namespace Service.MultiService {}
432433
`,
433434
runner,

packages/http-client-csharp/emitter/test/Unit/client-model-builder.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,8 @@ describe("parseApiVersions", () => {
290290
@client({
291291
name: "CombinedClient",
292292
service: [ServiceA, ServiceB],
293+
autoMergeService: true,
293294
})
294-
@useDependency(ServiceA.VersionsA.av1, ServiceB.VersionsB.bv2)
295295
namespace Service.MultiService {}
296296
`,
297297
runner,
@@ -406,6 +406,7 @@ describe("parseApiVersions", () => {
406406
@client({
407407
name: "CombinedClient",
408408
service: [ServiceA, ServiceB],
409+
autoMergeService: true,
409410
})
410411
411412
namespace Service.MultiService {}

packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.RestClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,14 @@ internal PipelineMessage CreateReturnsAnonymousModelRequest(RequestOptions optio
219219
return message;
220220
}
221221

222-
internal PipelineMessage CreateGetUnknownValueRequest(string accept, RequestOptions options)
222+
internal PipelineMessage CreateGetUnknownValueRequest(RequestOptions options)
223223
{
224224
ClientUriBuilder uri = new ClientUriBuilder();
225225
uri.Reset(_endpoint);
226226
uri.AppendPath("/unknown-value", false);
227227
PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "GET", PipelineMessageClassifier200);
228228
PipelineRequest request = message.Request;
229-
request.Headers.Set("Accept", accept);
229+
request.Headers.Set("Accept", "text/plain");
230230
message.Apply(options);
231231
return message;
232232
}

packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,17 +1053,12 @@ public virtual async Task<ClientResult<ReturnsAnonymousModelResponse>> ReturnsAn
10531053
/// </item>
10541054
/// </list>
10551055
/// </summary>
1056-
/// <param name="accept"></param>
10571056
/// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
1058-
/// <exception cref="ArgumentNullException"> <paramref name="accept"/> is null. </exception>
1059-
/// <exception cref="ArgumentException"> <paramref name="accept"/> is an empty string, and was expected to be non-empty. </exception>
10601057
/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
10611058
/// <returns> The response returned from the service. </returns>
1062-
public virtual ClientResult GetUnknownValue(string accept, RequestOptions options)
1059+
public virtual ClientResult GetUnknownValue(RequestOptions options)
10631060
{
1064-
Argument.AssertNotNullOrEmpty(accept, nameof(accept));
1065-
1066-
using PipelineMessage message = CreateGetUnknownValueRequest(accept, options);
1061+
using PipelineMessage message = CreateGetUnknownValueRequest(options);
10671062
return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
10681063
}
10691064

@@ -1075,45 +1070,30 @@ public virtual ClientResult GetUnknownValue(string accept, RequestOptions option
10751070
/// </item>
10761071
/// </list>
10771072
/// </summary>
1078-
/// <param name="accept"></param>
10791073
/// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
1080-
/// <exception cref="ArgumentNullException"> <paramref name="accept"/> is null. </exception>
1081-
/// <exception cref="ArgumentException"> <paramref name="accept"/> is an empty string, and was expected to be non-empty. </exception>
10821074
/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
10831075
/// <returns> The response returned from the service. </returns>
1084-
public virtual async Task<ClientResult> GetUnknownValueAsync(string accept, RequestOptions options)
1076+
public virtual async Task<ClientResult> GetUnknownValueAsync(RequestOptions options)
10851077
{
1086-
Argument.AssertNotNullOrEmpty(accept, nameof(accept));
1087-
1088-
using PipelineMessage message = CreateGetUnknownValueRequest(accept, options);
1078+
using PipelineMessage message = CreateGetUnknownValueRequest(options);
10891079
return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
10901080
}
10911081

10921082
/// <summary> get extensible enum. </summary>
1093-
/// <param name="accept"></param>
10941083
/// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
1095-
/// <exception cref="ArgumentNullException"> <paramref name="accept"/> is null. </exception>
1096-
/// <exception cref="ArgumentException"> <paramref name="accept"/> is an empty string, and was expected to be non-empty. </exception>
10971084
/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
1098-
public virtual ClientResult<string> GetUnknownValue(string accept, CancellationToken cancellationToken = default)
1085+
public virtual ClientResult<string> GetUnknownValue(CancellationToken cancellationToken = default)
10991086
{
1100-
Argument.AssertNotNullOrEmpty(accept, nameof(accept));
1101-
1102-
ClientResult result = GetUnknownValue(accept, cancellationToken.ToRequestOptions());
1087+
ClientResult result = GetUnknownValue(cancellationToken.ToRequestOptions());
11031088
return ClientResult.FromValue(result.GetRawResponse().Content.ToString(), result.GetRawResponse());
11041089
}
11051090

11061091
/// <summary> get extensible enum. </summary>
1107-
/// <param name="accept"></param>
11081092
/// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
1109-
/// <exception cref="ArgumentNullException"> <paramref name="accept"/> is null. </exception>
1110-
/// <exception cref="ArgumentException"> <paramref name="accept"/> is an empty string, and was expected to be non-empty. </exception>
11111093
/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
1112-
public virtual async Task<ClientResult<string>> GetUnknownValueAsync(string accept, CancellationToken cancellationToken = default)
1094+
public virtual async Task<ClientResult<string>> GetUnknownValueAsync(CancellationToken cancellationToken = default)
11131095
{
1114-
Argument.AssertNotNullOrEmpty(accept, nameof(accept));
1115-
1116-
ClientResult result = await GetUnknownValueAsync(accept, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
1096+
ClientResult result = await GetUnknownValueAsync(cancellationToken.ToRequestOptions()).ConfigureAwait(false);
11171097
return ClientResult.FromValue(result.GetRawResponse().Content.ToString(), result.GetRawResponse());
11181098
}
11191099

0 commit comments

Comments
 (0)