Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use-post-for-multi-client #397

Merged
merged 2 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/smart-poems-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@azure-tools/cadl-ranch-specs": patch
---

use post as http method for multi-client test cases
48 changes: 24 additions & 24 deletions packages/cadl-ranch-specs/cadl-ranch-summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ import { ScenarioMockApi } from "@azure-tools/cadl-ranch-api";

export const Scenarios: Record<string, ScenarioMockApi> = {};
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 };
}),
]);
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ import { ScenarioMockApi } from "@azure-tools/cadl-ranch-api";

export const Scenarios: Record<string, ScenarioMockApi> = {};
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 };
}),
]);
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ import { ScenarioMockApi } from "@azure-tools/cadl-ranch-api";

export const Scenarios: Record<string, ScenarioMockApi> = {};
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 };
}),
]);
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ import { ScenarioMockApi } from "@azure-tools/cadl-ranch-api";

export const Scenarios: Record<string, ScenarioMockApi> = {};
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 };
}),
]);