autorest.typescript icon indicating copy to clipboard operation
autorest.typescript copied to clipboard

[Bug] API Version Not Respected in `createClient`

Open joheredi opened this issue 9 months ago • 1 comments

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 in tspconfig.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:

  1. Configure tspconfig.yaml with a specific api-version.
  2. Generate a client using the Typescript Emitter.
  3. 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: Issue Screenshot

Environment:

  • Typescript Emitter version: 0.28.0
  • Typespec Compiler version: 0.55.0

joheredi avatar May 02 '24 20:05 joheredi