@typespec/http-specs 0.1.0-alpha.10-dev.0 → 0.1.0-alpha.10-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/specs/payload/pageable/mockapi.d.ts.map +1 -1
- package/dist/specs/payload/pageable/mockapi.js +80 -18
- package/dist/specs/payload/pageable/mockapi.js.map +1 -1
- package/dist/specs/routes/mockapi.js +15 -15
- package/dist/specs/routes/mockapi.js.map +1 -1
- package/package.json +3 -2
- package/spec-summary.md +159 -5
- package/specs/payload/pageable/main.tsp +164 -0
- package/specs/payload/pageable/mockapi.ts +102 -18
- package/specs/routes/main.tsp +5 -5
- package/specs/routes/mockapi.ts +15 -15
- package/temp/.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockapi.d.ts","sourceRoot":"","sources":["../../../../specs/payload/pageable/mockapi.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"mockapi.d.ts","sourceRoot":"","sources":["../../../../specs/payload/pageable/mockapi.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,eAAe,EAEhB,MAAM,oBAAoB,CAAC;AAE5B,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAM,CAAC"}
|
|
@@ -1,5 +1,73 @@
|
|
|
1
|
-
import { json, passOnSuccess } from "@typespec/spec-api";
|
|
1
|
+
import { json, passOnSuccess, ValidationError, } from "@typespec/spec-api";
|
|
2
2
|
export const Scenarios = {};
|
|
3
|
+
const FirstPage = [
|
|
4
|
+
{ id: "1", name: "dog" },
|
|
5
|
+
{ id: "2", name: "cat" },
|
|
6
|
+
];
|
|
7
|
+
const SecondPage = [
|
|
8
|
+
{ id: "3", name: "bird" },
|
|
9
|
+
{ id: "4", name: "fish" },
|
|
10
|
+
];
|
|
11
|
+
const FirstResponseTokenInBody = {
|
|
12
|
+
status: 200,
|
|
13
|
+
body: json({
|
|
14
|
+
pets: FirstPage,
|
|
15
|
+
nextToken: "page2",
|
|
16
|
+
}),
|
|
17
|
+
};
|
|
18
|
+
const SecondResponse = {
|
|
19
|
+
status: 200,
|
|
20
|
+
body: json({
|
|
21
|
+
pets: SecondPage,
|
|
22
|
+
}),
|
|
23
|
+
};
|
|
24
|
+
const FirstResponseTokenInHeader = {
|
|
25
|
+
status: 200,
|
|
26
|
+
body: json({
|
|
27
|
+
pets: FirstPage,
|
|
28
|
+
}),
|
|
29
|
+
headers: {
|
|
30
|
+
"next-token": "page2",
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
const RequestTokenInQuery = {
|
|
34
|
+
params: { token: "page2" },
|
|
35
|
+
};
|
|
36
|
+
const RequestTokenInHeader = { headers: { token: "page2" } };
|
|
37
|
+
function createTests(reqInfo, resInfo) {
|
|
38
|
+
const uri = `/payload/pageable/server-driven-pagination/continuationtoken/request-${reqInfo}-response-${resInfo}`;
|
|
39
|
+
function createHandler() {
|
|
40
|
+
return (req) => {
|
|
41
|
+
const token = reqInfo === "header" ? req.headers?.token : req.query?.token;
|
|
42
|
+
switch (token) {
|
|
43
|
+
case undefined:
|
|
44
|
+
return resInfo === "header" ? FirstResponseTokenInHeader : FirstResponseTokenInBody;
|
|
45
|
+
case "page2":
|
|
46
|
+
return SecondResponse;
|
|
47
|
+
default:
|
|
48
|
+
throw new ValidationError("Unsupported continuation token", `"undefined" | "page2"`, token);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return passOnSuccess([
|
|
53
|
+
{
|
|
54
|
+
uri: uri,
|
|
55
|
+
method: "get",
|
|
56
|
+
request: {},
|
|
57
|
+
response: resInfo === "header" ? FirstResponseTokenInHeader : FirstResponseTokenInBody,
|
|
58
|
+
handler: createHandler(),
|
|
59
|
+
kind: "MockApiDefinition",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
uri: uri,
|
|
63
|
+
method: "get",
|
|
64
|
+
request: reqInfo === "header" ? RequestTokenInHeader : RequestTokenInQuery,
|
|
65
|
+
response: SecondResponse,
|
|
66
|
+
handler: createHandler(),
|
|
67
|
+
kind: "MockApiDefinition",
|
|
68
|
+
},
|
|
69
|
+
]);
|
|
70
|
+
}
|
|
3
71
|
Scenarios.Payload_Pageable_ServerDrivenPagination_link = passOnSuccess([
|
|
4
72
|
{
|
|
5
73
|
uri: "/payload/pageable/server-driven-pagination/link",
|
|
@@ -8,10 +76,7 @@ Scenarios.Payload_Pageable_ServerDrivenPagination_link = passOnSuccess([
|
|
|
8
76
|
response: {
|
|
9
77
|
status: 200,
|
|
10
78
|
body: json({
|
|
11
|
-
pets:
|
|
12
|
-
{ id: "1", name: "dog" },
|
|
13
|
-
{ id: "2", name: "cat" },
|
|
14
|
-
],
|
|
79
|
+
pets: FirstPage,
|
|
15
80
|
next: "/payload/pageable/server-driven-pagination/link/nextPage",
|
|
16
81
|
}),
|
|
17
82
|
},
|
|
@@ -19,10 +84,7 @@ Scenarios.Payload_Pageable_ServerDrivenPagination_link = passOnSuccess([
|
|
|
19
84
|
return {
|
|
20
85
|
status: 200,
|
|
21
86
|
body: json({
|
|
22
|
-
pets:
|
|
23
|
-
{ id: "1", name: "dog" },
|
|
24
|
-
{ id: "2", name: "cat" },
|
|
25
|
-
],
|
|
87
|
+
pets: FirstPage,
|
|
26
88
|
next: `${req.baseUrl}/payload/pageable/server-driven-pagination/link/nextPage`,
|
|
27
89
|
}),
|
|
28
90
|
};
|
|
@@ -33,16 +95,16 @@ Scenarios.Payload_Pageable_ServerDrivenPagination_link = passOnSuccess([
|
|
|
33
95
|
uri: "/payload/pageable/server-driven-pagination/link/nextPage",
|
|
34
96
|
method: "get",
|
|
35
97
|
request: {},
|
|
36
|
-
response:
|
|
37
|
-
status: 200,
|
|
38
|
-
body: json({
|
|
39
|
-
pets: [
|
|
40
|
-
{ id: "3", name: "bird" },
|
|
41
|
-
{ id: "4", name: "fish" },
|
|
42
|
-
],
|
|
43
|
-
}),
|
|
44
|
-
},
|
|
98
|
+
response: SecondResponse,
|
|
45
99
|
kind: "MockApiDefinition",
|
|
46
100
|
},
|
|
47
101
|
]);
|
|
102
|
+
Scenarios.Payload_Pageable_ServerDrivenPagination_ContinuationToken_requestQueryResponseBody =
|
|
103
|
+
createTests("query", "body");
|
|
104
|
+
Scenarios.Payload_Pageable_ServerDrivenPagination_ContinuationToken_requestHeaderResponseBody =
|
|
105
|
+
createTests("header", "body");
|
|
106
|
+
Scenarios.Payload_Pageable_ServerDrivenPagination_ContinuationToken_requestQueryResponseHeader =
|
|
107
|
+
createTests("query", "header");
|
|
108
|
+
Scenarios.Payload_Pageable_ServerDrivenPagination_ContinuationToken_requestHeaderResponseHeader =
|
|
109
|
+
createTests("header", "header");
|
|
48
110
|
//# sourceMappingURL=mockapi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockapi.js","sourceRoot":"","sources":["../../../../specs/payload/pageable/mockapi.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"mockapi.js","sourceRoot":"","sources":["../../../../specs/payload/pageable/mockapi.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAEJ,aAAa,EAEb,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,CAAC,MAAM,SAAS,GAAoC,EAAE,CAAC;AAE7D,MAAM,SAAS,GAAG;IAChB,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE;IACxB,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE;CACzB,CAAC;AAEF,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE;IACzB,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE;CAC1B,CAAC;AAEF,MAAM,wBAAwB,GAAG;IAC/B,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,IAAI,CA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,EAAE,MAAM,CAAC,CAAC;AAEhC,SAAS,CAAC,oFAAoF;IAC5F,WAAW,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AACjC,SAAS,CAAC,qFAAqF;IAC7F,WAAW,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC"}
|
|
@@ -55,27 +55,27 @@ Scenarios.Routes_PathParameters_ReservedExpansion_annotation = createTests("/rou
|
|
|
55
55
|
Scenarios.Routes_PathParameters_SimpleExpansion_Standard_primitive = createTests("/routes/path/simple/standard/primitivea");
|
|
56
56
|
Scenarios.Routes_PathParameters_SimpleExpansion_Standard_array = createTests("/routes/path/simple/standard/arraya,b");
|
|
57
57
|
Scenarios.Routes_PathParameters_SimpleExpansion_Standard_record = createTests("/routes/path/simple/standard/recorda,1,b,2");
|
|
58
|
-
Scenarios.Routes_PathParameters_SimpleExpansion_Explode_primitive = createTests("/routes/path/simple/
|
|
59
|
-
Scenarios.Routes_PathParameters_SimpleExpansion_Explode_array = createTests("/routes/path/simple/
|
|
60
|
-
Scenarios.Routes_PathParameters_SimpleExpansion_Explode_record = createTests("/routes/path/simple/
|
|
58
|
+
Scenarios.Routes_PathParameters_SimpleExpansion_Explode_primitive = createTests("/routes/path/simple/explode/primitivea");
|
|
59
|
+
Scenarios.Routes_PathParameters_SimpleExpansion_Explode_array = createTests("/routes/path/simple/explode/arraya,b");
|
|
60
|
+
Scenarios.Routes_PathParameters_SimpleExpansion_Explode_record = createTests("/routes/path/simple/explode/recorda=1,b=2");
|
|
61
61
|
Scenarios.Routes_PathParameters_PathExpansion_Standard_primitive = createTests("/routes/path/path/standard/primitive/a");
|
|
62
62
|
Scenarios.Routes_PathParameters_PathExpansion_Standard_array = createTests("/routes/path/path/standard/array/a,b");
|
|
63
63
|
Scenarios.Routes_PathParameters_PathExpansion_Standard_record = createTests("/routes/path/path/standard/record/a,1,b,2");
|
|
64
|
-
Scenarios.Routes_PathParameters_PathExpansion_Explode_primitive = createTests("/routes/path/path/
|
|
65
|
-
Scenarios.Routes_PathParameters_PathExpansion_Explode_array = createTests("/routes/path/path/
|
|
66
|
-
Scenarios.Routes_PathParameters_PathExpansion_Explode_record = createTests("/routes/path/path/
|
|
64
|
+
Scenarios.Routes_PathParameters_PathExpansion_Explode_primitive = createTests("/routes/path/path/explode/primitive/a");
|
|
65
|
+
Scenarios.Routes_PathParameters_PathExpansion_Explode_array = createTests("/routes/path/path/explode/array/a/b");
|
|
66
|
+
Scenarios.Routes_PathParameters_PathExpansion_Explode_record = createTests("/routes/path/path/explode/record/a=1/b=2");
|
|
67
67
|
Scenarios.Routes_PathParameters_LabelExpansion_Standard_primitive = createTests("/routes/path/label/standard/primitive.a");
|
|
68
68
|
Scenarios.Routes_PathParameters_LabelExpansion_Standard_array = createTests("/routes/path/label/standard/array.a,b");
|
|
69
69
|
Scenarios.Routes_PathParameters_LabelExpansion_Standard_record = createTests("/routes/path/label/standard/record.a,1,b,2");
|
|
70
|
-
Scenarios.Routes_PathParameters_LabelExpansion_Explode_primitive = createTests("/routes/path/label/
|
|
71
|
-
Scenarios.Routes_PathParameters_LabelExpansion_Explode_array = createTests("/routes/path/label/
|
|
72
|
-
Scenarios.Routes_PathParameters_LabelExpansion_Explode_record = createTests("/routes/path/label/
|
|
73
|
-
Scenarios.Routes_PathParameters_MatrixExpansion_Standard_primitive = createTests("/routes/path/matrix/standard/primitive;a");
|
|
74
|
-
Scenarios.Routes_PathParameters_MatrixExpansion_Standard_array = createTests("/routes/path/matrix/standard/array;a,b");
|
|
75
|
-
Scenarios.Routes_PathParameters_MatrixExpansion_Standard_record = createTests("/routes/path/matrix/standard/record;a,1,b,2");
|
|
76
|
-
Scenarios.Routes_PathParameters_MatrixExpansion_Explode_primitive = createTests("/routes/path/matrix/
|
|
77
|
-
Scenarios.Routes_PathParameters_MatrixExpansion_Explode_array = createTests("/routes/path/matrix/
|
|
78
|
-
Scenarios.Routes_PathParameters_MatrixExpansion_Explode_record = createTests("/routes/path/matrix/
|
|
70
|
+
Scenarios.Routes_PathParameters_LabelExpansion_Explode_primitive = createTests("/routes/path/label/explode/primitive.a");
|
|
71
|
+
Scenarios.Routes_PathParameters_LabelExpansion_Explode_array = createTests("/routes/path/label/explode/array.a.b");
|
|
72
|
+
Scenarios.Routes_PathParameters_LabelExpansion_Explode_record = createTests("/routes/path/label/explode/record.a=1.b=2");
|
|
73
|
+
Scenarios.Routes_PathParameters_MatrixExpansion_Standard_primitive = createTests("/routes/path/matrix/standard/primitive;param=a");
|
|
74
|
+
Scenarios.Routes_PathParameters_MatrixExpansion_Standard_array = createTests("/routes/path/matrix/standard/array;param=a,b");
|
|
75
|
+
Scenarios.Routes_PathParameters_MatrixExpansion_Standard_record = createTests("/routes/path/matrix/standard/record;param=a,1,b,2");
|
|
76
|
+
Scenarios.Routes_PathParameters_MatrixExpansion_Explode_primitive = createTests("/routes/path/matrix/explode/primitive;param=a");
|
|
77
|
+
Scenarios.Routes_PathParameters_MatrixExpansion_Explode_array = createTests("/routes/path/matrix/explode/array;param=a;param=b");
|
|
78
|
+
Scenarios.Routes_PathParameters_MatrixExpansion_Explode_record = createTests("/routes/path/matrix/explode/record;a=1;b=2");
|
|
79
79
|
Scenarios.Routes_QueryParameters_templateOnly = createTests("/routes/query/template-only?param=a");
|
|
80
80
|
Scenarios.Routes_QueryParameters_explicit = createTests("/routes/query/explicit?param=a");
|
|
81
81
|
Scenarios.Routes_QueryParameters_annotationOnly = createTests("/routes/query/annotation-only?param=a");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockapi.js","sourceRoot":"","sources":["../../../specs/routes/mockapi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,aAAa,EAAmB,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAElG,MAAM,CAAC,MAAM,SAAS,GAAoC,EAAE,CAAC;AAE7D,SAAS,WAAW,CAAC,GAAW;IAC9B,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,oBAAoB,GAAG,GAAG,CAAC,CAAC;IAChD,M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
|
"name": "@typespec/http-specs",
|
|
3
|
-
"version": "0.1.0-alpha.10-dev.
|
|
3
|
+
"version": "0.1.0-alpha.10-dev.2",
|
|
4
4
|
"description": "Spec scenarios and mock apis",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"typescript": "~5.7.3"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@typespec/compiler": "~0.65.
|
|
34
|
+
"@typespec/compiler": "~0.65.3 || >=0.66.0-dev <0.66.0",
|
|
35
35
|
"@typespec/http": "~0.65.0 || >=0.66.0-dev <0.66.0",
|
|
36
36
|
"@typespec/rest": "~0.65.0 || >=0.66.0-dev <0.66.0",
|
|
37
37
|
"@typespec/versioning": "~0.65.0 || >=0.66.0-dev <0.66.0",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"build": "tsc -p ./tsconfig.build.json",
|
|
43
43
|
"clean": "rimraf dist/ temp/",
|
|
44
44
|
"test:e2e": "pnpm validate-scenarios && pnpm validate-mock-apis && pnpm validate-client-server",
|
|
45
|
+
"validate:all": "pnpm build && pnpm regen-docs && pnpm test:e2e",
|
|
45
46
|
"validate-scenarios": "tsp-spector validate-scenarios ./specs",
|
|
46
47
|
"generate-scenarios-summary": "tsp-spector generate-scenarios-summary ./specs",
|
|
47
48
|
"regen-docs": "pnpm generate-scenarios-summary",
|
package/spec-summary.md
CHANGED
|
@@ -1661,6 +1661,160 @@ Content-Type: application/octet-stream
|
|
|
1661
1661
|
--abcde12345--
|
|
1662
1662
|
```
|
|
1663
1663
|
|
|
1664
|
+
### Payload_Pageable_ServerDrivenPagination_ContinuationToken_requestHeaderResponseBody
|
|
1665
|
+
|
|
1666
|
+
- Endpoint: `get /payload/pageable/server-driven-pagination/continuationtoken/request-header-response-body`
|
|
1667
|
+
|
|
1668
|
+
Test case for using continuation token as pagination. Continuation token is passed in the request header and response body.
|
|
1669
|
+
|
|
1670
|
+
Two requests need to be tested.
|
|
1671
|
+
|
|
1672
|
+
1. Initial request:
|
|
1673
|
+
Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-header-response-body
|
|
1674
|
+
|
|
1675
|
+
Expected response body:
|
|
1676
|
+
|
|
1677
|
+
```json
|
|
1678
|
+
{
|
|
1679
|
+
"pets": [
|
|
1680
|
+
{ "id": "1", "name": "dog" },
|
|
1681
|
+
{ "id": "2", "name": "cat" }
|
|
1682
|
+
],
|
|
1683
|
+
"nextToken": "page2"
|
|
1684
|
+
}
|
|
1685
|
+
```
|
|
1686
|
+
|
|
1687
|
+
2. Next page request:
|
|
1688
|
+
Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-header-response-body
|
|
1689
|
+
|
|
1690
|
+
Expected header:
|
|
1691
|
+
token=page2
|
|
1692
|
+
|
|
1693
|
+
Expected response body:
|
|
1694
|
+
|
|
1695
|
+
```json
|
|
1696
|
+
{
|
|
1697
|
+
"pets": [
|
|
1698
|
+
{ "id": "3", "name": "bird" },
|
|
1699
|
+
{ "id": "4", "name": "fish" }
|
|
1700
|
+
]
|
|
1701
|
+
}
|
|
1702
|
+
```
|
|
1703
|
+
|
|
1704
|
+
### Payload_Pageable_ServerDrivenPagination_ContinuationToken_requestHeaderResponseHeader
|
|
1705
|
+
|
|
1706
|
+
- Endpoint: `get /payload/pageable/server-driven-pagination/continuationtoken/request-header-response-header`
|
|
1707
|
+
|
|
1708
|
+
Test case for using continuation token as pagination. Continuation token is passed in the request header and response header.
|
|
1709
|
+
|
|
1710
|
+
Two requests need to be tested.
|
|
1711
|
+
|
|
1712
|
+
1. Initial request:
|
|
1713
|
+
Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-header-response-header
|
|
1714
|
+
Expected response body:
|
|
1715
|
+
|
|
1716
|
+
```json
|
|
1717
|
+
{
|
|
1718
|
+
"pets": [
|
|
1719
|
+
{ "id": "1", "name": "dog" },
|
|
1720
|
+
{ "id": "2", "name": "cat" }
|
|
1721
|
+
]
|
|
1722
|
+
}
|
|
1723
|
+
```
|
|
1724
|
+
|
|
1725
|
+
Expected response header:
|
|
1726
|
+
next-token=page2
|
|
1727
|
+
|
|
1728
|
+
2. Next page request:
|
|
1729
|
+
Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-header-response-header
|
|
1730
|
+
|
|
1731
|
+
Expected request header:
|
|
1732
|
+
token=page2
|
|
1733
|
+
|
|
1734
|
+
Expected response body:
|
|
1735
|
+
|
|
1736
|
+
```json
|
|
1737
|
+
{
|
|
1738
|
+
"pets": [
|
|
1739
|
+
{ "id": "3", "name": "bird" },
|
|
1740
|
+
{ "id": "4", "name": "fish" }
|
|
1741
|
+
]
|
|
1742
|
+
}
|
|
1743
|
+
```
|
|
1744
|
+
|
|
1745
|
+
### Payload_Pageable_ServerDrivenPagination_ContinuationToken_requestQueryResponseBody
|
|
1746
|
+
|
|
1747
|
+
- Endpoint: `get /payload/pageable/server-driven-pagination/continuationtoken/request-query-response-body`
|
|
1748
|
+
|
|
1749
|
+
Test case for using continuation token as pagination. Continuation token is passed in the request query and response body.
|
|
1750
|
+
|
|
1751
|
+
Two requests need to be tested.
|
|
1752
|
+
|
|
1753
|
+
1. Initial request:
|
|
1754
|
+
Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-query-response-body
|
|
1755
|
+
Expected response body:
|
|
1756
|
+
|
|
1757
|
+
```json
|
|
1758
|
+
{
|
|
1759
|
+
"pets": [
|
|
1760
|
+
{ "id": "1", "name": "dog" },
|
|
1761
|
+
{ "id": "2", "name": "cat" }
|
|
1762
|
+
],
|
|
1763
|
+
"nextToken": "page2"
|
|
1764
|
+
}
|
|
1765
|
+
```
|
|
1766
|
+
|
|
1767
|
+
2. Next page request:
|
|
1768
|
+
Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-query-response-body?token=page2
|
|
1769
|
+
|
|
1770
|
+
Expected response body:
|
|
1771
|
+
|
|
1772
|
+
```json
|
|
1773
|
+
{
|
|
1774
|
+
"pets": [
|
|
1775
|
+
{ "id": "3", "name": "bird" },
|
|
1776
|
+
{ "id": "4", "name": "fish" }
|
|
1777
|
+
]
|
|
1778
|
+
}
|
|
1779
|
+
```
|
|
1780
|
+
|
|
1781
|
+
### Payload_Pageable_ServerDrivenPagination_ContinuationToken_requestQueryResponseHeader
|
|
1782
|
+
|
|
1783
|
+
- Endpoint: `get /payload/pageable/server-driven-pagination/continuationtoken/request-query-response-header`
|
|
1784
|
+
|
|
1785
|
+
Test case for using continuation token as pagination. Continuation token is passed in the request query and response header.
|
|
1786
|
+
|
|
1787
|
+
Two requests need to be tested.
|
|
1788
|
+
|
|
1789
|
+
1. Initial request:
|
|
1790
|
+
Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-query-response-header
|
|
1791
|
+
Expected response body:
|
|
1792
|
+
|
|
1793
|
+
```json
|
|
1794
|
+
{
|
|
1795
|
+
"pets": [
|
|
1796
|
+
{ "id": "1", "name": "dog" },
|
|
1797
|
+
{ "id": "2", "name": "cat" }
|
|
1798
|
+
]
|
|
1799
|
+
}
|
|
1800
|
+
```
|
|
1801
|
+
|
|
1802
|
+
Expected response header:
|
|
1803
|
+
next-token=page2
|
|
1804
|
+
|
|
1805
|
+
2. Next page request:
|
|
1806
|
+
Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-query-response-header?token=page2
|
|
1807
|
+
Expected response body:
|
|
1808
|
+
|
|
1809
|
+
```json
|
|
1810
|
+
{
|
|
1811
|
+
"pets": [
|
|
1812
|
+
{ "id": "3", "name": "bird" },
|
|
1813
|
+
{ "id": "4", "name": "fish" }
|
|
1814
|
+
]
|
|
1815
|
+
}
|
|
1816
|
+
```
|
|
1817
|
+
|
|
1664
1818
|
### Payload_Pageable_ServerDrivenPagination_link
|
|
1665
1819
|
|
|
1666
1820
|
- Endpoint: `get /payload/pageable/server-driven-pagination/link`
|
|
@@ -2200,7 +2354,7 @@ Expected path: /routes/path/label/standard/record.a,1,b,2
|
|
|
2200
2354
|
|
|
2201
2355
|
Test matrix expansion with explode: true when passed an array value.
|
|
2202
2356
|
Param value: ["a","b"]
|
|
2203
|
-
Expected path: /routes/path/matrix/explode/array;a
|
|
2357
|
+
Expected path: /routes/path/matrix/explode/array;param=a;param=b
|
|
2204
2358
|
|
|
2205
2359
|
### Routes_PathParameters_MatrixExpansion_Explode_primitive
|
|
2206
2360
|
|
|
@@ -2208,7 +2362,7 @@ Expected path: /routes/path/matrix/explode/array;a.b
|
|
|
2208
2362
|
|
|
2209
2363
|
Test matrix expansion with explode: true when passed a primitive value.
|
|
2210
2364
|
Param value: "a"
|
|
2211
|
-
Expected path: /routes/path/matrix/explode/primitive;a
|
|
2365
|
+
Expected path: /routes/path/matrix/explode/primitive;param=a
|
|
2212
2366
|
|
|
2213
2367
|
### Routes_PathParameters_MatrixExpansion_Explode_record
|
|
2214
2368
|
|
|
@@ -2224,7 +2378,7 @@ Expected path: /routes/path/matrix/explode/record;a=1;b=2
|
|
|
2224
2378
|
|
|
2225
2379
|
Test matrix expansion with explode: false when passed an array value.
|
|
2226
2380
|
Param value: ["a","b"]
|
|
2227
|
-
Expected path: /routes/path/matrix/standard/array;a
|
|
2381
|
+
Expected path: /routes/path/matrix/standard/array;param=a;param=b
|
|
2228
2382
|
|
|
2229
2383
|
### Routes_PathParameters_MatrixExpansion_Standard_primitive
|
|
2230
2384
|
|
|
@@ -2232,7 +2386,7 @@ Expected path: /routes/path/matrix/standard/array;a,b
|
|
|
2232
2386
|
|
|
2233
2387
|
Test matrix expansion with explode: false when passed a primitive value.
|
|
2234
2388
|
Param value: "a"
|
|
2235
|
-
Expected path: /routes/path/matrix/standard/primitive;a
|
|
2389
|
+
Expected path: /routes/path/matrix/standard/primitive;param=a
|
|
2236
2390
|
|
|
2237
2391
|
### Routes_PathParameters_MatrixExpansion_Standard_record
|
|
2238
2392
|
|
|
@@ -2240,7 +2394,7 @@ Expected path: /routes/path/matrix/standard/primitive;a
|
|
|
2240
2394
|
|
|
2241
2395
|
Test matrix expansion with explode: false when passed a record value.
|
|
2242
2396
|
Param value: {a: 1, b: 2}
|
|
2243
|
-
Expected path: /routes/path/matrix/standard/record;a
|
|
2397
|
+
Expected path: /routes/path/matrix/standard/record;a=1;b=2
|
|
2244
2398
|
|
|
2245
2399
|
### Routes_PathParameters_PathExpansion_Explode_array
|
|
2246
2400
|
|
|
@@ -52,4 +52,168 @@ namespace ServerDrivenPagination {
|
|
|
52
52
|
|
|
53
53
|
@nextLink next?: url;
|
|
54
54
|
};
|
|
55
|
+
|
|
56
|
+
@route("/continuationtoken")
|
|
57
|
+
namespace ContinuationToken {
|
|
58
|
+
@scenario
|
|
59
|
+
@scenarioDoc("""
|
|
60
|
+
Test case for using continuation token as pagination. Continuation token is passed in the request query and response body.
|
|
61
|
+
|
|
62
|
+
Two requests need to be tested.
|
|
63
|
+
1. Initial request:
|
|
64
|
+
Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-query-response-body
|
|
65
|
+
Expected response body:
|
|
66
|
+
```json
|
|
67
|
+
{ "pets": [
|
|
68
|
+
{ "id": "1", "name": "dog" },
|
|
69
|
+
{ "id": "2", "name": "cat" }
|
|
70
|
+
],
|
|
71
|
+
"nextToken": "page2"
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
2. Next page request:
|
|
76
|
+
Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-query-response-body?token=page2
|
|
77
|
+
|
|
78
|
+
Expected response body:
|
|
79
|
+
```json
|
|
80
|
+
{ "pets": [
|
|
81
|
+
{ "id": "3", "name": "bird" },
|
|
82
|
+
{ "id": "4", "name": "fish" }
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
""")
|
|
87
|
+
@route("/request-query-response-body")
|
|
88
|
+
@list
|
|
89
|
+
op requestQueryResponseBody(@continuationToken @query token?: string): {
|
|
90
|
+
@pageItems
|
|
91
|
+
pets: Pet[];
|
|
92
|
+
|
|
93
|
+
@continuationToken nextToken?: string;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
@scenario
|
|
97
|
+
@scenarioDoc("""
|
|
98
|
+
Test case for using continuation token as pagination. Continuation token is passed in the request header and response body.
|
|
99
|
+
|
|
100
|
+
Two requests need to be tested.
|
|
101
|
+
1. Initial request:
|
|
102
|
+
Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-header-response-body
|
|
103
|
+
|
|
104
|
+
Expected response body:
|
|
105
|
+
```json
|
|
106
|
+
{ "pets": [
|
|
107
|
+
{ "id": "1", "name": "dog" },
|
|
108
|
+
{ "id": "2", "name": "cat" }
|
|
109
|
+
],
|
|
110
|
+
"nextToken": "page2"
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
2. Next page request:
|
|
114
|
+
Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-header-response-body
|
|
115
|
+
|
|
116
|
+
Expected header:
|
|
117
|
+
token=page2
|
|
118
|
+
|
|
119
|
+
Expected response body:
|
|
120
|
+
```json
|
|
121
|
+
{ "pets": [
|
|
122
|
+
{ "id": "3", "name": "bird" },
|
|
123
|
+
{ "id": "4", "name": "fish" }
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
""")
|
|
128
|
+
@route("/request-header-response-body")
|
|
129
|
+
@list
|
|
130
|
+
op requestHeaderResponseBody(@continuationToken @header token?: string): {
|
|
131
|
+
@pageItems
|
|
132
|
+
pets: Pet[];
|
|
133
|
+
|
|
134
|
+
@continuationToken nextToken?: string;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
@scenario
|
|
138
|
+
@scenarioDoc("""
|
|
139
|
+
Test case for using continuation token as pagination. Continuation token is passed in the request query and response header.
|
|
140
|
+
|
|
141
|
+
Two requests need to be tested.
|
|
142
|
+
1. Initial request:
|
|
143
|
+
Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-query-response-header
|
|
144
|
+
Expected response body:
|
|
145
|
+
```json
|
|
146
|
+
{ "pets": [
|
|
147
|
+
{ "id": "1", "name": "dog" },
|
|
148
|
+
{ "id": "2", "name": "cat" }
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Expected response header:
|
|
154
|
+
next-token=page2
|
|
155
|
+
|
|
156
|
+
2. Next page request:
|
|
157
|
+
Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-query-response-header?token=page2
|
|
158
|
+
Expected response body:
|
|
159
|
+
```json
|
|
160
|
+
{ "pets": [
|
|
161
|
+
{ "id": "3", "name": "bird" },
|
|
162
|
+
{ "id": "4", "name": "fish" }
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
""")
|
|
167
|
+
@route("/request-query-response-header")
|
|
168
|
+
@list
|
|
169
|
+
op requestQueryResponseHeader(@continuationToken @query token?: string): {
|
|
170
|
+
@pageItems
|
|
171
|
+
pets: Pet[];
|
|
172
|
+
|
|
173
|
+
@continuationToken @header nextToken?: string;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
@scenario
|
|
177
|
+
@scenarioDoc("""
|
|
178
|
+
Test case for using continuation token as pagination. Continuation token is passed in the request header and response header.
|
|
179
|
+
|
|
180
|
+
Two requests need to be tested.
|
|
181
|
+
1. Initial request:
|
|
182
|
+
Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-header-response-header
|
|
183
|
+
Expected response body:
|
|
184
|
+
```json
|
|
185
|
+
{ "pets": [
|
|
186
|
+
{ "id": "1", "name": "dog" },
|
|
187
|
+
{ "id": "2", "name": "cat" }
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Expected response header:
|
|
193
|
+
next-token=page2
|
|
194
|
+
|
|
195
|
+
2. Next page request:
|
|
196
|
+
Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-header-response-header
|
|
197
|
+
|
|
198
|
+
Expected request header:
|
|
199
|
+
token=page2
|
|
200
|
+
|
|
201
|
+
Expected response body:
|
|
202
|
+
```json
|
|
203
|
+
{ "pets": [
|
|
204
|
+
{ "id": "3", "name": "bird" },
|
|
205
|
+
{ "id": "4", "name": "fish" }
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
""")
|
|
210
|
+
@route("/request-header-response-header")
|
|
211
|
+
@list
|
|
212
|
+
op requestHeaderResponseHeader(@continuationToken @header token?: string): {
|
|
213
|
+
@pageItems
|
|
214
|
+
pets: Pet[];
|
|
215
|
+
|
|
216
|
+
@continuationToken @header nextToken?: string;
|
|
217
|
+
};
|
|
218
|
+
}
|
|
55
219
|
}
|