autorest.typescript
autorest.typescript copied to clipboard
[Bug] API Version Not Respected in `createClient`
Description:
When generating a client that targets a specific API version, the generated createClient
function does not respect the specified api-version
flag in tspconfig.yaml
. Although models and operations for the specific version are generated correctly, createClient
defaults to the latest version instead of the specified one.
Relevant Details:
- TCGC was updated to support targeting specific API versions through the
api-version
flag intspconfig.yaml
, as introduced by this change. - The TypeScript emitter is already utilizing TCGC with this feature support.
- The issue is specifically observed in the generated
createClient
function which continues to use the default (latest) API version.
Suspected Culprit:
- The issue might be stemming from how the API version is handled or defaulted in the
createClient
function within the TypeScript Emitter. Specifically, the logic in this line of code might be ignoring the specified API version.
Steps to Reproduce:
- Configure
tspconfig.yaml
with a specificapi-version
. - Generate a client using the Typescript Emitter.
- Observe that the generated client's
createClient
function defaults to the latest API version instead of using the specified version.
Expected Behavior:
The createClient
function should respect the API version specified in tspconfig.yaml
and use it instead of defaulting to the latest version.
Actual Behavior:
The createClient
function ignores the specified API version and defaults to the latest version.
Screenshots/Logs:
Environment:
- Typescript Emitter version: 0.28.0
- Typespec Compiler version: 0.55.0