From 3283333af096fd2ff0fa141ed740b615035d15e7 Mon Sep 17 00:00:00 2001 From: tadelesh Date: Wed, 8 May 2024 17:33:40 +0800 Subject: [PATCH] change compared api versions when generated `addedOn` --- packages/typespec-python/src/utils.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/typespec-python/src/utils.ts b/packages/typespec-python/src/utils.ts index ccb9aa31070..8ab19e90750 100644 --- a/packages/typespec-python/src/utils.ts +++ b/packages/typespec-python/src/utils.ts @@ -77,8 +77,9 @@ export function getAddedOn( context: PythonSdkContext, type: SdkModelPropertyType | SdkMethod, ): string | undefined { - // We only want added on if it's not the same as the client's added on - if (type.apiVersions[0] === context.experimental_sdkPackage.clients[0].apiVersions[0]) return undefined; + // since we do not support multi-service for now, we can just check the root client's api version + // if type is added in the first version of the client, we do not need to add the versioning info + if (type.apiVersions[0] === context.experimental_sdkPackage.clients.find(c => c.initialization.access === "public")?.apiVersions[0]) return undefined; return type.apiVersions[0]; }