Skip to content

Conversation

@iscai-msft
Copy link
Contributor

No description provided.

@microsoft-github-policy-service microsoft-github-policy-service bot added the lib:tcgc Issues for @azure-tools/typespec-client-generator-core library label Oct 30, 2025
@azure-sdk
Copy link
Collaborator

azure-sdk commented Oct 30, 2025

All changed packages have been documented.

  • @azure-tools/typespec-client-generator-core
Show changes

@azure-tools/typespec-client-generator-core - feature ✏️

Add support to define one client from multiple services. Api versions for services will rest on the subclient

@azure-sdk
Copy link
Collaborator

azure-sdk commented Oct 30, 2025

You can try these changes here

🛝 Playground 🌐 Website

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 30, 2025

Open in StackBlitz

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

commit: bb9a49b

Comment on lines 158 to +161
this.apiVersion !== undefined &&
this.apiVersion !== "latest" &&
this.apiVersion !== "all" &&
!this.__packageVersions.includes(this.apiVersion)
!serviceVersions.includes(this.apiVersion)
Copy link
Member

Choose a reason for hiding this comment

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

This config could only be used for one service. How could this work for multiple service's version?

Copy link
Member

Choose a reason for hiding this comment

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

We may need to think about how to specific multiple service's api version in the config.

export function handleVersioningMutationForGlobalNamespace(context: TCGCContext): Namespace {
const globalNamespace = context.program.getGlobalNamespaceType();
const allApiVersions = context.getPackageVersions();
const allApiVersions = context.getApiVersions();
Copy link
Member

Choose a reason for hiding this comment

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

This logic is wrong. For different service's namespace, we should use different versioning mutator with service's specific version enum. Current logic uses the first service's versioning mutator to mutate the global namespace does not cover the other service's type graph.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah this is my thinking for also not allowing versioning mutation for multiple services. I think this code would be super complicated and prone to breaking. What are your thoughts? Maybe I could just throw a warning where we don't allow you to mutate to a specific version

Copy link
Member

Choose a reason for hiding this comment

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

I prefer either we mutate different namespaces with different versioning (support on TCGC layer) or let top level namespace client define a separated versioning with versioning dependency of child's namespace (support on TypeSpec level).

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.

3 participants