Skip to content

Commit

Permalink
Support server versions in modular and add cadl-ranch test cases (#2261)
Browse files Browse the repository at this point in the history
* add modular server versions

* fix version param global calculation

* fix api version in operation logic

* fix versioned test

* fix ci

* fix ci

* add rlc server versions in this pr

* revert smoke test

* should only have client side api version if api version exists in all operations

* fix batch

* fix ut

* unify api version when it exists in all operations

* fix smoke test

* fix ci

* fix parameters

* fix ci

* add ut for api version in modular

* Update packages/typespec-ts/test/modularUnit/apiOperations.spec.ts

* fix ut

* reserve work

* generate client level required apiVersion

* handle api-version in both url and query

* fix ci

* should not export apiVersion in operation level signature when it has default value

* Update packages/typespec-ts/src/modular/helpers/operationHelpers.ts

* fix integration test

* fix smoke-test

* regen smoke-test

* regen cadl test case

* add ut and fix smoke test

* resolve comments

---------

Co-authored-by: qiaozha <qiaozha@microsoft.com>
Co-authored-by: Qiaoqiao Zhang <55688292+qiaozha@users.noreply.github.com>
  • Loading branch information
3 people authored Mar 25, 2024
1 parent 5ff6da3 commit 45014e9
Show file tree
Hide file tree
Showing 64 changed files with 2,645 additions and 244 deletions.
3 changes: 2 additions & 1 deletion packages/rlc-common/src/buildClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,9 @@ export function getClientFactoryBody(
!!model.apiVersionInfo?.defaultValue
) {
apiVersionStatement = `options.apiVersion = options.apiVersion ?? "${model.apiVersionInfo?.defaultValue}"`;
} else if (model.apiVersionInfo?.definedPosition === "query") {
apiVersionStatement = `options.apiVersion = options.apiVersion ?? apiVersion`;
}

if (!clientPackageName.endsWith("-rest")) {
clientPackageName = clientPackageName + "-rest";
}
Expand Down
1 change: 1 addition & 0 deletions packages/rlc-common/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export interface PathTemplateApiVersion {
export interface UrlInfo {
endpoint?: string;
urlParameters?: PathParameter[];
apiVersionInfo?: ApiVersionInfo;
}

export interface ApiVersionInfo {
Expand Down
Loading

0 comments on commit 45014e9

Please sign in to comment.