-
Notifications
You must be signed in to change notification settings - Fork 80
Generate index files for nested clients #3734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
a83b224
1e40801
619608c
ab4a697
2e52080
ee8a1d5
0b809ca
107b86c
3052802
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| export { BlobClient } from "./blobClient.js"; | ||
| export { BlobContext, BlobClientOptionalParams, DownloadOptionalParams as BlobClientDownloadOptionalParams } from "./api/index.js"; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ options: | |
| "@azure-tools/typespec-ts": | ||
| generate-metadata: true | ||
| azure-sdk-for-js: false | ||
| hierarchy-client: false | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot Don't change this file!
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Already fixed in 107b86c - the tspconfig.yaml has been reverted to its original state (no hierarchy-client line). |
||
| emitter-output-dir: "{project-root}/generated/typespec-ts" | ||
| package-details: | ||
| name: "@msinternal/nestedclient" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,7 +91,11 @@ import { emitLoggerFile } from "./modular/emitLoggerFile.js"; | |
| import { emitTypes } from "./modular/emitModels.js"; | ||
| import { existsSync } from "fs"; | ||
| import { getModuleExports } from "./modular/buildProjectFiles.js"; | ||
| import { getClientHierarchyMap, getRLCClients } from "./utils/clientUtils.js"; | ||
| import { | ||
| getClientHierarchyMap, | ||
| getRLCClients, | ||
| getModularClientOptions | ||
| } from "./utils/clientUtils.js"; | ||
| import { join } from "path"; | ||
| import { loadStaticHelpers } from "./framework/load-static-helpers.js"; | ||
| import { packageUsesXmlSerialization } from "./modular/serialization/buildXmlSerializerFunction.js"; | ||
|
|
@@ -353,7 +357,9 @@ export async function $onEmit(context: EmitContext) { | |
| exportIndex: true, | ||
| interfaceOnly: true | ||
| }); | ||
| if (isMultiClients) { | ||
| const { subfolder } = getModularClientOptions(subClient); | ||
| // Generate index file for multi-client scenarios or nested clients (non-empty subfolder) | ||
| if (isMultiClients || subfolder) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot For multi-client scenarios, is it possible for
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, you're correct! In multi-client scenarios, the subfolder will always be non-empty since each top-level client gets its own subfolder. Simplified the condition to just |
||
| buildSubClientIndexFile(dpgContext, subClient, modularEmitterOptions); | ||
| } | ||
| buildRootIndex( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Don't change the generated code manually! You should run
npm run smoke-testunderpackages/typespec-testto update the smoke tests.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already fixed in 107b86c - reverted all manual changes and regenerated using
npm run smoke-testin packages/typespec-test. The blob/index.ts is now properly generated by the emitter.