Skip to content

Comments

feat: implement multiple services support, consolidate @client/@operationGroup, and fully migrate operation-group logic to client-state flow#3924

Draft
Copilot wants to merge 12 commits intomainfrom
copilot/implement-versioning-mutation
Draft

feat: implement multiple services support, consolidate @client/@operationGroup, and fully migrate operation-group logic to client-state flow#3924
Copilot wants to merge 12 commits intomainfrom
copilot/implement-versioning-mutation

Conversation

Copy link
Contributor

Copilot AI commented Feb 11, 2026

Implemented the multiple-services design updates and completed consolidation work from design-docs/client.md and design-docs/multiple-services.md for @client and @operationGroup.

What’s included

  • Added apiVersionsMap to SdkClientType and populated it for cross-service clients.
  • Implemented multi-service hierarchy scenarios:
    • Scenario 0: multiple @service without explicit @client creates separate root clients.
    • Scenario 1: explicit client names for multiple services with auto-merge behavior.
    • Scenario 1.5: mixed multi-service and single-service clients in one package.
    • Scenario 2: services as direct children with nested @client.
  • Updated versioning mutation and cache/hierarchy behavior to support the above scenarios.
  • Updated explicit hierarchy detection logic (hasExplicitClientOrOperationGroup) for nested client cases.

Consolidation of @client and @operationGroup

Addressed the missing consolidation piece requested in review:

  • @operationGroup is deprecated in decorators.tsp.
  • $operationGroup now delegates directly to context.call($client, target, undefined, scope).
  • Operation-group explicit detection now uses consolidated client state.
  • Cache operation-group creation resolves from consolidated client state path.
  • SdkOperationGroup is deprecated in interfaces.ts in favor of SdkClient-based nested hierarchy customization.
  • Added recursive nested multi-service merge behavior so empty nested clients with multiple services merge operation groups from all services (not first-service-only).
  • Added focused regression coverage for nested @client with multiple services auto-merging recursively.

Sample updates in packages/azure-http-specs

To align samples with the consolidation direction, updated specs under packages/azure-http-specs to replace @operationGroup usages with @client:

  • specs/client/structure/client-operation-group/client.tsp
  • specs/client/structure/two-operation-group/client.tsp
  • specs/client/structure/renamed-operation/client.tsp
  • specs/client/structure/common/service.tsp (description text updated)
  • specs/client/naming/main.tsp
  • specs/client/naming/enum-conflict/main.tsp
  • specs/azure/core/scalar/main.tsp
  • specs/azure/core/model/main.tsp

Regenerated artifacts/docs

Because decorator source changed, regenerated and committed:

  • generated-defs/Azure.ClientGenerator.Core.ts
  • packages/typespec-client-generator-core/README.md
  • website/.../reference/decorators.md

Changeset update

Updated changesets to match review guidance:

  • Main changeset marked as breaking
  • Main changeset body rewritten to non-list changelog-friendly prose
  • Main changeset explicitly includes @operationGroup and SdkOperationGroup deprecation/migration context
  • Added an additional changeset for @azure-tools/azure-http-specs sample migration updates

Validation

  • typespec-client-generator-core tests pass: 1184 passed, 2 skipped.
  • ✅ Updated azure-http-specs sample files compile with tsp compile --no-emit.

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

Copilot AI and others added 4 commits February 11, 2026 03:33
- Add apiVersionsMap property to SdkClientType interface
- Update getOrCreateClients to create separate root client per service (Scenario 0)
- Update prepareClientAndOperationCache for nested @client support
- Update hasExplicitClientOrOperationGroup for nested @client detection
- Update handleVersioningMutationForGlobalNamespace for multiple scenarios
- Fix existing tests for new behavior

Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
…tests

- Add isNamespaceEmpty and serviceHasOperationGroupDecorators helpers
- Support auto-merge for single-service client with empty namespace (Scenario 1)
- Handle mixed multi-service and single-service versioning (Scenario 1.5)
- Add forceImplicit flag to createOperationGroup for auto-merge
- Add tests for Scenarios 0, 1, 1.5 and apiVersionsMap

Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
- Filter nested clients within multi-service parents from root client list
- Create operation groups for nested @client decorators in multi-service parents
- Support auto-merge of service content into empty nested client namespaces
- Add test for Scenario 2: services as direct children with nested @client

Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
…add changeset, format code

- Fix redundant ternary operators in cache.ts and internal-utils.ts
- Add changeset describing feature and breaking change migration guide
- Format code with pnpm format
- All 1183 tests pass (7 new + 1176 existing)

Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement versioning mutation according to design document feat: implement multiple services support per design doc Feb 11, 2026
Copilot AI requested a review from tadelesh February 11, 2026 04:09
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 12, 2026

Open in StackBlitz

npm i https://pkg.pr.new/Azure/typespec-azure/@azure-tools/typespec-client-generator-core@3924

commit: 2e9a28f

Copy link
Member

@tadelesh tadelesh left a comment

Choose a reason for hiding this comment

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

@copilot You need to handle the missing part from https://github.com/Azure/typespec-azure/blob/main/packages/typespec-client-generator-core/design-docs/client.md which is consolidating the @client and @operationGroup. You need to deprecate the @operationGroup and instead all client related customization should use @client. Also, you need to check all related logic especially in cache.ts and decorator.ts to ensure a smooth migration experience.

@microsoft-github-policy-service microsoft-github-policy-service bot added the lib:tcgc Issues for @azure-tools/typespec-client-generator-core library label Feb 24, 2026
Copilot AI and others added 2 commits February 24, 2026 07:27
Switch compile() to compileAndDiagnose() in tests that use @operationGroup
in their TypeSpec code, since the #deprecated annotation on @operationGroup
now produces a diagnostic warning that causes compile() to fail.

For tests already using compileAndDiagnose(), filter out the 'deprecated'
diagnostic before diagnostic assertions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
Copilot AI requested a review from tadelesh February 24, 2026 07:36
@tadelesh
Copy link
Member

@copilot You need to handle the missing part from https://github.com/Azure/typespec-azure/blob/main/packages/typespec-client-generator-core/design-docs/client.md which is consolidating the @client and @operationGroup. You need to deprecate the @operationGroup and instead all client related customization should use @client. Also, you need to check all related logic especially in cache.ts and decorator.ts to ensure a smooth migration experience.

Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 25, 2026

@copilot Resolve the comments.

Resolved in 10af9de. I addressed the open review threads: updated the changeset format/kind/content, deprecated SdkOperationGroup, and fixed nested multi-service recursion in cache.ts with a focused regression test. No UI changes in this PR.

@tadelesh
Copy link
Member

@copilot Please check the changes you made to make sure they all follow two client doc design doc and make sure all tests could pass.

@tadelesh
Copy link
Member

@copilot Please check the changes you made to make sure they all follow two client doc design doc and make sure all tests could pass.

Copy link
Contributor Author

Copilot AI commented Feb 25, 2026

@copilot Please check the changes you made to make sure they all follow two client doc design doc and make sure all tests could pass.

Rechecked against both client design docs (client.md and multiple-services.md) and verified the implemented behavior aligns with the documented scenarios, including nested @client consolidation and recursive multi-service nested merge behavior. I also reran the package tests after the latest changes: 1184 passed, 2 skipped. The relevant fix is in 10af9de. No UI changes in this PR, so no screenshot is applicable.

@tadelesh
Copy link
Member

@copilot You also need to update the samples under packages/azure-http-specs to replace @operationGroup to @client.

Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 25, 2026

@copilot You also need to update the samples under packages/azure-http-specs to replace @operationGroup to @client.

Done in dde0f8c: updated samples under packages/azure-http-specs to replace @operationGroup with @client and updated related sample text accordingly. I also verified there are no remaining @operationGroup usages under that package and compiled each changed TypeSpec sample with tsp compile --no-emit. No UI changes in this PR, so no screenshot is applicable.

Copilot AI changed the title feat: implement multiple services support and consolidate @client/@operationGroup per design docs feat: implement multiple services support, consolidate @client/@operationGroup, and update azure-http-specs samples Feb 25, 2026
Copy link
Member

@tadelesh tadelesh left a comment

Choose a reason for hiding this comment

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

@copilot Resolve all comments.

Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 25, 2026

@copilot Resolve all comments.

Resolved in 18d99cb. I addressed the remaining open threads: added a second changeset for azure-http-specs, updated @operationGroup implementation to bridge into consolidated client state while keeping backward compatibility, and migrated cache resolution to prioritize client state with legacy fallback. Full typespec-client-generator-core tests pass (1184 passed, 2 skipped). No UI changes in this PR.

Copilot AI changed the title feat: implement multiple services support, consolidate @client/@operationGroup, and update azure-http-specs samples feat: implement multiple services support, consolidate @client/@operationGroup, and migrate azure-http-specs samples with additional changeset coverage Feb 25, 2026
Copilot AI requested a review from tadelesh February 25, 2026 08:15
Copy link
Member

@tadelesh tadelesh left a comment

Choose a reason for hiding this comment

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

@copilot Resolve all comments and make sure all logics have been migrated from operation group to client.

Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 25, 2026

@copilot Resolve all comments and make sure all logics have been migrated from operation group to client.

Resolved in 1734f67. I migrated the remaining operation-group flow to client-state semantics, updated the decorator path and cache behavior accordingly, and updated affected tests to reflect migrated semantics. Full typespec-client-generator-core tests pass (1184 passed, 2 skipped). No UI changes in this PR.

Copilot AI changed the title feat: implement multiple services support, consolidate @client/@operationGroup, and migrate azure-http-specs samples with additional changeset coverage feat: implement multiple services support, consolidate @client/@operationGroup, and fully migrate operation-group logic to client-state flow Feb 25, 2026
Copilot AI requested a review from tadelesh February 25, 2026 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib:tcgc Issues for @azure-tools/typespec-client-generator-core library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants