Skip to content

Generate index files for nested clients#3734

Merged
JialinHuang803 merged 9 commits intomainfrom
copilot/fix-missing-index-file-nested-client
Feb 12, 2026
Merged

Generate index files for nested clients#3734
JialinHuang803 merged 9 commits intomainfrom
copilot/fix-missing-index-file-nested-client

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 10, 2026

Fix nested client index file generation

Changes Made

  • Modified condition in packages/typespec-ts/src/index.ts: Extended buildSubClientIndexFile invocation to include clients with non-empty subfolders (nested clients)
  • Removed unused isMultiClients variable

Testing

  • ✅ All 473 unit tests passed
  • ✅ Smoke tests passed (including nestedClient)
  • ✅ Generated blob/index.ts file properly exports BlobClient components

PR Feedback Addressed

  • Reverted manual changes to tspconfig.yaml - no longer modifying test configuration
  • Reverted manual changes to generated files - now using npm run smoke-test to regenerate properly
  • Simplified condition logic as requested - removed redundant isMultiClients check
Original prompt

This section details on the original issue you should resolve

<issue_title>The index file is not generated for the nested client</issue_title>
<issue_description>When there are nested clients, the index files under the folder of the clients are missing.

For example, in the nestedClient smoke test, there needs to be an index.ts file within the blob folder, which exports all necessary components of this blob sub-client.
https://github.com/Azure/autorest.typescript/tree/main/packages/typespec-test/test/nestedClient/generated/typespec-ts/src/blob</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 6 commits February 10, 2026 06:38
Co-authored-by: JialinHuang803 <139532647+JialinHuang803@users.noreply.github.com>
Co-authored-by: JialinHuang803 <139532647+JialinHuang803@users.noreply.github.com>
Co-authored-by: JialinHuang803 <139532647+JialinHuang803@users.noreply.github.com>
Co-authored-by: JialinHuang803 <139532647+JialinHuang803@users.noreply.github.com>
Co-authored-by: JialinHuang803 <139532647+JialinHuang803@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix missing index file generation for nested clients Generate index files for nested clients Feb 10, 2026
Copilot AI requested a review from JialinHuang803 February 10, 2026 07:02
Comment thread packages/typespec-ts/src/index.ts Outdated
if (isMultiClients) {
const { subfolder } = getModularClientOptions(subClient);
// Generate index file for multi-client scenarios or nested clients (non-empty subfolder)
if (isMultiClients || subfolder) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot For multi-client scenarios, is it possible for subfolder to be an empty string? If not, can this conditional be simplified to just if(subfolder)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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 if (subfolder) and removed the unused isMultiClients variable in 107b86c.

"@azure-tools/typespec-ts":
generate-metadata: true
azure-sdk-for-js: false
hierarchy-client: false
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Don't change this file!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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).

Copy link
Copy Markdown
Member

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-test under packages/typespec-test to update the smoke tests.

Copy link
Copy Markdown
Contributor Author

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-test in packages/typespec-test. The blob/index.ts is now properly generated by the emitter.

Co-authored-by: JialinHuang803 <139532647+JialinHuang803@users.noreply.github.com>
@JialinHuang803 JialinHuang803 marked this pull request as ready for review February 12, 2026 09:17
@JialinHuang803 JialinHuang803 enabled auto-merge (squash) February 12, 2026 09:30
@JialinHuang803 JialinHuang803 merged commit ca1ad12 into main Feb 12, 2026
16 checks passed
@JialinHuang803 JialinHuang803 deleted the copilot/fix-missing-index-file-nested-client branch February 12, 2026 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The index file is not generated for the nested client

3 participants