-
Notifications
You must be signed in to change notification settings - Fork 42
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] make endpoint overridable #1155
Conversation
All changed packages have been documented.
Show changes
|
You can try these changes at https://cadlplayground.z22.web.core.windows.net/typespec-azure/prs/1155/ Check the website changes at https://tspwebsitepr.z22.web.core.windows.net/typespec-azure/prs/1155/ |
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.
LGTM
For this PR, I'm going to hold on merging it before this release because there's still open discussion about what the best way to do this is. In the meantime, I want to confirm that no language is blocked right now, correct? It's just that emitters are having to hardcode information about ARM. |
Hi @iscai-msft, I'm afraid it blocks Java adopting TCGC sdkpackage, I guess it also blocks other languages, as it will impact all management-plane generated SDKs, it causes public API breaking change. So if TCGC will not do this and we would like to adopt TCGC sdkpackage, each language emitter will do their own handling. API change if we do not make endpoint overridable. |
@haolingdong-msft can java do their own handling for this release? I would use this code snippet: function serializeClient(context: SdkContext, client: SdkClientType) {
...
for (param of client.initialization.parameters) {
if (param.kind === "endpoint" && context.arm) {
param.clientDefaultValue = param.serverUrl;
param.serverUrl = "{baseUrl}";
param.templateArguments = [{
"baseUrl",
isGeneratedName: true,
description: "Service host",
kind: "path",
onClient: true,
urlEncode: false,
optional: false,
serializedName: "baseUrl",
correspondingMethodParams: [],
type: {
kind: "string",
encode: "string",
decorators: [],
},
isApiVersionParam: false,
apiVersions: context.__tspTypeToApiVersions.get(client.type)!,
crossLanguageDefinitionId: `${getCrossLanguageDefinitionId(context, client.service)}.baseUrl`,
decorators: [],
},
]
}
}
}
function mainFunc(context: SdkContext) {
for (const client of sdkPackage.clients) {
serializeClient(context, client);
}
} We just want to make sure everyone's on the same page before committing this to tcgc. Agree that this isn't very nice code, but with this it shouldn't be blocking |
It's fine, I will do the handling in Java emitter first. Please let me know the decission of this issue. Thanks |
@iscai-msft is there any update for this? for typespec like follows, it seems there is no default value from current templated argument
|
that's a separate issue that i've fixed in a pr, following up on this current issue right now |
You can try these changes here
|
fixes #1153