Skip to content

Commit 356376b

Browse files
Copilotv-jiaodi
authored andcommitted
Update TypeSpec version to latest stable (Azure#3846)
* Initial plan * Bump TypeSpec dependencies to latest stable versions Co-authored-by: v-jiaodi <80496810+v-jiaodi@users.noreply.github.com> * regen and update case * Fix integration test specs to match updated TypeSpec-generated client API structure Co-authored-by: v-jiaodi <80496810+v-jiaodi@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: v-jiaodi <80496810+v-jiaodi@users.noreply.github.com> Co-authored-by: Jiao Di (MSFT) <v-jiaodi@microsoft.com>
1 parent 3fcc937 commit 356376b

15 files changed

Lines changed: 784 additions & 576 deletions

File tree

packages/typespec-test/package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
"type": "module",
55
"dependencies": {
66
"@azure-tools/typespec-ts": "workspace:^0.50.4",
7-
"@typespec/openapi": "^1.9.0",
8-
"@azure-tools/typespec-autorest": "^0.65.0",
9-
"@typespec/openapi3": "^1.9.0",
10-
"@azure-tools/typespec-azure-core": "^0.65.0",
11-
"@azure-tools/typespec-client-generator-core": "^0.65.4",
12-
"@azure-tools/typespec-azure-resource-manager": "^0.65.0",
13-
"@azure-tools/typespec-azure-rulesets": "^0.65.0",
14-
"@typespec/compiler": "^1.9.0",
15-
"@typespec/http": "^1.9.0",
16-
"@typespec/rest": "^0.79.0",
17-
"@typespec/versioning": "^0.79.0",
18-
"@typespec/json-schema": "^1.9.0",
7+
"@typespec/openapi": "^1.10.0",
8+
"@azure-tools/typespec-autorest": "^0.66.0",
9+
"@typespec/openapi3": "^1.10.0",
10+
"@azure-tools/typespec-azure-core": "^0.66.0",
11+
"@azure-tools/typespec-client-generator-core": "^0.66.2",
12+
"@azure-tools/typespec-azure-resource-manager": "^0.66.0",
13+
"@azure-tools/typespec-azure-rulesets": "^0.66.0",
14+
"@typespec/compiler": "^1.10.0",
15+
"@typespec/http": "^1.10.0",
16+
"@typespec/rest": "^0.80.0",
17+
"@typespec/versioning": "^0.80.0",
18+
"@typespec/json-schema": "^1.10.0",
1919
"prettier": "^3.1.0"
2020
},
2121
"devDependencies": {

packages/typespec-ts/package.json

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@
6565
"license": "MIT",
6666
"devDependencies": {
6767
"@azure-rest/core-client": "^2.3.1",
68-
"@typespec/http-specs": "0.1.0-alpha.33-dev.3",
69-
"@typespec/spector": "0.1.0-alpha.24-dev.2",
70-
"@typespec/spec-api": "0.1.0-dev.0",
71-
"@typespec/tspd": "0.74.0",
72-
"@azure-tools/azure-http-specs": "0.1.0-alpha.38-dev.6",
73-
"@azure-tools/typespec-autorest": "^0.65.0",
74-
"@azure-tools/typespec-azure-core": "^0.65.0",
75-
"@azure-tools/typespec-azure-resource-manager": "^0.65.0",
76-
"@azure-tools/typespec-client-generator-core": "^0.65.4",
68+
"@typespec/http-specs": "0.1.0-alpha.35-dev.1",
69+
"@typespec/spector": "0.1.0-dev.0",
70+
"@typespec/spec-api": "0.1.0-alpha.14-dev.1",
71+
"@typespec/tspd": "0.74.1",
72+
"@azure-tools/azure-http-specs": "0.1.0-alpha.39-dev.2",
73+
"@azure-tools/typespec-autorest": "^0.66.0",
74+
"@azure-tools/typespec-azure-core": "^0.66.0",
75+
"@azure-tools/typespec-azure-resource-manager": "^0.66.0",
76+
"@azure-tools/typespec-client-generator-core": "^0.66.2",
7777
"@azure/abort-controller": "^2.1.2",
7878
"@azure/core-auth": "^1.6.0",
7979
"@azure/core-lro": "^3.1.0",
@@ -87,12 +87,12 @@
8787
"@types/mocha": "^10.0.6",
8888
"@typescript-eslint/eslint-plugin": "^8.28.0",
8989
"@typescript-eslint/parser": "^8.28.0",
90-
"@typespec/compiler": "^1.9.0",
91-
"@typespec/http": "^1.9.0",
92-
"@typespec/openapi": "^1.9.0",
93-
"@typespec/rest": "^0.79.0",
90+
"@typespec/compiler": "^1.10.0",
91+
"@typespec/http": "^1.10.0",
92+
"@typespec/openapi": "^1.10.0",
93+
"@typespec/rest": "^0.80.0",
9494
"@typespec/ts-http-runtime": "^0.1.0",
95-
"@typespec/versioning": "^0.79.0",
95+
"@typespec/versioning": "^0.80.0",
9696
"chai": "^4.3.6",
9797
"chalk": "^4.0.0",
9898
"cross-env": "^7.0.3",
@@ -111,13 +111,13 @@
111111
"js-yaml": "^4.1.0"
112112
},
113113
"peerDependencies": {
114-
"@azure-tools/typespec-azure-core": "^0.65.0",
115-
"@azure-tools/typespec-client-generator-core": "^0.65.4",
116-
"@typespec/compiler": "^1.9.0",
117-
"@typespec/http": "^1.9.0",
118-
"@typespec/rest": "^0.79.0",
119-
"@typespec/versioning": "^0.79.0",
120-
"@typespec/xml": "^0.79.0"
114+
"@azure-tools/typespec-azure-core": "^0.66.0",
115+
"@azure-tools/typespec-client-generator-core": "^0.66.2",
116+
"@typespec/compiler": "^1.10.0",
117+
"@typespec/http": "^1.10.0",
118+
"@typespec/rest": "^0.80.0",
119+
"@typespec/versioning": "^0.80.0",
120+
"@typespec/xml": "^0.80.0"
121121
},
122122
"dependencies": {
123123
"@azure-tools/rlc-common": "workspace:^0.50.4",

packages/typespec-ts/test/azureIntegration/generated/special-words/src/index.d.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { Client } from '@azure-rest/core-client';
22
import type { ClientOptions } from '@azure-rest/core-client';
33
import type { HttpResponse } from '@azure-rest/core-client';
4+
import type { RawHttpHeaders } from '@azure/core-rest-pipeline';
45
import type { RequestParameters } from '@azure-rest/core-client';
56
import type { StreamableMethod } from '@azure-rest/core-client';
67

@@ -80,6 +81,34 @@ export declare interface Exec {
8081
name: string;
8182
}
8283

84+
export declare type ExtensibleString = string;
85+
86+
export declare type ExtensibleStringOutput = string;
87+
88+
export declare interface ExtensibleStringsPutExtensibleStringValue {
89+
put(options: ExtensibleStringsPutExtensibleStringValueParameters): StreamableMethod<ExtensibleStringsPutExtensibleStringValue200Response>;
90+
}
91+
92+
export declare interface ExtensibleStringsPutExtensibleStringValue200Headers {
93+
"content-type": "application/json";
94+
}
95+
96+
export declare interface ExtensibleStringsPutExtensibleStringValue200Response extends HttpResponse {
97+
status: "200";
98+
body: ExtensibleStringOutput;
99+
headers: RawHttpHeaders & ExtensibleStringsPutExtensibleStringValue200Headers;
100+
}
101+
102+
export declare interface ExtensibleStringsPutExtensibleStringValueBodyParam {
103+
body: ExtensibleString;
104+
}
105+
106+
export declare interface ExtensibleStringsPutExtensibleStringValueMediaTypesParam {
107+
contentType: "application/json";
108+
}
109+
110+
export declare type ExtensibleStringsPutExtensibleStringValueParameters = ExtensibleStringsPutExtensibleStringValueMediaTypesParam & ExtensibleStringsPutExtensibleStringValueBodyParam & RequestParameters;
111+
83112
export declare interface Finally {
84113
name: string;
85114
}
@@ -1623,6 +1652,7 @@ export declare interface Routes {
16231652
(path: "/special-words/model-properties/same-as-model"): ModelPropertiesSameAsModel;
16241653
(path: "/special-words/model-properties/dict-methods"): ModelPropertiesDictMethods;
16251654
(path: "/special-words/model-properties/list"): ModelPropertiesWithList;
1655+
(path: "/special-words/extensible-strings/string"): ExtensibleStringsPutExtensibleStringValue;
16261656
(path: "/special-words/operations/and"): OperationsAnd;
16271657
(path: "/special-words/operations/as"): OperationsAs;
16281658
(path: "/special-words/operations/assert"): OperationsAssert;

packages/typespec-ts/test/azureModularIntegration/clientNaming.spec.ts

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,75 +6,61 @@ describe("NameAndEncodedName Client", () => {
66
beforeEach(() => {
77
client = new NamingClient({
88
endpoint: "http://localhost:3002",
9-
allowInsecureConnection: true,
10-
retryOptions: {
11-
maxRetries: 0
12-
}
9+
allowInsecureConnection: true
1310
});
1411
});
1512

1613
it("should work with property client", async () => {
17-
const result = await client.client({ clientName: true });
18-
assert.isUndefined(result);
14+
await client.property.client({ clientName: true });
1915
});
2016

2117
it("should work with property language", async () => {
22-
const result = await client.language({ tsName: true });
23-
assert.isUndefined(result);
18+
await client.property.language({ tsName: true });
2419
});
2520

2621
it("should work with property compatibleWithEncodedName", async () => {
27-
const result = await client.compatibleWithEncodedName({
22+
await client.property.compatibleWithEncodedName({
2823
clientName: true
2924
});
30-
assert.isUndefined(result);
3125
});
3226

3327
it("should work with operation", async () => {
34-
const result = await client.clientName();
35-
assert.isUndefined(result);
28+
await client.clientName();
3629
});
3730

3831
it("should work with parameter", async () => {
39-
const result = await client.parameter("true");
40-
assert.isUndefined(result);
32+
await client.parameter("true");
4133
});
4234

4335
it("should work with header request", async () => {
44-
const result = await client.request("true");
45-
assert.isUndefined(result);
36+
await client.header.request("true");
4637
});
4738

4839
it("should work with header response", async () => {
49-
const result = await client.response({
40+
await client.header.response({
5041
onResponse: function (res) {
5142
assert.strictEqual(res.headers.get("default-name"), "true");
5243
}
5344
});
54-
assert.isUndefined(result);
5545
});
5646

5747
it("should work with model client", async () => {
58-
const result = await client.modelClient.client({ defaultName: true });
59-
assert.isUndefined(result);
48+
await client.modelClient.client({ defaultName: true });
6049
});
6150

6251
it("should work with model language", async () => {
63-
const result = await client.modelClient.language({ defaultName: true });
64-
assert.isUndefined(result);
52+
await client.modelClient.language({ defaultName: true });
6553
});
6654

6755
it("should work union enum name", async () => {
68-
const result = await client.unionEnum.unionEnumName("value1", {
56+
await client.unionEnum.unionEnumName("value1", {
6957
requestOptions: { headers: { "content-type": "text/plain" } }
7058
});
71-
assert.isUndefined(result);
7259
});
7360

7461
it("should work with union enum member name", async () => {
75-
const result = await client.unionEnum.unionEnumMemberName("value1", {
62+
await client.unionEnum.unionEnumMemberName("value1", {
7663
requestOptions: { headers: { "content-type": "text/plain" } }
7764
});
78-
assert.isUndefined(result);
7965
});
8066
});

packages/typespec-ts/test/azureModularIntegration/clientStructureOperationGroup.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ describe("Client Structure Operation Group Rest Client", () => {
3030
});
3131

3232
it("should call operation two correctly", async () => {
33-
const result = await client1.group3.two();
33+
const result = await client1.two();
3434
assert.strictEqual(result, undefined);
3535
});
3636

3737
it("should call operation three correctly", async () => {
38-
const result = await client1.group3.three();
38+
const result = await client1.three();
3939
assert.strictEqual(result, undefined);
4040
});
4141

4242
it("should call operation four correctly", async () => {
43-
const result = await client1.group4.four();
43+
const result = await client1.four();
4444
assert.strictEqual(result, undefined);
4545
});
4646

@@ -50,7 +50,7 @@ describe("Client Structure Operation Group Rest Client", () => {
5050
});
5151

5252
it("should call operation six correctly", async () => {
53-
const result = await client2.group5.six();
53+
const result = await client2.six();
5454
assert.strictEqual(result, undefined);
5555
});
5656
});

packages/typespec-ts/test/azureModularIntegration/clientStructureRenamed.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe("Client Structure Renamed-Operation Rest Client", () => {
1919
});
2020

2121
it("should call operation two correctly", async () => {
22-
const result = await client.group.renamedTwo();
22+
const result = await client.renamedTwo();
2323
assert.strictEqual(result, undefined);
2424
});
2525

@@ -29,7 +29,7 @@ describe("Client Structure Renamed-Operation Rest Client", () => {
2929
});
3030

3131
it("should call operation four correctly", async () => {
32-
const result = await client.group.renamedFour();
32+
const result = await client.renamedFour();
3333
assert.strictEqual(result, undefined);
3434
});
3535

@@ -39,7 +39,7 @@ describe("Client Structure Renamed-Operation Rest Client", () => {
3939
});
4040

4141
it("should call operation six correctly", async () => {
42-
const result = await client.group.renamedSix();
42+
const result = await client.renamedSix();
4343
assert.strictEqual(result, undefined);
4444
});
4545
});

packages/typespec-ts/test/azureModularIntegration/clientStructureTwoGroup.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,32 @@ describe("Client Structure Two-Operation-Group Rest Client", () => {
1414
});
1515

1616
it("should call operation one correctly", async () => {
17-
const result = await client.group1.one();
17+
const result = await client.one();
1818
assert.strictEqual(result, undefined);
1919
});
2020

2121
it("should call operation two correctly", async () => {
22-
const result = await client.group2.two();
22+
const result = await client.two();
2323
assert.strictEqual(result, undefined);
2424
});
2525

2626
it("should call operation three correctly", async () => {
27-
const result = await client.group1.three();
27+
const result = await client.three();
2828
assert.strictEqual(result, undefined);
2929
});
3030

3131
it("should call operation four correctly", async () => {
32-
const result = await client.group1.four();
32+
const result = await client.four();
3333
assert.strictEqual(result, undefined);
3434
});
3535

3636
it("should call operation five correctly", async () => {
37-
const result = await client.group2.five();
37+
const result = await client.five();
3838
assert.strictEqual(result, undefined);
3939
});
4040

4141
it("should call operation six correctly", async () => {
42-
const result = await client.group2.six();
42+
const result = await client.six();
4343
assert.strictEqual(result, undefined);
4444
});
4545
});

packages/typespec-ts/test/azureModularIntegration/generated/client/naming/src/index.d.ts

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,23 @@ export declare interface ClientNameModel {
1919
export declare interface ClientNameOptionalParams extends OperationOptions {
2020
}
2121

22-
export declare interface ClientOptionalParams extends OperationOptions {
22+
export declare type ExtensibleEnum = "value1" | "value2";
23+
24+
export declare interface HeaderOperations {
25+
response: (options?: HeaderResponseOptionalParams) => Promise<void>;
26+
request: (clientName: string, options?: HeaderRequestOptionalParams) => Promise<void>;
2327
}
2428

25-
export declare interface CompatibleWithEncodedNameOptionalParams extends OperationOptions {
29+
export declare interface HeaderRequestOptionalParams extends OperationOptions {
2630
}
2731

28-
export declare type ExtensibleEnum = "value1" | "value2";
32+
export declare interface HeaderResponseOptionalParams extends OperationOptions {
33+
}
2934

3035
export declare interface LanguageClientNameModel {
3136
tsName: boolean;
3237
}
3338

34-
export declare interface LanguageOptionalParams extends OperationOptions {
35-
}
36-
3739
export declare interface ModelClientClientOptionalParams extends OperationOptions {
3840
}
3941

@@ -49,15 +51,12 @@ export declare class NamingClient {
4951
private _client;
5052
readonly pipeline: Pipeline;
5153
constructor(options?: NamingClientOptionalParams);
52-
response(options?: ResponseOptionalParams): Promise<void>;
53-
request(clientName: string, options?: RequestOptionalParams): Promise<void>;
54-
compatibleWithEncodedName(body: ClientNameAndJsonEncodedNameModel, options?: CompatibleWithEncodedNameOptionalParams): Promise<void>;
55-
language(body: LanguageClientNameModel, options?: LanguageOptionalParams): Promise<void>;
56-
client(body: ClientNameModel, options?: ClientOptionalParams): Promise<void>;
5754
parameter(clientName: string, options?: ParameterOptionalParams): Promise<void>;
5855
clientName(options?: ClientNameOptionalParams): Promise<void>;
5956
readonly unionEnum: UnionEnumOperations;
6057
readonly modelClient: ModelClientOperations;
58+
readonly header: HeaderOperations;
59+
readonly property: PropertyOperations;
6160
}
6261

6362
export declare interface NamingClientOptionalParams extends ClientOptions {
@@ -66,10 +65,19 @@ export declare interface NamingClientOptionalParams extends ClientOptions {
6665
export declare interface ParameterOptionalParams extends OperationOptions {
6766
}
6867

69-
export declare interface RequestOptionalParams extends OperationOptions {
68+
export declare interface PropertyClientOptionalParams extends OperationOptions {
69+
}
70+
71+
export declare interface PropertyCompatibleWithEncodedNameOptionalParams extends OperationOptions {
72+
}
73+
74+
export declare interface PropertyLanguageOptionalParams extends OperationOptions {
7075
}
7176

72-
export declare interface ResponseOptionalParams extends OperationOptions {
77+
export declare interface PropertyOperations {
78+
compatibleWithEncodedName: (body: ClientNameAndJsonEncodedNameModel, options?: PropertyCompatibleWithEncodedNameOptionalParams) => Promise<void>;
79+
language: (body: LanguageClientNameModel, options?: PropertyLanguageOptionalParams) => Promise<void>;
80+
client: (body: ClientNameModel, options?: PropertyClientOptionalParams) => Promise<void>;
7381
}
7482

7583
export declare interface TSModel {

0 commit comments

Comments
 (0)