Skip to content

Conversation

@iscai-msft
Copy link
Contributor

fixes #2228

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

azure-sdk commented Jan 22, 2026

All changed packages have been documented.

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

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

Add @clientOption flag for experimental, language-specific flags

@azure-sdk
Copy link
Collaborator

azure-sdk commented Jan 22, 2026

You can try these changes here

🛝 Playground 🌐 Website

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.

Shall we export client option in TCGC type graph? Current way seems not very convenient for language emitter.

@tadelesh
Copy link
Member

And could you merge main and migrate to use new testing framework?

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 26, 2026

Open in StackBlitz

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

commit: 84f360d

@iscai-msft
Copy link
Contributor Author

@tadelesh I added a new getter getClientOptions. The name is close with getClientInitializationOptions, but I think it should be ok, lmk your thoughts

Comment on lines +923 to +931
export function getClientOptions(decorators: DecoratorInfo[]): SdkClientOption[] {
return decorators
.filter((d) => d.name === CLIENT_OPTION_DECORATOR_NAME)
.map((d) => ({
name: d.arguments.name as string,
value: d.arguments.value as Value,
scope: d.arguments.scope as string | undefined,
}));
}
Copy link
Member

Choose a reason for hiding this comment

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

May be getClientOptions<T extends DecoratedType>(type: T, key): unknown is much useful?

Copy link
Member

@joheredi joheredi left a comment

Choose a reason for hiding this comment

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

Looks good! My only question is process-wise, what is the expected lifecycle of an experimental decorator. Once it is validated and proven helpful do we expect the emitter to expose an actual decorator to replace the @@clientoption?

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.

[TCGC] Add a clientOption(name, value, scope) decorator

5 participants