Skip to content
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

[TCGC] __raw of SdkCredentialType is the namespace instead of the decorator itself #2232

Open
ArcturusZhang opened this issue Feb 19, 2025 · 1 comment
Labels
lib:tcgc Issues for @azure-tools/typespec-client-generator-core library

Comments

@ArcturusZhang
Copy link
Member

As we all know, SdkCredentialType corresponds to the @useAuth decorator, but its __raw is the namespace with that decorator instead of the decorator itself.
This would lead to when we want to report something wrong for the auth, the diagnostic will show up on the namespace instead of the auth itself.
Image
This would be so confusing because in a lot of cases, the target of a decorator could be in a different file from the decorator itself.

For instance, if we have:

@useAuth(ApiKeyAuth<ApiKeyLocation.cookie, "my-cookie">)
namespace Service;

We should have the raw corresponding to the ApiKeyAuth<ApiKeyLocation.cookie, "my-cookie"> part, or at least the decorator itself.

@ArcturusZhang ArcturusZhang added the lib:tcgc Issues for @azure-tools/typespec-client-generator-core library label Feb 19, 2025
@tadelesh
Copy link
Member

in EmitContext, we could not get the decorator node directly, but only the info decorator helper exposed. idk if there is any convenient way to locate the original decorator node from the type. for your example, we get authentication info from getAuthentication helper and the result does not contain the original decorator info.

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

No branches or pull requests

2 participants