Skip to content

Commit 99eccef

Browse files
Update to cover more cases
1 parent 904fae6 commit 99eccef

37 files changed

Lines changed: 1651 additions & 86 deletions

File tree

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,8 @@ vitest.config.ts.timestamp*
3131
**/test/**/metadata.json
3232
.turbo/
3333
packages/typespec-ts/submodules
34-
.gitmodules
34+
.gitmodules
35+
36+
**/test/**/overrideGroup_modular
37+
**/test/**/override_modular
38+
**/test/**/mytest2

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
{
113113
"name": "[TypeSpec] Smoke Test Debug",
114114
"request": "launch",
115-
"cwd": "${workspaceFolder}/packages/typespec-test/test/customWrapper",
115+
"cwd": "${workspaceFolder}/packages/typespec-test/test/overrideGroup_modular",
116116

117117
"runtimeArgs": ["tsp", "compile", "./spec"],
118118
"runtimeExecutable": "npx",

debug-tcgc-override.ts

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/**
2+
* Debug script: Dump the TCGC representation for the override group scenario.
3+
* Run from packages/typespec-ts/ with:
4+
* npx tsx ../../debug-tcgc-override.ts
5+
*/
6+
import { compile } from "@typespec/compiler";
7+
import { createSdkContext, getAllModels } from "@azure-tools/typespec-client-generator-core";
8+
import { resolve } from "path";
9+
10+
async function main() {
11+
const testDir = resolve("../../packages/typespec-test/test/overrideGroup_modular");
12+
const mainTsp = resolve(testDir, "spec/client.tsp");
13+
14+
const program = await compile(
15+
{
16+
stat: async (path) => ({ isDirectory: () => false, isFile: () => true }),
17+
} as any,
18+
mainTsp,
19+
{
20+
noEmit: true,
21+
}
22+
);
23+
24+
if (program.diagnostics.length > 0) {
25+
console.log("Diagnostics:", program.diagnostics.map(d => d.message));
26+
}
27+
28+
const context = createSdkContext(program, "@azure-tools/typespec-ts");
29+
30+
// Get all clients
31+
const clients = context.sdkPackage.clients;
32+
console.log("\n=== CLIENTS ===");
33+
for (const client of clients) {
34+
console.log(`Client: ${client.name}`);
35+
for (const method of client.methods) {
36+
if (method.kind === "basic") {
37+
console.log(`\n Method: ${method.name}`);
38+
console.log(` Parameters:`);
39+
for (const param of method.parameters) {
40+
console.log(` - name: ${param.name}, kind: ${param.kind}, optional: ${param.optional}`);
41+
console.log(` type: ${param.type.kind}${param.type.kind === "model" ? ` (${param.type.name})` : ""}`);
42+
if (param.type.kind === "model") {
43+
console.log(` model properties:`);
44+
for (const prop of param.type.properties) {
45+
console.log(` - ${prop.name}: kind=${prop.kind}, optional=${prop.optional}, type=${prop.type.kind}`);
46+
if (prop.__raw) {
47+
console.log(` __raw.name=${prop.__raw.name}`);
48+
}
49+
}
50+
}
51+
}
52+
53+
if (method.operation) {
54+
console.log(` HTTP Operation parameters:`);
55+
for (const httpParam of method.operation.parameters) {
56+
console.log(` - name: ${httpParam.name}, kind: ${httpParam.kind}, optional: ${httpParam.optional}`);
57+
console.log(` methodParameterSegments: ${JSON.stringify(
58+
httpParam.methodParameterSegments.map(seg =>
59+
seg.map(s => `${s.kind}:${s.name}`)
60+
)
61+
)}`);
62+
}
63+
}
64+
}
65+
}
66+
}
67+
68+
// Get all models
69+
console.log("\n=== MODELS ===");
70+
const models = getAllModels(context);
71+
for (const model of models) {
72+
if (model.kind === "model") {
73+
console.log(`\nModel: ${model.name}`);
74+
console.log(` Properties:`);
75+
for (const prop of model.properties) {
76+
console.log(` - ${prop.name}: kind=${prop.kind}, optional=${prop.optional}, type=${prop.type.kind}`);
77+
}
78+
}
79+
}
80+
}
81+
82+
main().catch(console.error);

packages/typespec-test/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
"smoke-test": "node --max-old-space-size=4096 ./eng/smoke-test.js",
2727
"smoke-test:contoso": "node --max-old-space-size=4096 ./eng/smoke-test.js -- contoso",
2828
"smoke-test:todo": "node --max-old-space-size=4096 ./eng/smoke-test.js -- todo_non_branded",
29+
"smoke-test:myclientini": "node --max-old-space-size=4096 ./eng/smoke-test.js -- myclientini",
30+
"smoke-test:network": "node --max-old-space-size=4096 ./eng/smoke-test.js -- NetworkAnalytics.Management",
31+
"smoke-test:overridegroup": "node --max-old-space-size=4096 ./eng/smoke-test.js -- overrideGroup_modular",
2932
"smoke-test:workers": "node ./eng/smoke-test-main.js",
3033
"build": "echo skip",
3134
"format": "echo skipped",

packages/typespec-test/test/ai/generated/typespec-ts/src/models/models.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,6 @@ export interface _PagedEvaluation {
477477
value: Evaluation[];
478478
/** The link to the next page of items */
479479
nextLink?: string;
480-
/** An opaque, globally-unique, client-generated string identifier for the request. */
481-
clientRequestId?: string;
482480
}
483481

484482
export function _pagedEvaluationDeserializer(item: any): _PagedEvaluation {
@@ -725,8 +723,6 @@ export interface _PagedEvaluationSchedule {
725723
value: EvaluationSchedule[];
726724
/** The link to the next page of items */
727725
nextLink?: string;
728-
/** An opaque, globally-unique, client-generated string identifier for the request. */
729-
clientRequestId?: string;
730726
}
731727

732728
export function _pagedEvaluationScheduleDeserializer(item: any): _PagedEvaluationSchedule {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Copyright (c) Microsoft Corporation.
2+
3+
MIT License
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# BillingBenefits client library for JavaScript
2+
3+
This package contains an isomorphic SDK (runs both in Node.js and in browsers) for BillingBenefits client.
4+
5+
My Test Service
6+
7+
Key links:
8+
9+
- [Package (NPM)](https://www.npmjs.com/package/@msinternal/myclientini)
10+
11+
## Getting started
12+
13+
### Currently supported environments
14+
15+
- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule)
16+
- Latest versions of Safari, Chrome, Edge and Firefox.
17+
18+
See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
19+
20+
21+
### Install the `@msinternal/myclientini` package
22+
23+
Install the BillingBenefits client library for JavaScript with `npm`:
24+
25+
```bash
26+
npm install @msinternal/myclientini
27+
```
28+
29+
30+
31+
### JavaScript Bundle
32+
To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling).
33+
34+
## Key concepts
35+
36+
### BillingBenefitsClient
37+
38+
`BillingBenefitsClient` is the primary interface for developers using the BillingBenefits client library. Explore the methods on this client object to understand the different features of the BillingBenefits service that you can access.
39+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3+
"mainEntryPointFilePath": "dist/esm/index.d.ts",
4+
"docModel": { "enabled": true },
5+
"apiReport": { "enabled": true, "reportFolder": "./review" },
6+
"dtsRollup": {
7+
"enabled": true,
8+
"untrimmedFilePath": "",
9+
"publicTrimmedFilePath": "dist/myclientini.d.ts"
10+
},
11+
"messages": {
12+
"tsdocMessageReporting": { "default": { "logLevel": "none" } },
13+
"extractorMessageReporting": {
14+
"ae-missing-release-tag": { "logLevel": "none" },
15+
"ae-unresolved-link": { "logLevel": "none" }
16+
}
17+
}
18+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import azsdkEslint from "@azure/eslint-plugin-azure-sdk";
2+
3+
export default azsdkEslint.config([
4+
{
5+
rules: {
6+
"@azure/azure-sdk/ts-modules-only-named": "warn",
7+
"@azure/azure-sdk/ts-package-json-types": "warn",
8+
"@azure/azure-sdk/ts-package-json-engine-is-present": "warn",
9+
"@azure/azure-sdk/ts-package-json-files-required": "off",
10+
"@azure/azure-sdk/ts-package-json-main-is-cjs": "off",
11+
"tsdoc/syntax": "warn"
12+
}
13+
}
14+
]);
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
{
2+
"name": "@msinternal/myclientini",
3+
"version": "1.0.0-beta.1",
4+
"description": "My Test Service",
5+
"engines": {
6+
"node": ">=20.0.0"
7+
},
8+
"sideEffects": false,
9+
"autoPublish": false,
10+
"tshy": {
11+
"exports": {
12+
"./package.json": "./package.json",
13+
".": "./src/index.ts",
14+
"./api": "./src/api/index.ts",
15+
"./api/savingsPlanModels": "./src/api/savingsPlanModels/index.ts",
16+
"./models": "./src/models/index.ts"
17+
},
18+
"dialects": [
19+
"esm",
20+
"commonjs"
21+
],
22+
"esmDialects": [
23+
"browser",
24+
"react-native"
25+
],
26+
"selfLink": false
27+
},
28+
"type": "module",
29+
"browser": "./dist/browser/index.js",
30+
"react-native": "./dist/react-native/index.js",
31+
"keywords": [
32+
"node",
33+
"azure",
34+
"cloud",
35+
"typescript",
36+
"browser",
37+
"isomorphic"
38+
],
39+
"author": "Microsoft Corporation",
40+
"license": "MIT",
41+
"files": [
42+
"dist/",
43+
"!dist/**/*.d.*ts.map",
44+
"README.md",
45+
"LICENSE"
46+
],
47+
"dependencies": {
48+
"@azure/core-util": "^1.9.2",
49+
"@azure-rest/core-client": "^2.3.1",
50+
"@azure/core-auth": "^1.6.0",
51+
"@azure/core-rest-pipeline": "^1.5.0",
52+
"@azure/logger": "^1.0.0",
53+
"tslib": "^2.6.2"
54+
},
55+
"devDependencies": {
56+
"dotenv": "^16.0.0",
57+
"@types/node": "^20.0.0",
58+
"eslint": "^9.9.0",
59+
"typescript": "~5.8.2",
60+
"tshy": "^2.0.0",
61+
"@microsoft/api-extractor": "^7.40.3",
62+
"rimraf": "^5.0.5",
63+
"mkdirp": "^3.0.1"
64+
},
65+
"scripts": {
66+
"clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
67+
"extract-api": "rimraf review && mkdirp ./review && api-extractor run --local",
68+
"pack": "npm pack 2>&1",
69+
"lint": "eslint package.json api-extractor.json src",
70+
"lint:fix": "eslint package.json api-extractor.json src --fix --fix-type [problem,suggestion]",
71+
"build": "npm run clean && tshy && npm run extract-api"
72+
},
73+
"exports": {
74+
"./package.json": "./package.json",
75+
".": {
76+
"browser": {
77+
"types": "./dist/browser/index.d.ts",
78+
"default": "./dist/browser/index.js"
79+
},
80+
"react-native": {
81+
"types": "./dist/react-native/index.d.ts",
82+
"default": "./dist/react-native/index.js"
83+
},
84+
"import": {
85+
"types": "./dist/esm/index.d.ts",
86+
"default": "./dist/esm/index.js"
87+
},
88+
"require": {
89+
"types": "./dist/commonjs/index.d.ts",
90+
"default": "./dist/commonjs/index.js"
91+
}
92+
},
93+
"./api": {
94+
"browser": {
95+
"types": "./dist/browser/api/index.d.ts",
96+
"default": "./dist/browser/api/index.js"
97+
},
98+
"react-native": {
99+
"types": "./dist/react-native/api/index.d.ts",
100+
"default": "./dist/react-native/api/index.js"
101+
},
102+
"import": {
103+
"types": "./dist/esm/api/index.d.ts",
104+
"default": "./dist/esm/api/index.js"
105+
},
106+
"require": {
107+
"types": "./dist/commonjs/api/index.d.ts",
108+
"default": "./dist/commonjs/api/index.js"
109+
}
110+
},
111+
"./api/savingsPlanModels": {
112+
"browser": {
113+
"types": "./dist/browser/api/savingsPlanModels/index.d.ts",
114+
"default": "./dist/browser/api/savingsPlanModels/index.js"
115+
},
116+
"react-native": {
117+
"types": "./dist/react-native/api/savingsPlanModels/index.d.ts",
118+
"default": "./dist/react-native/api/savingsPlanModels/index.js"
119+
},
120+
"import": {
121+
"types": "./dist/esm/api/savingsPlanModels/index.d.ts",
122+
"default": "./dist/esm/api/savingsPlanModels/index.js"
123+
},
124+
"require": {
125+
"types": "./dist/commonjs/api/savingsPlanModels/index.d.ts",
126+
"default": "./dist/commonjs/api/savingsPlanModels/index.js"
127+
}
128+
},
129+
"./models": {
130+
"browser": {
131+
"types": "./dist/browser/models/index.d.ts",
132+
"default": "./dist/browser/models/index.js"
133+
},
134+
"react-native": {
135+
"types": "./dist/react-native/models/index.d.ts",
136+
"default": "./dist/react-native/models/index.js"
137+
},
138+
"import": {
139+
"types": "./dist/esm/models/index.d.ts",
140+
"default": "./dist/esm/models/index.js"
141+
},
142+
"require": {
143+
"types": "./dist/commonjs/models/index.d.ts",
144+
"default": "./dist/commonjs/models/index.js"
145+
}
146+
}
147+
},
148+
"main": "./dist/commonjs/index.js",
149+
"types": "./dist/commonjs/index.d.ts",
150+
"module": "./dist/esm/index.js"
151+
}

0 commit comments

Comments
 (0)