change compared api versions when generated `addedOn`

This commit is contained in:
tadelesh 2024-05-08 17:33:40 +08:00
Родитель 45337a1719
Коммит 3283333af0
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -77,8 +77,9 @@ export function getAddedOn<TServiceOperation extends SdkServiceOperation>(
context: PythonSdkContext<TServiceOperation>, context: PythonSdkContext<TServiceOperation>,
type: SdkModelPropertyType | SdkMethod<TServiceOperation>, type: SdkModelPropertyType | SdkMethod<TServiceOperation>,
): string | undefined { ): string | undefined {
// We only want added on if it's not the same as the client's added on // since we do not support multi-service for now, we can just check the root client's api version
if (type.apiVersions[0] === context.experimental_sdkPackage.clients[0].apiVersions[0]) return undefined; // 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]; return type.apiVersions[0];
} }