Generate index files for nested clients#3734
Conversation
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>
| if (isMultiClients) { | ||
| const { subfolder } = getModularClientOptions(subClient); | ||
| // Generate index file for multi-client scenarios or nested clients (non-empty subfolder) | ||
| if (isMultiClients || subfolder) { |
There was a problem hiding this comment.
@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)?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
@copilot Don't change the generated code manually! You should run npm run smoke-test under packages/typespec-test to update the smoke tests.
There was a problem hiding this comment.
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>
Fix nested client index file generation
Changes Made
packages/typespec-ts/src/index.ts: ExtendedbuildSubClientIndexFileinvocation to include clients with non-empty subfolders (nested clients)isMultiClientsvariableTesting
blob/index.tsfile properly exports BlobClient componentsPR Feedback Addressed
tspconfig.yaml- no longer modifying test configurationnpm run smoke-testto regenerate properlyisMultiClientscheckOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.