Skip to content

Fix TypeScript generation for multiple services - #5328

Merged
Jialin Huang (JialinHuang803) merged 5 commits into
Azure:mainfrom
JialinHuang803:fix/typespec-ts-multiple-services
Aug 31, 2026
Merged

Fix TypeScript generation for multiple services#5328
Jialin Huang (JialinHuang803) merged 5 commits into
Azure:mainfrom
JialinHuang803:fix/typespec-ts-multiple-services

Conversation

@JialinHuang803

@JialinHuang803 Jialin Huang (JialinHuang803) commented Aug 27, 2026

Copy link
Copy Markdown
Member

Summary

  • scope classic operation-group declarations and references to their owning client
  • use each generated service context directly instead of invalid Client.<context> qualification
  • trim the model namespace prefix shared by all services while preserving service-specific folders
  • enable the service/multiple-services Spector case and add modular coverage for client and model hierarchy

Validation

  • pnpm format
  • pnpm lint
  • pnpm -C packages/typespec-ts run build
  • pnpm -C packages/typespec-ts run unit-test (666 passed)
  • pnpm -C packages/typespec-ts run test-next (254 passed)
  • regenerated service/multiple-services successfully
  • service-multiple-services.test.ts (4 passed)
  • existing service-multi-service.test.ts (2 passed)

Scope classic operation-group references to their owning clients and use imported client context aliases consistently. Add modular and Spector coverage for both services.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • @azure-tools/typespec-ts
Show changes

@azure-tools/typespec-ts - fix ✏️

Fix generated operation groups and model namespace paths when a package contains multiple services.

@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

📦 Package size report

1 package changed size, +4.65 KB (+0.0%) packed overall.

Package Packed (base → head) Δ Packed Unpacked (base → head) Δ Unpacked
@azure-tools/typespec-ts 532.67 KB → 536.71 KB +4.04 KB (+0.8%) 🔴 2.56 MB → 2.58 MB +17.91 KB (+0.7%) 🔴
12 package(s) with no notable change
Package Packed (base → head) Δ Packed Unpacked (base → head) Δ Unpacked
@azure-tools/typespec-go 259.93 KB → 260.21 KB +285 B (+0.1%) 1.33 MB → 1.33 MB +1.06 KB (+0.1%)
@azure-tools/typespec-client-generator-core 229.25 KB → 229.48 KB +229 B (+0.1%) 1.23 MB → 1.23 MB +937 B (+0.1%)
@azure-tools/typespec-java 13.51 MB → 13.51 MB +117 B (+0.0%) 15.03 MB → 15.03 MB
@azure-tools/azure-http-specs 146.71 KB → 146.71 KB 1.16 MB → 1.16 MB
@azure-tools/typespec-autorest 80.93 KB → 80.93 KB 395.06 KB → 395.06 KB
@azure-tools/typespec-autorest-canonical 7.42 KB → 7.42 KB 26.00 KB → 26.00 KB
@azure-tools/typespec-azure-core 129.43 KB → 129.43 KB 702.77 KB → 702.77 KB
@azure-tools/typespec-azure-portal-core 42.40 KB → 42.40 KB 192.91 KB → 192.91 KB
@azure-tools/typespec-azure-resource-manager 171.92 KB → 171.92 KB 1.04 MB → 1.04 MB
@azure-tools/typespec-azure-rulesets 5.16 KB → 5.16 KB 32.09 KB → 32.09 KB
@azure-tools/typespec-metadata 15.91 KB → 15.91 KB 62.26 KB → 62.26 KB
@azure-tools/typespec-python 42.22 KB → 42.22 KB 164.91 KB → 164.91 KB

Packed = gzipped .tgz published to npm. Unpacked = total extracted size. 🆕 added, 🗑️ removed. Packages from the core/ submodule are not included.
🔴 grew · 🟢 shrank — only changes of at least 512 B and 0.5% are marked.

@pkg-pr-new

pkg-pr-new Bot commented Aug 27, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@azure-tools/typespec-ts@5328

commit: 168cd38

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@azure-sdk-automation

Copy link
Copy Markdown
Contributor

You can try these changes here

🛝 Playground 🌐 Website

Trim the namespace prefix shared by all services while preserving service-specific model folders. Add coverage for single, shared-root, and unrelated top-level service namespaces.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread packages/typespec-ts/src/modular/emit-models.ts
Comment thread packages/typespec-ts/src/modular/build-classical-client.ts Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@JialinHuang803
Jialin Huang (JialinHuang803) added this pull request to the merge queue Aug 31, 2026
Merged via the queue into Azure:main with commit ec0efa3 Aug 31, 2026
42 of 44 checks passed
@JialinHuang803
Jialin Huang (JialinHuang803) deleted the fix/typespec-ts-multiple-services branch August 31, 2026 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:typescript Issues for @azure-tools/typespec-ts emitter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[typespec-ts] Multiple services bind ServiceA operation groups to ServiceB

2 participants