-
Notifications
You must be signed in to change notification settings - Fork 67
[tcgc] add @clientOption decorator
#3827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
All changed packages have been documented.
Show changes
|
| it("multiple same decorators", async function () { | ||
| it("multiple same decorators with matching scope", async function () { | ||
| runner = await createSdkTestRunner( | ||
| {}, |
There was a problem hiding this comment.
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), | ||
| ); | ||
| } | ||
|
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
|
You can try these changes here
|
tadelesh
left a comment
There was a problem hiding this 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), | ||
| ); | ||
| } | ||
|
|
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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?
|
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") |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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
fixes #2228