From cb8e5bbdafe51f449097a3a0767564eff695a203 Mon Sep 17 00:00:00 2001 From: qiaozha Date: Fri, 4 Aug 2023 14:32:09 +0800 Subject: [PATCH 1/2] use-post-for-multi-client --- .../cadl-ranch-specs/cadl-ranch-summary.md | 48 +++++++++---------- .../http/client/structure/common/service.tsp | 12 ++--- .../http/client/structure/default/mockapi.ts | 12 ++--- .../client/structure/multi-client/mockapi.ts | 12 ++--- .../structure/renamed-operation/mockapi.ts | 12 ++--- .../structure/two-operation-group/mockapi.ts | 12 ++--- 6 files changed, 54 insertions(+), 54 deletions(-) diff --git a/packages/cadl-ranch-specs/cadl-ranch-summary.md b/packages/cadl-ranch-specs/cadl-ranch-summary.md index 70749e0aa..236ca5c4e 100644 --- a/packages/cadl-ranch-specs/cadl-ranch-summary.md +++ b/packages/cadl-ranch-specs/cadl-ranch-summary.md @@ -621,12 +621,12 @@ Expected response body: ### Client_Structure_MultiClient - Endpoints: - - `patch /client/structure/{client}/one` - - `patch /client/structure/{client}/three` - - `patch /client/structure/{client}/five` - - `patch /client/structure/{client}/two` - - `patch /client/structure/{client}/four` - - `patch /client/structure/{client}/six` + - `post /client/structure/{client}/one` + - `post /client/structure/{client}/three` + - `post /client/structure/{client}/five` + - `post /client/structure/{client}/two` + - `post /client/structure/{client}/four` + - `post /client/structure/{client}/six` Include multiple clients in the same spec. @@ -646,12 +646,12 @@ clientB.renamedSix(); ### Client_Structure_RenamedOperation - Endpoints: - - `patch /client/structure/{client}/two` - - `patch /client/structure/{client}/four` - - `patch /client/structure/{client}/six` - - `patch /client/structure/{client}/one` - - `patch /client/structure/{client}/three` - - `patch /client/structure/{client}/five` + - `post /client/structure/{client}/two` + - `post /client/structure/{client}/four` + - `post /client/structure/{client}/six` + - `post /client/structure/{client}/one` + - `post /client/structure/{client}/three` + - `post /client/structure/{client}/five` This is to show we can have more than one operation group in a client. The client side should be able to call the api like @@ -670,12 +670,12 @@ client.group.renamedSix(); ### Client_Structure_Service - Endpoints: - - `patch /client/structure/{client}/three` - - `patch /client/structure/{client}/four` - - `patch /client/structure/{client}/five` - - `patch /client/structure/{client}/six` - - `patch /client/structure/{client}/one` - - `patch /client/structure/{client}/two` + - `post /client/structure/{client}/three` + - `post /client/structure/{client}/four` + - `post /client/structure/{client}/five` + - `post /client/structure/{client}/six` + - `post /client/structure/{client}/one` + - `post /client/structure/{client}/two` This is to show that if we don't do any customization. The client side should be able to call the api like @@ -692,12 +692,12 @@ client.six(); ### Client_Structure_TwoOperationGroup - Endpoints: - - `patch /client/structure/{client}/one` - - `patch /client/structure/{client}/three` - - `patch /client/structure/{client}/four` - - `patch /client/structure/{client}/two` - - `patch /client/structure/{client}/five` - - `patch /client/structure/{client}/six` + - `post /client/structure/{client}/one` + - `post /client/structure/{client}/three` + - `post /client/structure/{client}/four` + - `post /client/structure/{client}/two` + - `post /client/structure/{client}/five` + - `post /client/structure/{client}/six` This is to show we can have more than one operation group in a client. The client side should be able to call the api like diff --git a/packages/cadl-ranch-specs/http/client/structure/common/service.tsp b/packages/cadl-ranch-specs/http/client/structure/common/service.tsp index 8e885bcdb..7feb46c60 100644 --- a/packages/cadl-ranch-specs/http/client/structure/common/service.tsp +++ b/packages/cadl-ranch-specs/http/client/structure/common/service.tsp @@ -38,33 +38,33 @@ enum ClientType { #suppress "@azure-tools/cadl-ranch-expect/missing-scenario" "This is by design those operations get defined as scenarios in the client" @route("/one") -@patch +@post op one(): void; #suppress "@azure-tools/cadl-ranch-expect/missing-scenario" "This is by design those operations get defined as scenarios in the client" @route("/two") -@patch +@post op two(): void; interface Foo { #suppress "@azure-tools/cadl-ranch-expect/missing-scenario" "This is by design those operations get defined as scenarios in the client" @route("/three") - @patch + @post three(): void; #suppress "@azure-tools/cadl-ranch-expect/missing-scenario" "This is by design those operations get defined as scenarios in the client" @route("/four") - @patch + @post four(): void; } interface Bar { #suppress "@azure-tools/cadl-ranch-expect/missing-scenario" "This is by design those operations get defined as scenarios in the client" @route("/five") - @patch + @post five(): void; #suppress "@azure-tools/cadl-ranch-expect/missing-scenario" "This is by design those operations get defined as scenarios in the client" @route("/six") - @patch + @post six(): void; } diff --git a/packages/cadl-ranch-specs/http/client/structure/default/mockapi.ts b/packages/cadl-ranch-specs/http/client/structure/default/mockapi.ts index 00a25b1a5..6bc3addd1 100644 --- a/packages/cadl-ranch-specs/http/client/structure/default/mockapi.ts +++ b/packages/cadl-ranch-specs/http/client/structure/default/mockapi.ts @@ -3,22 +3,22 @@ import { ScenarioMockApi } from "@azure-tools/cadl-ranch-api"; export const Scenarios: Record = {}; Scenarios.Client_Structure_Service = passOnSuccess([ - mockapi.patch("/client/structure/default/one", (req) => { + mockapi.post("/client/structure/default/one", (req) => { return { status: 204 }; }), - mockapi.patch("/client/structure/default/two", (req) => { + mockapi.post("/client/structure/default/two", (req) => { return { status: 204 }; }), - mockapi.patch("/client/structure/default/three", (req) => { + mockapi.post("/client/structure/default/three", (req) => { return { status: 204 }; }), - mockapi.patch("/client/structure/default/four", (req) => { + mockapi.post("/client/structure/default/four", (req) => { return { status: 204 }; }), - mockapi.patch("/client/structure/default/five", (req) => { + mockapi.post("/client/structure/default/five", (req) => { return { status: 204 }; }), - mockapi.patch("/client/structure/default/six", (req) => { + mockapi.post("/client/structure/default/six", (req) => { return { status: 204 }; }), ]); diff --git a/packages/cadl-ranch-specs/http/client/structure/multi-client/mockapi.ts b/packages/cadl-ranch-specs/http/client/structure/multi-client/mockapi.ts index 437c33e8b..8f1dedad8 100644 --- a/packages/cadl-ranch-specs/http/client/structure/multi-client/mockapi.ts +++ b/packages/cadl-ranch-specs/http/client/structure/multi-client/mockapi.ts @@ -3,22 +3,22 @@ import { ScenarioMockApi } from "@azure-tools/cadl-ranch-api"; export const Scenarios: Record = {}; Scenarios.Client_Structure_MultiClient = passOnSuccess([ - mockapi.patch("/client/structure/multi-client/one", (req) => { + mockapi.post("/client/structure/multi-client/one", (req) => { return { status: 204 }; }), - mockapi.patch("/client/structure/multi-client/two", (req) => { + mockapi.post("/client/structure/multi-client/two", (req) => { return { status: 204 }; }), - mockapi.patch("/client/structure/multi-client/three", (req) => { + mockapi.post("/client/structure/multi-client/three", (req) => { return { status: 204 }; }), - mockapi.patch("/client/structure/multi-client/four", (req) => { + mockapi.post("/client/structure/multi-client/four", (req) => { return { status: 204 }; }), - mockapi.patch("/client/structure/multi-client/five", (req) => { + mockapi.post("/client/structure/multi-client/five", (req) => { return { status: 204 }; }), - mockapi.patch("/client/structure/multi-client/six", (req) => { + mockapi.post("/client/structure/multi-client/six", (req) => { return { status: 204 }; }), ]); diff --git a/packages/cadl-ranch-specs/http/client/structure/renamed-operation/mockapi.ts b/packages/cadl-ranch-specs/http/client/structure/renamed-operation/mockapi.ts index 365f7638f..a236556cf 100644 --- a/packages/cadl-ranch-specs/http/client/structure/renamed-operation/mockapi.ts +++ b/packages/cadl-ranch-specs/http/client/structure/renamed-operation/mockapi.ts @@ -3,22 +3,22 @@ import { ScenarioMockApi } from "@azure-tools/cadl-ranch-api"; export const Scenarios: Record = {}; Scenarios.Client_Structure_RenamedOperation = passOnSuccess([ - mockapi.patch("/client/structure/renamed-operation/one", (req) => { + mockapi.post("/client/structure/renamed-operation/one", (req) => { return { status: 204 }; }), - mockapi.patch("/client/structure/renamed-operation/two", (req) => { + mockapi.post("/client/structure/renamed-operation/two", (req) => { return { status: 204 }; }), - mockapi.patch("/client/structure/renamed-operation/three", (req) => { + mockapi.post("/client/structure/renamed-operation/three", (req) => { return { status: 204 }; }), - mockapi.patch("/client/structure/renamed-operation/four", (req) => { + mockapi.post("/client/structure/renamed-operation/four", (req) => { return { status: 204 }; }), - mockapi.patch("/client/structure/renamed-operation/five", (req) => { + mockapi.post("/client/structure/renamed-operation/five", (req) => { return { status: 204 }; }), - mockapi.patch("/client/structure/renamed-operation/six", (req) => { + mockapi.post("/client/structure/renamed-operation/six", (req) => { return { status: 204 }; }), ]); diff --git a/packages/cadl-ranch-specs/http/client/structure/two-operation-group/mockapi.ts b/packages/cadl-ranch-specs/http/client/structure/two-operation-group/mockapi.ts index 11e9e506b..651b902ff 100644 --- a/packages/cadl-ranch-specs/http/client/structure/two-operation-group/mockapi.ts +++ b/packages/cadl-ranch-specs/http/client/structure/two-operation-group/mockapi.ts @@ -3,22 +3,22 @@ import { ScenarioMockApi } from "@azure-tools/cadl-ranch-api"; export const Scenarios: Record = {}; Scenarios.Client_Structure_TwoOperationGroup = passOnSuccess([ - mockapi.patch("/client/structure/two-operation-group/one", (req) => { + mockapi.post("/client/structure/two-operation-group/one", (req) => { return { status: 204 }; }), - mockapi.patch("/client/structure/two-operation-group/two", (req) => { + mockapi.post("/client/structure/two-operation-group/two", (req) => { return { status: 204 }; }), - mockapi.patch("/client/structure/two-operation-group/three", (req) => { + mockapi.post("/client/structure/two-operation-group/three", (req) => { return { status: 204 }; }), - mockapi.patch("/client/structure/two-operation-group/four", (req) => { + mockapi.post("/client/structure/two-operation-group/four", (req) => { return { status: 204 }; }), - mockapi.patch("/client/structure/two-operation-group/five", (req) => { + mockapi.post("/client/structure/two-operation-group/five", (req) => { return { status: 204 }; }), - mockapi.patch("/client/structure/two-operation-group/six", (req) => { + mockapi.post("/client/structure/two-operation-group/six", (req) => { return { status: 204 }; }), ]); From 8d2d6b4e743deb85dfac04da19b011a2b14adfb8 Mon Sep 17 00:00:00 2001 From: Qiaoqiao Zhang <55688292+qiaozha@users.noreply.github.com> Date: Fri, 4 Aug 2023 14:36:17 +0800 Subject: [PATCH 2/2] Create smart-poems-greet.md --- .changeset/smart-poems-greet.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/smart-poems-greet.md diff --git a/.changeset/smart-poems-greet.md b/.changeset/smart-poems-greet.md new file mode 100644 index 000000000..448bd37f4 --- /dev/null +++ b/.changeset/smart-poems-greet.md @@ -0,0 +1,5 @@ +--- +"@azure-tools/cadl-ranch-specs": patch +--- + +use post as http method for multi-client test cases