-
Notifications
You must be signed in to change notification settings - Fork 68
[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
|
packages/typespec-client-generator-core/test/decorators/general-list.test.ts
Outdated
Show resolved
Hide resolved
|
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.
|
And could you merge main and migrate to use new testing framework? |
packages/typespec-client-generator-core/generated-defs/Azure.ClientGenerator.Core.ts
Show resolved
Hide resolved
…cgc/clientOptions
commit: |
|
@tadelesh I added a new getter |
packages/typespec-client-generator-core/test/decorators/client-option.test.ts
Show resolved
Hide resolved
| 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, | ||
| })); | ||
| } |
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.
May be getClientOptions<T extends DecoratedType>(type: T, key): unknown is much useful?
joheredi
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.
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?
fixes #2228