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

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

it("multiple same decorators", async function () {
it("multiple same decorators with matching scope", async function () {
runner = await createSdkTestRunner(
{},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we always default to csharp (see here) so this is actually testing that all scopes are returned in .decorators even if it doesn't match the emitter. I don't think this is what we should be doing, see my other comment

getDecoratorArgValue(context, decorator.args[i].jsValue, type, decoratorName),
);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tadelesh is there a reason we didn't filter raw decorators by scope before? I think we should because we only want actionable decorator values for a language emitter

Copy link
Member

Choose a reason for hiding this comment

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

Oh, that's a logic missing. Good catch. Thanks for the fix.

@azure-sdk
Copy link
Collaborator

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.

getDecoratorArgValue(context, decorator.args[i].jsValue, type, decoratorName),
);
}

Copy link
Member

Choose a reason for hiding this comment

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

Oh, that's a logic missing. Good catch. Thanks for the fix.

* }
* ```
*/
extern dec clientOption(target: unknown, name: valueof string, value: unknown, scope?: valueof string);
Copy link
Member

Choose a reason for hiding this comment

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

Shall we limit the value to value type?

@tadelesh
Copy link
Member

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

* @example Apply an experimental option for Python
* ```typespec
* #suppress "@azure-tools/typespec-client-generator-core/client-option"
* @clientOption("enableFeatureFoo", true, "python")
Copy link
Member

Choose a reason for hiding this comment

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

can we add a link to the website with a dedicated place where we can define what are the options and values

*
* @example Apply an experimental option for Python
* ```typespec
* #suppress "@azure-tools/typespec-client-generator-core/client-option"
Copy link
Member

Choose a reason for hiding this comment

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

Show example of the suppression with a message

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

4 participants