зеркало из https://github.com/Azure/cadl-ranch.git
Revert "Add Test in Versioning/Removed" (#737)
* Revert "Add Test in Versioning/Removed (#627)"
This reverts commit 92f3c4df3e
.
* update
---------
Co-authored-by: Pan Shao <pashao@microsoft.com>
This commit is contained in:
Родитель
4b31d3ae34
Коммит
73a096b408
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@azure-tools/cadl-ranch-specs": patch
|
||||
---
|
||||
|
||||
Revert the change for version remove
|
|
@ -9109,49 +9109,6 @@ Expected request body:
|
|||
{ "prop": "foo" }
|
||||
```
|
||||
|
||||
### Versioning_Removed_modelV3
|
||||
|
||||
- Endpoint: `post /versioning/removed/api-version:{version}/v3`
|
||||
|
||||
path: "/versioning/removed/api-version:v1/v3"
|
||||
Expected request body:
|
||||
|
||||
```json
|
||||
{ "id": "123", "enumProp": "enumMemberV1" }
|
||||
```
|
||||
|
||||
Expected response body:
|
||||
|
||||
```json
|
||||
{ "id": "123", "enumProp": "enumMemberV1" }
|
||||
```
|
||||
|
||||
path: "/versioning/removed/api-version:v2/v3"
|
||||
Expected request body:
|
||||
|
||||
```json
|
||||
{ "id": "123", "enumProp": "enumMemberV1" }
|
||||
```
|
||||
|
||||
Expected response body:
|
||||
|
||||
```json
|
||||
{ "id": "123", "enumProp": "enumMemberV1" }
|
||||
```
|
||||
|
||||
path: "/versioning/removed/api-version:v2preview/v3"
|
||||
Expected request body:
|
||||
|
||||
```json
|
||||
{ "id": "123", "enumProp": "enumMemberV2Preview" }
|
||||
```
|
||||
|
||||
Expected response body:
|
||||
|
||||
```json
|
||||
{ "id": "123", "enumProp": "enumMemberV2Preview" }
|
||||
```
|
||||
|
||||
### Versioning_Removed_v2
|
||||
|
||||
- Endpoint: `post /versioning/removed/api-version:{version}/v2`
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
import "@typespec/http";
|
||||
import "@azure-tools/cadl-ranch-expect";
|
||||
import "@typespec/versioning";
|
||||
import "@azure-tools/typespec-azure-core";
|
||||
|
||||
using TypeSpec.Http;
|
||||
using TypeSpec.Versioning;
|
||||
using TypeSpec.Rest;
|
||||
|
||||
/**
|
||||
* Test for the `@removed` decorator.
|
||||
|
@ -22,7 +20,7 @@ using TypeSpec.Rest;
|
|||
endpoint: url,
|
||||
|
||||
/**
|
||||
* Need to be set as 'v1', 'v2preview' or 'v2' in client.
|
||||
* Need to be set as 'v1' or 'v2' in client.
|
||||
*/
|
||||
version: Versions,
|
||||
}
|
||||
|
@ -34,17 +32,12 @@ namespace Versioning.Removed;
|
|||
*/
|
||||
enum Versions {
|
||||
/**
|
||||
* The original version v1.
|
||||
* The version v1.
|
||||
*/
|
||||
v1: "v1",
|
||||
|
||||
/**
|
||||
* The V2 Preview version.
|
||||
*/
|
||||
v2preview: "v2preview",
|
||||
|
||||
/**
|
||||
* The latest version v2.
|
||||
* The version v2.
|
||||
*/
|
||||
v2: "v2",
|
||||
}
|
||||
|
@ -73,14 +66,6 @@ model ModelV2 {
|
|||
unionProp: UnionV2;
|
||||
}
|
||||
|
||||
model ModelV3 {
|
||||
id: string;
|
||||
|
||||
@removed(Versions.v2preview)
|
||||
@added(Versions.v2)
|
||||
enumProp: EnumV3;
|
||||
}
|
||||
|
||||
enum EnumV2 {
|
||||
@removed(Versions.v2)
|
||||
enumMemberV1,
|
||||
|
@ -88,14 +73,6 @@ enum EnumV2 {
|
|||
enumMemberV2,
|
||||
}
|
||||
|
||||
enum EnumV3 {
|
||||
@removed(Versions.v2preview)
|
||||
@added(Versions.v2)
|
||||
enumMemberV1,
|
||||
|
||||
enumMemberV2Preview,
|
||||
}
|
||||
|
||||
@removed(Versions.v2)
|
||||
union UnionV1 {
|
||||
string,
|
||||
|
@ -146,45 +123,3 @@ interface InterfaceV1 {
|
|||
@route("/v1")
|
||||
v1InInterface(@body body: ModelV1): ModelV1;
|
||||
}
|
||||
|
||||
/** This operation should be generated with the signatures of both the latest and the original versions, rather than preview version */
|
||||
@scenario
|
||||
@scenarioDoc("""
|
||||
path: "/versioning/removed/api-version:v1/v3"
|
||||
Expected request body:
|
||||
```json
|
||||
{ "id": "123", "enumProp": "enumMemberV1" }
|
||||
```
|
||||
|
||||
Expected response body:
|
||||
```json
|
||||
{ "id": "123", "enumProp": "enumMemberV1" }
|
||||
```
|
||||
|
||||
path: "/versioning/removed/api-version:v2/v3"
|
||||
Expected request body:
|
||||
```json
|
||||
{ "id": "123", "enumProp": "enumMemberV1" }
|
||||
```
|
||||
|
||||
Expected response body:
|
||||
```json
|
||||
{ "id": "123", "enumProp": "enumMemberV1" }
|
||||
```
|
||||
|
||||
|
||||
path: "/versioning/removed/api-version:v2preview/v3"
|
||||
Expected request body:
|
||||
```json
|
||||
{ "id": "123", "enumProp": "enumMemberV2Preview" }
|
||||
```
|
||||
|
||||
Expected response body:
|
||||
```json
|
||||
{ "id": "123", "enumProp": "enumMemberV2Preview" }
|
||||
```
|
||||
|
||||
""")
|
||||
@post
|
||||
@route("/v3")
|
||||
op modelV3(@body body: ModelV3): ModelV3;
|
||||
|
|
|
@ -1,29 +1,8 @@
|
|||
import { mockapi, passOnSuccess, json } from "@azure-tools/cadl-ranch-api";
|
||||
import { passOnSuccess, mockapi, json } from "@azure-tools/cadl-ranch-api";
|
||||
import { ScenarioMockApi } from "@azure-tools/cadl-ranch-api";
|
||||
|
||||
export const Scenarios: Record<string, ScenarioMockApi> = {};
|
||||
|
||||
const pathsAndProperties = [
|
||||
{
|
||||
path: "/versioning/removed/api-version:v1/v3",
|
||||
expectedBody: { id: "123", enumProp: "enumMemberV1" },
|
||||
responseBody: { id: "123", enumProp: "enumMemberV1" },
|
||||
status: 200,
|
||||
},
|
||||
{
|
||||
path: "/versioning/removed/api-version:v2/v3",
|
||||
expectedBody: { id: "123", enumProp: "enumMemberV1" },
|
||||
responseBody: { id: "123", enumProp: "enumMemberV1" },
|
||||
status: 200,
|
||||
},
|
||||
{
|
||||
path: "/versioning/removed/api-version:v2preview/v3",
|
||||
expectedBody: { id: "123", enumProp: "enumMemberV2Preview" },
|
||||
responseBody: { id: "123", enumProp: "enumMemberV2Preview" },
|
||||
status: 200,
|
||||
},
|
||||
];
|
||||
|
||||
Scenarios.Versioning_Removed_v2 = passOnSuccess(
|
||||
mockapi.post("/versioning/removed/api-version:v2/v2", (req) => {
|
||||
req.expect.bodyEquals({ prop: "foo", enumProp: "enumMemberV2", unionProp: "bar" });
|
||||
|
@ -33,15 +12,3 @@ Scenarios.Versioning_Removed_v2 = passOnSuccess(
|
|||
};
|
||||
}),
|
||||
);
|
||||
|
||||
const mockHandlers = pathsAndProperties.map(({ path, expectedBody, responseBody, status }) =>
|
||||
mockapi.post(path, (req) => {
|
||||
req.expect.bodyEquals(expectedBody);
|
||||
return {
|
||||
status,
|
||||
body: json(responseBody),
|
||||
};
|
||||
}),
|
||||
);
|
||||
|
||||
Scenarios.Versioning_Removed_modelV3 = passOnSuccess(mockHandlers);
|
||||
|
|
Загрузка…
Ссылка в новой задаче