@done-coding/schema-api 0.0.1-alpha.0 → 0.0.1-alpha.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/README.md +6 -7
- package/es/index.mjs +30 -468
- package/es/reference.mjs +469 -0
- package/lib/index.cjs +1 -1
- package/lib/reference.cjs +1 -0
- package/package.json +6 -1
- package/schemas/common-error-codes.schema.json +24 -23
- package/schemas/cursor-list-request.schema.json +2 -3
- package/schemas/error-body.schema.json +1 -2
- package/schemas/list-reference-values.schema.json +23 -0
- package/schemas/paged-list-request.schema.json +4 -7
- package/schemas/paged-list.schema.json +4 -4
- package/schemas/service-error-codes.schema.json +2 -3
- package/types/index.d.ts +8 -158
- package/types/reference.d.ts +250 -0
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "common-error-codes.schema.json",
|
|
4
4
|
"title": "CommonErrorCodes",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "通用失败码表(参考资源):每个码给出 HTTP 状态(x-httpStatus),以及能否重试与是否已执行的参考值(x-referenceValue)。本表不约束任何结构:错误体不引用它,包不替使用方填写;使用方可显式引用表中值。$defs/code 列出全部通用失败码,须与 allOf 各项一一对应。",
|
|
6
|
+
"x-referenceResource": true,
|
|
6
7
|
"$defs": {
|
|
7
8
|
"code": {
|
|
8
9
|
"description": "通用失败码。",
|
|
@@ -33,8 +34,8 @@
|
|
|
33
34
|
"properties": {
|
|
34
35
|
"error": {
|
|
35
36
|
"properties": {
|
|
36
|
-
"retryable": { "
|
|
37
|
-
"outcome": { "
|
|
37
|
+
"retryable": { "x-referenceValue": false },
|
|
38
|
+
"outcome": { "x-referenceValue": "not_executed" }
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
}
|
|
@@ -51,8 +52,8 @@
|
|
|
51
52
|
"properties": {
|
|
52
53
|
"error": {
|
|
53
54
|
"properties": {
|
|
54
|
-
"retryable": { "
|
|
55
|
-
"outcome": { "
|
|
55
|
+
"retryable": { "x-referenceValue": false },
|
|
56
|
+
"outcome": { "x-referenceValue": "not_executed" }
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
}
|
|
@@ -69,8 +70,8 @@
|
|
|
69
70
|
"properties": {
|
|
70
71
|
"error": {
|
|
71
72
|
"properties": {
|
|
72
|
-
"retryable": { "
|
|
73
|
-
"outcome": { "
|
|
73
|
+
"retryable": { "x-referenceValue": false },
|
|
74
|
+
"outcome": { "x-referenceValue": "not_executed" }
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
}
|
|
@@ -87,8 +88,8 @@
|
|
|
87
88
|
"properties": {
|
|
88
89
|
"error": {
|
|
89
90
|
"properties": {
|
|
90
|
-
"retryable": { "
|
|
91
|
-
"outcome": { "
|
|
91
|
+
"retryable": { "x-referenceValue": false },
|
|
92
|
+
"outcome": { "x-referenceValue": "not_executed" }
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
95
|
}
|
|
@@ -105,8 +106,8 @@
|
|
|
105
106
|
"properties": {
|
|
106
107
|
"error": {
|
|
107
108
|
"properties": {
|
|
108
|
-
"retryable": { "
|
|
109
|
-
"outcome": { "
|
|
109
|
+
"retryable": { "x-referenceValue": false },
|
|
110
|
+
"outcome": { "x-referenceValue": "not_executed" }
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
113
|
}
|
|
@@ -123,8 +124,8 @@
|
|
|
123
124
|
"properties": {
|
|
124
125
|
"error": {
|
|
125
126
|
"properties": {
|
|
126
|
-
"retryable": { "
|
|
127
|
-
"outcome": { "
|
|
127
|
+
"retryable": { "x-referenceValue": false },
|
|
128
|
+
"outcome": { "x-referenceValue": "not_executed" }
|
|
128
129
|
}
|
|
129
130
|
}
|
|
130
131
|
}
|
|
@@ -141,8 +142,8 @@
|
|
|
141
142
|
"properties": {
|
|
142
143
|
"error": {
|
|
143
144
|
"properties": {
|
|
144
|
-
"retryable": { "
|
|
145
|
-
"outcome": { "
|
|
145
|
+
"retryable": { "x-referenceValue": false },
|
|
146
|
+
"outcome": { "x-referenceValue": "not_executed" }
|
|
146
147
|
}
|
|
147
148
|
}
|
|
148
149
|
}
|
|
@@ -159,8 +160,8 @@
|
|
|
159
160
|
"properties": {
|
|
160
161
|
"error": {
|
|
161
162
|
"properties": {
|
|
162
|
-
"retryable": { "
|
|
163
|
-
"outcome": { "
|
|
163
|
+
"retryable": { "x-referenceValue": true },
|
|
164
|
+
"outcome": { "x-referenceValue": "not_executed" }
|
|
164
165
|
}
|
|
165
166
|
}
|
|
166
167
|
}
|
|
@@ -177,8 +178,8 @@
|
|
|
177
178
|
"properties": {
|
|
178
179
|
"error": {
|
|
179
180
|
"properties": {
|
|
180
|
-
"retryable": { "
|
|
181
|
-
"outcome": { "
|
|
181
|
+
"retryable": { "x-referenceValue": false },
|
|
182
|
+
"outcome": { "x-referenceValue": "unknown" }
|
|
182
183
|
}
|
|
183
184
|
}
|
|
184
185
|
}
|
|
@@ -195,8 +196,8 @@
|
|
|
195
196
|
"properties": {
|
|
196
197
|
"error": {
|
|
197
198
|
"properties": {
|
|
198
|
-
"retryable": { "
|
|
199
|
-
"outcome": { "
|
|
199
|
+
"retryable": { "x-referenceValue": false },
|
|
200
|
+
"outcome": { "x-referenceValue": "unknown" }
|
|
200
201
|
}
|
|
201
202
|
}
|
|
202
203
|
}
|
|
@@ -213,8 +214,8 @@
|
|
|
213
214
|
"properties": {
|
|
214
215
|
"error": {
|
|
215
216
|
"properties": {
|
|
216
|
-
"retryable": { "
|
|
217
|
-
"outcome": { "
|
|
217
|
+
"retryable": { "x-referenceValue": true },
|
|
218
|
+
"outcome": { "x-referenceValue": "unknown" }
|
|
218
219
|
}
|
|
219
220
|
}
|
|
220
221
|
}
|
|
@@ -14,10 +14,9 @@
|
|
|
14
14
|
"maxLength": 1024
|
|
15
15
|
},
|
|
16
16
|
"limit": {
|
|
17
|
-
"description": "
|
|
17
|
+
"description": "本批最多取多少条,至少 1;不带时取多少条、上限多少由接口自己声明。",
|
|
18
18
|
"type": "integer",
|
|
19
|
-
"minimum": 1
|
|
20
|
-
"maximum": 100
|
|
19
|
+
"minimum": 1
|
|
21
20
|
}
|
|
22
21
|
},
|
|
23
22
|
"additionalProperties": false
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "error-body.schema.json",
|
|
4
4
|
"title": "ErrorBody",
|
|
5
|
-
"description": "错误体。HTTP 状态表达大类,包体带业务码、说明、能否重试、是否已执行与出错字段定位。
|
|
5
|
+
"description": "错误体。HTTP 状态表达大类,包体带业务码、说明、能否重试、是否已执行与出错字段定位。retryable 与 outcome 由服务按实际情形填写,包不替使用方填写;通用失败码表给了一组参考值,使用方可显式引用。",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
8
|
"code": {
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
},
|
|
35
35
|
"required": ["code", "message", "data", "error", "requestId"],
|
|
36
36
|
"additionalProperties": false,
|
|
37
|
-
"allOf": [{ "$ref": "common-error-codes.schema.json" }],
|
|
38
37
|
"$defs": {
|
|
39
38
|
"errorDetail": {
|
|
40
39
|
"title": "ErrorDetail",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "list-reference-values.schema.json",
|
|
4
|
+
"title": "ListReferenceValues",
|
|
5
|
+
"description": "列表的参考数值(参考资源):只是参考,不约束任何结构。结构定义里页码、每页条数、每批条数都没有默认值和上限,包不替使用方填写;要用这些数值须在自己的代码里显式引用,或声明自己的值。",
|
|
6
|
+
"x-referenceResource": true,
|
|
7
|
+
"x-referenceValues": {
|
|
8
|
+
"PAGED_LIST_REFERENCE_VALUES": {
|
|
9
|
+
"description": "页码式列表的参考数值:page 是请求不带页码时可参考的页码,pageSize 是请求不带每页条数时可参考的条数,maxPageSize 是每页条数可参考的上限。",
|
|
10
|
+
"value": {
|
|
11
|
+
"page": 1,
|
|
12
|
+
"pageSize": 10,
|
|
13
|
+
"maxPageSize": 100
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"CURSOR_LIST_REFERENCE_VALUES": {
|
|
17
|
+
"description": "游标式列表的参考数值:maxLimit 是每批条数可参考的上限。",
|
|
18
|
+
"value": {
|
|
19
|
+
"maxLimit": 100
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -8,17 +8,14 @@
|
|
|
8
8
|
"type": "object",
|
|
9
9
|
"properties": {
|
|
10
10
|
"page": {
|
|
11
|
-
"description": "页码,从 1
|
|
11
|
+
"description": "页码,从 1 开始;不带时的含义由接口自己声明。",
|
|
12
12
|
"type": "integer",
|
|
13
|
-
"minimum": 1
|
|
14
|
-
"default": 1
|
|
13
|
+
"minimum": 1
|
|
15
14
|
},
|
|
16
15
|
"pageSize": {
|
|
17
|
-
"description": "
|
|
16
|
+
"description": "每页条数,至少 1;不带时的含义与上限由接口自己声明。",
|
|
18
17
|
"type": "integer",
|
|
19
|
-
"minimum": 1
|
|
20
|
-
"maximum": 100,
|
|
21
|
-
"default": 10
|
|
18
|
+
"minimum": 1
|
|
22
19
|
},
|
|
23
20
|
"query": {
|
|
24
21
|
"description": "模糊搜索词,最多 200 个字符。",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "paged-list.schema.json",
|
|
4
4
|
"title": "PagedList",
|
|
5
|
-
"description": "页码式列表,作成功外壳的 data:给人翻页的表格,能跳页、有总数。顶层允许接口自己声明的附带字段,但不得重复表达翻页信息;不带 cursor。",
|
|
5
|
+
"description": "页码式列表,作成功外壳的 data:给人翻页的表格,能跳页、有总数。顶层允许接口自己声明的附带字段,但不得重复表达翻页信息;不带 cursor。items 的条数不超过 page.pageSize,也不超过 page.totalRecord(x-itemsWithinPage)。",
|
|
6
6
|
"x-pathConstants": "PAGED_LIST_RESPONSE_PATHS",
|
|
7
7
|
"type": "object",
|
|
8
8
|
"properties": {
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"cursor": false
|
|
15
15
|
},
|
|
16
16
|
"required": ["items", "page"],
|
|
17
|
+
"x-itemsWithinPage": true,
|
|
17
18
|
"$defs": {
|
|
18
19
|
"page": {
|
|
19
20
|
"title": "PagedListPage",
|
|
@@ -26,10 +27,9 @@
|
|
|
26
27
|
"minimum": 0
|
|
27
28
|
},
|
|
28
29
|
"pageSize": {
|
|
29
|
-
"description": "
|
|
30
|
+
"description": "每页条数,回显请求值,至少 1。",
|
|
30
31
|
"type": "integer",
|
|
31
|
-
"minimum": 1
|
|
32
|
-
"maximum": 100
|
|
32
|
+
"minimum": 1
|
|
33
33
|
},
|
|
34
34
|
"totalPage": {
|
|
35
35
|
"description": "总页数。",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "service-error-codes.schema.json",
|
|
4
4
|
"title": "ServiceErrorCodes",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "一个服务的专有业务码清单。OK 与 HTTP_<数字> 形式的码是结构保留字,不得使用;比较按字节精确进行,不做大小写归一。专有码是否要避开某组通用码由使用方显式检查:把那组码传给参考资源出口的检查函数,不传就不比。",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
8
|
"service": {
|
|
@@ -33,8 +33,7 @@
|
|
|
33
33
|
"pattern": "^(?:[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*|[a-z][a-z0-9]*(?:_[a-z0-9]+)*)$",
|
|
34
34
|
"allOf": [
|
|
35
35
|
{ "not": { "const": "OK" } },
|
|
36
|
-
{ "not": { "type": "string", "pattern": "^HTTP_[0-9]+$" } }
|
|
37
|
-
{ "not": { "$ref": "common-error-codes.schema.json#/$defs/code" } }
|
|
36
|
+
{ "not": { "type": "string", "pattern": "^HTTP_[0-9]+$" } }
|
|
38
37
|
]
|
|
39
38
|
},
|
|
40
39
|
"stage": {
|
package/types/index.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* BoundedList 响应里各字段的路径(由定义 bounded-list.schema.json 生成)。
|
|
3
|
-
*/
|
|
4
|
-
export declare const BOUNDED_LIST_RESPONSE_PATHS: {
|
|
5
|
-
readonly items: "items";
|
|
6
|
-
};
|
|
7
|
-
|
|
8
1
|
/** 一次性列表,TItem 是元素类型。 */
|
|
9
2
|
export declare interface BoundedList<TItem = unknown> extends Omit<Generated.BoundedList, "items"> {
|
|
10
3
|
items: TItem[];
|
|
@@ -25,118 +18,6 @@ declare interface BoundedList_2 {
|
|
|
25
18
|
/** BoundedList:bounded-list.schema.json */
|
|
26
19
|
export declare const boundedListSchema: SchemaDocument;
|
|
27
20
|
|
|
28
|
-
/**
|
|
29
|
-
* 通用失败码 → HTTP 状态、能否重试、是否已执行(outcome)与含义。
|
|
30
|
-
*/
|
|
31
|
-
export declare const COMMON_ERROR_CODE_TABLE: {
|
|
32
|
-
readonly INVALID_REQUEST: {
|
|
33
|
-
readonly httpStatus: 400;
|
|
34
|
-
readonly retryable: false;
|
|
35
|
-
readonly outcome: "not_executed";
|
|
36
|
-
readonly meaning: "请求不符合接口契约";
|
|
37
|
-
};
|
|
38
|
-
readonly UNAUTHENTICATED: {
|
|
39
|
-
readonly httpStatus: 401;
|
|
40
|
-
readonly retryable: false;
|
|
41
|
-
readonly outcome: "not_executed";
|
|
42
|
-
readonly meaning: "未登录,或令牌无效、过期";
|
|
43
|
-
};
|
|
44
|
-
readonly FORBIDDEN: {
|
|
45
|
-
readonly httpStatus: 403;
|
|
46
|
-
readonly retryable: false;
|
|
47
|
-
readonly outcome: "not_executed";
|
|
48
|
-
readonly meaning: "已认证但无权执行";
|
|
49
|
-
};
|
|
50
|
-
readonly NOT_FOUND: {
|
|
51
|
-
readonly httpStatus: 404;
|
|
52
|
-
readonly retryable: false;
|
|
53
|
-
readonly outcome: "not_executed";
|
|
54
|
-
readonly meaning: "资源不存在,或调用方无权得知其存在";
|
|
55
|
-
};
|
|
56
|
-
readonly ROUTE_NOT_FOUND: {
|
|
57
|
-
readonly httpStatus: 404;
|
|
58
|
-
readonly retryable: false;
|
|
59
|
-
readonly outcome: "not_executed";
|
|
60
|
-
readonly meaning: "接口路径不存在";
|
|
61
|
-
};
|
|
62
|
-
readonly METHOD_NOT_ALLOWED: {
|
|
63
|
-
readonly httpStatus: 405;
|
|
64
|
-
readonly retryable: false;
|
|
65
|
-
readonly outcome: "not_executed";
|
|
66
|
-
readonly meaning: "接口不支持该 HTTP 方法";
|
|
67
|
-
};
|
|
68
|
-
readonly CONFLICT: {
|
|
69
|
-
readonly httpStatus: 409;
|
|
70
|
-
readonly retryable: false;
|
|
71
|
-
readonly outcome: "not_executed";
|
|
72
|
-
readonly meaning: "资源状态冲突";
|
|
73
|
-
};
|
|
74
|
-
readonly RATE_LIMITED: {
|
|
75
|
-
readonly httpStatus: 429;
|
|
76
|
-
readonly retryable: true;
|
|
77
|
-
readonly outcome: "not_executed";
|
|
78
|
-
readonly meaning: "请求过于频繁,可稍后重试";
|
|
79
|
-
};
|
|
80
|
-
readonly INTERNAL_ERROR: {
|
|
81
|
-
readonly httpStatus: 500;
|
|
82
|
-
readonly retryable: false;
|
|
83
|
-
readonly outcome: "unknown";
|
|
84
|
-
readonly meaning: "服务内部错误,可能已产生副作用";
|
|
85
|
-
};
|
|
86
|
-
readonly LIST_LIMIT_EXCEEDED: {
|
|
87
|
-
readonly httpStatus: 500;
|
|
88
|
-
readonly retryable: false;
|
|
89
|
-
readonly outcome: "unknown";
|
|
90
|
-
readonly meaning: "一次性列表的结果超出接口声明的上限";
|
|
91
|
-
};
|
|
92
|
-
readonly SERVICE_UNAVAILABLE: {
|
|
93
|
-
readonly httpStatus: 503;
|
|
94
|
-
readonly retryable: true;
|
|
95
|
-
readonly outcome: "unknown";
|
|
96
|
-
readonly meaning: "服务或其依赖暂不可用";
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* 通用失败码。错误体的 code 是开放字符串,这里只列通用的一组;
|
|
102
|
-
* 各服务可以有自己的专有码,遇到不认识的码按 HTTP 状态归类处理。
|
|
103
|
-
*/
|
|
104
|
-
export declare const COMMON_ERROR_CODES: {
|
|
105
|
-
readonly INVALID_REQUEST: "INVALID_REQUEST";
|
|
106
|
-
readonly UNAUTHENTICATED: "UNAUTHENTICATED";
|
|
107
|
-
readonly FORBIDDEN: "FORBIDDEN";
|
|
108
|
-
readonly NOT_FOUND: "NOT_FOUND";
|
|
109
|
-
readonly ROUTE_NOT_FOUND: "ROUTE_NOT_FOUND";
|
|
110
|
-
readonly METHOD_NOT_ALLOWED: "METHOD_NOT_ALLOWED";
|
|
111
|
-
readonly CONFLICT: "CONFLICT";
|
|
112
|
-
readonly RATE_LIMITED: "RATE_LIMITED";
|
|
113
|
-
readonly INTERNAL_ERROR: "INTERNAL_ERROR";
|
|
114
|
-
readonly LIST_LIMIT_EXCEEDED: "LIST_LIMIT_EXCEEDED";
|
|
115
|
-
readonly SERVICE_UNAVAILABLE: "SERVICE_UNAVAILABLE";
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
export declare type CommonErrorCode = (typeof COMMON_ERROR_CODES)[keyof typeof COMMON_ERROR_CODES];
|
|
119
|
-
|
|
120
|
-
/** CommonErrorCodes:common-error-codes.schema.json */
|
|
121
|
-
export declare const commonErrorCodesSchema: SchemaDocument;
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* CursorListRequest 的线上参数名(由定义 cursor-list-request.schema.json 生成)。
|
|
125
|
-
*/
|
|
126
|
-
export declare const CURSOR_LIST_REQUEST_PARAMS: {
|
|
127
|
-
readonly after: "cursor.after";
|
|
128
|
-
readonly limit: "cursor.limit";
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* CursorList 响应里各字段的路径(由定义 cursor-list.schema.json 生成)。
|
|
133
|
-
*/
|
|
134
|
-
export declare const CURSOR_LIST_RESPONSE_PATHS: {
|
|
135
|
-
readonly items: "items";
|
|
136
|
-
readonly next: "cursor.next";
|
|
137
|
-
readonly hasMore: "cursor.hasMore";
|
|
138
|
-
};
|
|
139
|
-
|
|
140
21
|
/** 游标式列表,TItem 是元素类型。 */
|
|
141
22
|
export declare interface CursorList<TItem = unknown> extends Omit<Generated.CursorList, "items"> {
|
|
142
23
|
items: TItem[];
|
|
@@ -177,7 +58,7 @@ export declare interface CursorListRequest {
|
|
|
177
58
|
*/
|
|
178
59
|
after?: string;
|
|
179
60
|
/**
|
|
180
|
-
*
|
|
61
|
+
* 本批最多取多少条,至少 1;不带时取多少条、上限多少由接口自己声明。
|
|
181
62
|
*/
|
|
182
63
|
limit?: number;
|
|
183
64
|
}
|
|
@@ -189,7 +70,7 @@ export declare const cursorListRequestSchema: SchemaDocument;
|
|
|
189
70
|
export declare const cursorListSchema: SchemaDocument;
|
|
190
71
|
|
|
191
72
|
/**
|
|
192
|
-
* 错误体。HTTP 状态表达大类,包体带业务码、说明、能否重试、是否已执行与出错字段定位。
|
|
73
|
+
* 错误体。HTTP 状态表达大类,包体带业务码、说明、能否重试、是否已执行与出错字段定位。retryable 与 outcome 由服务按实际情形填写,包不替使用方填写;通用失败码表给了一组参考值,使用方可显式引用。
|
|
193
74
|
*/
|
|
194
75
|
export declare interface ErrorBody {
|
|
195
76
|
/**
|
|
@@ -282,16 +163,6 @@ declare namespace Generated {
|
|
|
282
163
|
}
|
|
283
164
|
}
|
|
284
165
|
|
|
285
|
-
/**
|
|
286
|
-
* ListFilter 的线上参数名(由定义 list-filter.schema.json 生成)。
|
|
287
|
-
*/
|
|
288
|
-
export declare const LIST_FILTER_PARAMS: {
|
|
289
|
-
readonly prefix: "filter.";
|
|
290
|
-
readonly operators: {
|
|
291
|
-
readonly eq: "eq";
|
|
292
|
-
};
|
|
293
|
-
};
|
|
294
|
-
|
|
295
166
|
/**
|
|
296
167
|
* 列表的筛选参数。线上写作 filter.<字段>.<操作>(如 filter.status.eq=active),本定义约束解码后的对象 {<字段>: {<操作>: 值}};字段为小驼峰,可筛选哪些字段由接口自己声明。首版操作只有 eq。前缀下未声明的参数不合法。
|
|
297
168
|
*/
|
|
@@ -315,33 +186,13 @@ export declare interface ListFilterCondition {
|
|
|
315
186
|
/** ListFilter:list-filter.schema.json */
|
|
316
187
|
export declare const listFilterSchema: SchemaDocument;
|
|
317
188
|
|
|
318
|
-
/**
|
|
319
|
-
* PagedListRequest 的线上参数名(由定义 paged-list-request.schema.json 生成)。
|
|
320
|
-
*/
|
|
321
|
-
export declare const PAGED_LIST_REQUEST_PARAMS: {
|
|
322
|
-
readonly page: "page.page";
|
|
323
|
-
readonly pageSize: "page.pageSize";
|
|
324
|
-
readonly query: "page.query";
|
|
325
|
-
readonly orderBy: "page.orderBy";
|
|
326
|
-
};
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
* PagedList 响应里各字段的路径(由定义 paged-list.schema.json 生成)。
|
|
330
|
-
*/
|
|
331
|
-
export declare const PAGED_LIST_RESPONSE_PATHS: {
|
|
332
|
-
readonly items: "items";
|
|
333
|
-
readonly totalRecord: "page.totalRecord";
|
|
334
|
-
readonly pageSize: "page.pageSize";
|
|
335
|
-
readonly totalPage: "page.totalPage";
|
|
336
|
-
};
|
|
337
|
-
|
|
338
189
|
/** 页码式列表,TItem 是元素类型。 */
|
|
339
190
|
export declare interface PagedList<TItem = unknown> extends Omit<Generated.PagedList, "items"> {
|
|
340
191
|
items: TItem[];
|
|
341
192
|
}
|
|
342
193
|
|
|
343
194
|
/**
|
|
344
|
-
* 页码式列表,作成功外壳的 data:给人翻页的表格,能跳页、有总数。顶层允许接口自己声明的附带字段,但不得重复表达翻页信息;不带 cursor。
|
|
195
|
+
* 页码式列表,作成功外壳的 data:给人翻页的表格,能跳页、有总数。顶层允许接口自己声明的附带字段,但不得重复表达翻页信息;不带 cursor。items 的条数不超过 page.pageSize,也不超过 page.totalRecord(x-itemsWithinPage)。
|
|
345
196
|
*/
|
|
346
197
|
declare interface PagedList_2 {
|
|
347
198
|
/**
|
|
@@ -361,7 +212,7 @@ export declare interface PagedListPage {
|
|
|
361
212
|
*/
|
|
362
213
|
totalRecord: number;
|
|
363
214
|
/**
|
|
364
|
-
*
|
|
215
|
+
* 每页条数,回显请求值,至少 1。
|
|
365
216
|
*/
|
|
366
217
|
pageSize: number;
|
|
367
218
|
/**
|
|
@@ -375,11 +226,11 @@ export declare interface PagedListPage {
|
|
|
375
226
|
*/
|
|
376
227
|
export declare interface PagedListRequest {
|
|
377
228
|
/**
|
|
378
|
-
* 页码,从 1
|
|
229
|
+
* 页码,从 1 开始;不带时的含义由接口自己声明。
|
|
379
230
|
*/
|
|
380
231
|
page?: number;
|
|
381
232
|
/**
|
|
382
|
-
*
|
|
233
|
+
* 每页条数,至少 1;不带时的含义与上限由接口自己声明。
|
|
383
234
|
*/
|
|
384
235
|
pageSize?: number;
|
|
385
236
|
/**
|
|
@@ -403,10 +254,9 @@ export declare interface SchemaDocument {
|
|
|
403
254
|
readonly [keyword: string]: unknown;
|
|
404
255
|
}
|
|
405
256
|
|
|
406
|
-
/**
|
|
257
|
+
/** 全部结构定义,键为定义的 $id(即文件名),可整体登记到校验器里。 */
|
|
407
258
|
export declare const schemas: {
|
|
408
259
|
readonly "bounded-list.schema.json": SchemaDocument;
|
|
409
|
-
readonly "common-error-codes.schema.json": SchemaDocument;
|
|
410
260
|
readonly "cursor-list-request.schema.json": SchemaDocument;
|
|
411
261
|
readonly "cursor-list.schema.json": SchemaDocument;
|
|
412
262
|
readonly "error-body.schema.json": SchemaDocument;
|
|
@@ -454,7 +304,7 @@ export declare interface ServiceErrorCode {
|
|
|
454
304
|
}
|
|
455
305
|
|
|
456
306
|
/**
|
|
457
|
-
*
|
|
307
|
+
* 一个服务的专有业务码清单。OK 与 HTTP_<数字> 形式的码是结构保留字,不得使用;比较按字节精确进行,不做大小写归一。专有码是否要避开某组通用码由使用方显式检查:把那组码传给参考资源出口的检查函数,不传就不比。
|
|
458
308
|
*/
|
|
459
309
|
export declare interface ServiceErrorCodes {
|
|
460
310
|
/**
|