@done-coding/schema-api 0.0.1-alpha.1 → 0.0.1-alpha.3
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 +43 -480
- package/es/reference.mjs +471 -0
- package/lib/index.cjs +1 -1
- package/lib/reference.cjs +1 -0
- package/package.json +26 -4
- package/schemas/common-error-codes.schema.json +24 -23
- package/schemas/cursor-list-request.schema.json +4 -4
- package/schemas/error-body.schema.json +7 -8
- package/schemas/list-filter.schema.json +1 -1
- package/schemas/list-reference-values.schema.json +23 -0
- package/schemas/paged-list-request.schema.json +7 -9
- package/schemas/paged-list.schema.json +2 -3
- package/schemas/service-error-codes.schema.json +9 -5
- package/types/index.d.cts +365 -0
- package/types/index.d.ts +10 -161
- package/types/reference.d.cts +251 -0
- package/types/reference.d.ts +251 -0
package/es/index.mjs
CHANGED
|
@@ -1,108 +1,5 @@
|
|
|
1
|
-
const
|
|
1
|
+
const c = {
|
|
2
2
|
OK: "OK"
|
|
3
|
-
}, u = {
|
|
4
|
-
INVALID_REQUEST: "INVALID_REQUEST",
|
|
5
|
-
UNAUTHENTICATED: "UNAUTHENTICATED",
|
|
6
|
-
FORBIDDEN: "FORBIDDEN",
|
|
7
|
-
NOT_FOUND: "NOT_FOUND",
|
|
8
|
-
ROUTE_NOT_FOUND: "ROUTE_NOT_FOUND",
|
|
9
|
-
METHOD_NOT_ALLOWED: "METHOD_NOT_ALLOWED",
|
|
10
|
-
CONFLICT: "CONFLICT",
|
|
11
|
-
RATE_LIMITED: "RATE_LIMITED",
|
|
12
|
-
INTERNAL_ERROR: "INTERNAL_ERROR",
|
|
13
|
-
LIST_LIMIT_EXCEEDED: "LIST_LIMIT_EXCEEDED",
|
|
14
|
-
SERVICE_UNAVAILABLE: "SERVICE_UNAVAILABLE"
|
|
15
|
-
}, m = {
|
|
16
|
-
INVALID_REQUEST: {
|
|
17
|
-
httpStatus: 400,
|
|
18
|
-
retryable: !1,
|
|
19
|
-
outcome: "not_executed",
|
|
20
|
-
meaning: "请求不符合接口契约"
|
|
21
|
-
},
|
|
22
|
-
UNAUTHENTICATED: {
|
|
23
|
-
httpStatus: 401,
|
|
24
|
-
retryable: !1,
|
|
25
|
-
outcome: "not_executed",
|
|
26
|
-
meaning: "未登录,或令牌无效、过期"
|
|
27
|
-
},
|
|
28
|
-
FORBIDDEN: {
|
|
29
|
-
httpStatus: 403,
|
|
30
|
-
retryable: !1,
|
|
31
|
-
outcome: "not_executed",
|
|
32
|
-
meaning: "已认证但无权执行"
|
|
33
|
-
},
|
|
34
|
-
NOT_FOUND: {
|
|
35
|
-
httpStatus: 404,
|
|
36
|
-
retryable: !1,
|
|
37
|
-
outcome: "not_executed",
|
|
38
|
-
meaning: "资源不存在,或调用方无权得知其存在"
|
|
39
|
-
},
|
|
40
|
-
ROUTE_NOT_FOUND: {
|
|
41
|
-
httpStatus: 404,
|
|
42
|
-
retryable: !1,
|
|
43
|
-
outcome: "not_executed",
|
|
44
|
-
meaning: "接口路径不存在"
|
|
45
|
-
},
|
|
46
|
-
METHOD_NOT_ALLOWED: {
|
|
47
|
-
httpStatus: 405,
|
|
48
|
-
retryable: !1,
|
|
49
|
-
outcome: "not_executed",
|
|
50
|
-
meaning: "接口不支持该 HTTP 方法"
|
|
51
|
-
},
|
|
52
|
-
CONFLICT: {
|
|
53
|
-
httpStatus: 409,
|
|
54
|
-
retryable: !1,
|
|
55
|
-
outcome: "not_executed",
|
|
56
|
-
meaning: "资源状态冲突"
|
|
57
|
-
},
|
|
58
|
-
RATE_LIMITED: {
|
|
59
|
-
httpStatus: 429,
|
|
60
|
-
retryable: !0,
|
|
61
|
-
outcome: "not_executed",
|
|
62
|
-
meaning: "请求过于频繁,可稍后重试"
|
|
63
|
-
},
|
|
64
|
-
INTERNAL_ERROR: {
|
|
65
|
-
httpStatus: 500,
|
|
66
|
-
retryable: !1,
|
|
67
|
-
outcome: "unknown",
|
|
68
|
-
meaning: "服务内部错误,可能已产生副作用"
|
|
69
|
-
},
|
|
70
|
-
LIST_LIMIT_EXCEEDED: {
|
|
71
|
-
httpStatus: 500,
|
|
72
|
-
retryable: !1,
|
|
73
|
-
outcome: "unknown",
|
|
74
|
-
meaning: "一次性列表的结果超出接口声明的上限"
|
|
75
|
-
},
|
|
76
|
-
SERVICE_UNAVAILABLE: {
|
|
77
|
-
httpStatus: 503,
|
|
78
|
-
retryable: !0,
|
|
79
|
-
outcome: "unknown",
|
|
80
|
-
meaning: "服务或其依赖暂不可用"
|
|
81
|
-
}
|
|
82
|
-
}, l = {
|
|
83
|
-
items: "items"
|
|
84
|
-
}, h = {
|
|
85
|
-
after: "cursor.after",
|
|
86
|
-
limit: "cursor.limit"
|
|
87
|
-
}, E = {
|
|
88
|
-
items: "items",
|
|
89
|
-
next: "cursor.next",
|
|
90
|
-
hasMore: "cursor.hasMore"
|
|
91
|
-
}, f = {
|
|
92
|
-
prefix: "filter.",
|
|
93
|
-
operators: {
|
|
94
|
-
eq: "eq"
|
|
95
|
-
}
|
|
96
|
-
}, g = {
|
|
97
|
-
page: "page.page",
|
|
98
|
-
pageSize: "page.pageSize",
|
|
99
|
-
query: "page.query",
|
|
100
|
-
orderBy: "page.orderBy"
|
|
101
|
-
}, S = {
|
|
102
|
-
items: "items",
|
|
103
|
-
totalRecord: "page.totalRecord",
|
|
104
|
-
pageSize: "page.pageSize",
|
|
105
|
-
totalPage: "page.totalPage"
|
|
106
3
|
}, e = {
|
|
107
4
|
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
108
5
|
$id: "bounded-list.schema.json",
|
|
@@ -120,321 +17,11 @@ const d = {
|
|
|
120
17
|
},
|
|
121
18
|
required: ["items"]
|
|
122
19
|
}, t = {
|
|
123
|
-
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
124
|
-
$id: "common-error-codes.schema.json",
|
|
125
|
-
title: "CommonErrorCodes",
|
|
126
|
-
description: "通用失败码表:每个码固定 HTTP 状态(x-httpStatus),并给出能否重试与是否已执行的缺省值(default)。错误体引用本表:code 是通用失败码时,服务未另行指定 error.retryable 与 error.outcome 就取表中值;服务能确定更具体的重试性或执行结局时可以覆盖,任何合法的 retryable 与 outcome 都合法。$defs/code 列出全部通用失败码,须与 allOf 各项一一对应。",
|
|
127
|
-
$defs: {
|
|
128
|
-
code: {
|
|
129
|
-
description: "通用失败码。",
|
|
130
|
-
enum: [
|
|
131
|
-
"INVALID_REQUEST",
|
|
132
|
-
"UNAUTHENTICATED",
|
|
133
|
-
"FORBIDDEN",
|
|
134
|
-
"NOT_FOUND",
|
|
135
|
-
"ROUTE_NOT_FOUND",
|
|
136
|
-
"METHOD_NOT_ALLOWED",
|
|
137
|
-
"CONFLICT",
|
|
138
|
-
"RATE_LIMITED",
|
|
139
|
-
"INTERNAL_ERROR",
|
|
140
|
-
"LIST_LIMIT_EXCEEDED",
|
|
141
|
-
"SERVICE_UNAVAILABLE"
|
|
142
|
-
]
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
allOf: [
|
|
146
|
-
{
|
|
147
|
-
description: "请求不符合接口契约",
|
|
148
|
-
"x-httpStatus": 400,
|
|
149
|
-
if: {
|
|
150
|
-
properties: {
|
|
151
|
-
code: {
|
|
152
|
-
const: "INVALID_REQUEST"
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
required: ["code"]
|
|
156
|
-
},
|
|
157
|
-
then: {
|
|
158
|
-
properties: {
|
|
159
|
-
error: {
|
|
160
|
-
properties: {
|
|
161
|
-
retryable: {
|
|
162
|
-
default: !1
|
|
163
|
-
},
|
|
164
|
-
outcome: {
|
|
165
|
-
default: "not_executed"
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
description: "未登录,或令牌无效、过期",
|
|
174
|
-
"x-httpStatus": 401,
|
|
175
|
-
if: {
|
|
176
|
-
properties: {
|
|
177
|
-
code: {
|
|
178
|
-
const: "UNAUTHENTICATED"
|
|
179
|
-
}
|
|
180
|
-
},
|
|
181
|
-
required: ["code"]
|
|
182
|
-
},
|
|
183
|
-
then: {
|
|
184
|
-
properties: {
|
|
185
|
-
error: {
|
|
186
|
-
properties: {
|
|
187
|
-
retryable: {
|
|
188
|
-
default: !1
|
|
189
|
-
},
|
|
190
|
-
outcome: {
|
|
191
|
-
default: "not_executed"
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
description: "已认证但无权执行",
|
|
200
|
-
"x-httpStatus": 403,
|
|
201
|
-
if: {
|
|
202
|
-
properties: {
|
|
203
|
-
code: {
|
|
204
|
-
const: "FORBIDDEN"
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
required: ["code"]
|
|
208
|
-
},
|
|
209
|
-
then: {
|
|
210
|
-
properties: {
|
|
211
|
-
error: {
|
|
212
|
-
properties: {
|
|
213
|
-
retryable: {
|
|
214
|
-
default: !1
|
|
215
|
-
},
|
|
216
|
-
outcome: {
|
|
217
|
-
default: "not_executed"
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
description: "资源不存在,或调用方无权得知其存在",
|
|
226
|
-
"x-httpStatus": 404,
|
|
227
|
-
if: {
|
|
228
|
-
properties: {
|
|
229
|
-
code: {
|
|
230
|
-
const: "NOT_FOUND"
|
|
231
|
-
}
|
|
232
|
-
},
|
|
233
|
-
required: ["code"]
|
|
234
|
-
},
|
|
235
|
-
then: {
|
|
236
|
-
properties: {
|
|
237
|
-
error: {
|
|
238
|
-
properties: {
|
|
239
|
-
retryable: {
|
|
240
|
-
default: !1
|
|
241
|
-
},
|
|
242
|
-
outcome: {
|
|
243
|
-
default: "not_executed"
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
description: "接口路径不存在",
|
|
252
|
-
"x-httpStatus": 404,
|
|
253
|
-
if: {
|
|
254
|
-
properties: {
|
|
255
|
-
code: {
|
|
256
|
-
const: "ROUTE_NOT_FOUND"
|
|
257
|
-
}
|
|
258
|
-
},
|
|
259
|
-
required: ["code"]
|
|
260
|
-
},
|
|
261
|
-
then: {
|
|
262
|
-
properties: {
|
|
263
|
-
error: {
|
|
264
|
-
properties: {
|
|
265
|
-
retryable: {
|
|
266
|
-
default: !1
|
|
267
|
-
},
|
|
268
|
-
outcome: {
|
|
269
|
-
default: "not_executed"
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
description: "接口不支持该 HTTP 方法",
|
|
278
|
-
"x-httpStatus": 405,
|
|
279
|
-
if: {
|
|
280
|
-
properties: {
|
|
281
|
-
code: {
|
|
282
|
-
const: "METHOD_NOT_ALLOWED"
|
|
283
|
-
}
|
|
284
|
-
},
|
|
285
|
-
required: ["code"]
|
|
286
|
-
},
|
|
287
|
-
then: {
|
|
288
|
-
properties: {
|
|
289
|
-
error: {
|
|
290
|
-
properties: {
|
|
291
|
-
retryable: {
|
|
292
|
-
default: !1
|
|
293
|
-
},
|
|
294
|
-
outcome: {
|
|
295
|
-
default: "not_executed"
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
description: "资源状态冲突",
|
|
304
|
-
"x-httpStatus": 409,
|
|
305
|
-
if: {
|
|
306
|
-
properties: {
|
|
307
|
-
code: {
|
|
308
|
-
const: "CONFLICT"
|
|
309
|
-
}
|
|
310
|
-
},
|
|
311
|
-
required: ["code"]
|
|
312
|
-
},
|
|
313
|
-
then: {
|
|
314
|
-
properties: {
|
|
315
|
-
error: {
|
|
316
|
-
properties: {
|
|
317
|
-
retryable: {
|
|
318
|
-
default: !1
|
|
319
|
-
},
|
|
320
|
-
outcome: {
|
|
321
|
-
default: "not_executed"
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
},
|
|
328
|
-
{
|
|
329
|
-
description: "请求过于频繁,可稍后重试",
|
|
330
|
-
"x-httpStatus": 429,
|
|
331
|
-
if: {
|
|
332
|
-
properties: {
|
|
333
|
-
code: {
|
|
334
|
-
const: "RATE_LIMITED"
|
|
335
|
-
}
|
|
336
|
-
},
|
|
337
|
-
required: ["code"]
|
|
338
|
-
},
|
|
339
|
-
then: {
|
|
340
|
-
properties: {
|
|
341
|
-
error: {
|
|
342
|
-
properties: {
|
|
343
|
-
retryable: {
|
|
344
|
-
default: !0
|
|
345
|
-
},
|
|
346
|
-
outcome: {
|
|
347
|
-
default: "not_executed"
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
},
|
|
354
|
-
{
|
|
355
|
-
description: "服务内部错误,可能已产生副作用",
|
|
356
|
-
"x-httpStatus": 500,
|
|
357
|
-
if: {
|
|
358
|
-
properties: {
|
|
359
|
-
code: {
|
|
360
|
-
const: "INTERNAL_ERROR"
|
|
361
|
-
}
|
|
362
|
-
},
|
|
363
|
-
required: ["code"]
|
|
364
|
-
},
|
|
365
|
-
then: {
|
|
366
|
-
properties: {
|
|
367
|
-
error: {
|
|
368
|
-
properties: {
|
|
369
|
-
retryable: {
|
|
370
|
-
default: !1
|
|
371
|
-
},
|
|
372
|
-
outcome: {
|
|
373
|
-
default: "unknown"
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
},
|
|
380
|
-
{
|
|
381
|
-
description: "一次性列表的结果超出接口声明的上限",
|
|
382
|
-
"x-httpStatus": 500,
|
|
383
|
-
if: {
|
|
384
|
-
properties: {
|
|
385
|
-
code: {
|
|
386
|
-
const: "LIST_LIMIT_EXCEEDED"
|
|
387
|
-
}
|
|
388
|
-
},
|
|
389
|
-
required: ["code"]
|
|
390
|
-
},
|
|
391
|
-
then: {
|
|
392
|
-
properties: {
|
|
393
|
-
error: {
|
|
394
|
-
properties: {
|
|
395
|
-
retryable: {
|
|
396
|
-
default: !1
|
|
397
|
-
},
|
|
398
|
-
outcome: {
|
|
399
|
-
default: "unknown"
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
},
|
|
406
|
-
{
|
|
407
|
-
description: "服务或其依赖暂不可用",
|
|
408
|
-
"x-httpStatus": 503,
|
|
409
|
-
if: {
|
|
410
|
-
properties: {
|
|
411
|
-
code: {
|
|
412
|
-
const: "SERVICE_UNAVAILABLE"
|
|
413
|
-
}
|
|
414
|
-
},
|
|
415
|
-
required: ["code"]
|
|
416
|
-
},
|
|
417
|
-
then: {
|
|
418
|
-
properties: {
|
|
419
|
-
error: {
|
|
420
|
-
properties: {
|
|
421
|
-
retryable: {
|
|
422
|
-
default: !0
|
|
423
|
-
},
|
|
424
|
-
outcome: {
|
|
425
|
-
default: "unknown"
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
]
|
|
433
|
-
}, r = {
|
|
434
20
|
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
435
21
|
$id: "cursor-list-request.schema.json",
|
|
436
22
|
title: "CursorListRequest",
|
|
437
|
-
description:
|
|
23
|
+
description: '游标式列表的请求参数。线上以 cursor. 前缀的查询参数传递(如 cursor.limit=20),本定义约束解码后的对象;前缀下未声明的参数不合法。线上名为「前缀.字段名」。查询串里的整数参数(type 为 integer 的字段)只收整串匹配 x-queryIntegerPattern 的十进制数字串,解码成整数后再按本定义校验;"02"、"+2"、" 2"、"2.0"、"1e1"、空串都不合法。',
|
|
24
|
+
"x-queryIntegerPattern": "^(?:0|[1-9][0-9]*)$(?![\\s\\S])",
|
|
438
25
|
"x-paramPrefix": "cursor",
|
|
439
26
|
"x-pathConstants": "CURSOR_LIST_REQUEST_PARAMS",
|
|
440
27
|
type: "object",
|
|
@@ -446,14 +33,13 @@ const d = {
|
|
|
446
33
|
maxLength: 1024
|
|
447
34
|
},
|
|
448
35
|
limit: {
|
|
449
|
-
description: "
|
|
36
|
+
description: "本批最多取多少条,至少 1;不带时取多少条、上限多少由接口自己声明。",
|
|
450
37
|
type: "integer",
|
|
451
|
-
minimum: 1
|
|
452
|
-
maximum: 100
|
|
38
|
+
minimum: 1
|
|
453
39
|
}
|
|
454
40
|
},
|
|
455
41
|
additionalProperties: !1
|
|
456
|
-
},
|
|
42
|
+
}, r = {
|
|
457
43
|
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
458
44
|
$id: "cursor-list.schema.json",
|
|
459
45
|
title: "CursorList",
|
|
@@ -507,13 +93,13 @@ const d = {
|
|
|
507
93
|
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
508
94
|
$id: "error-body.schema.json",
|
|
509
95
|
title: "ErrorBody",
|
|
510
|
-
description: "错误体。HTTP 状态表达大类,包体带业务码、说明、能否重试、是否已执行与出错字段定位。
|
|
96
|
+
description: "错误体。HTTP 状态表达大类,包体带业务码、说明、能否重试、是否已执行与出错字段定位。retryable 与 outcome 由服务按实际情形填写,包不替使用方填写;通用失败码表给了一组参考值,使用方可显式引用。",
|
|
511
97
|
type: "object",
|
|
512
98
|
properties: {
|
|
513
99
|
code: {
|
|
514
100
|
description: "业务码,开放字符串:字母开头,只含字母、数字、下划线,1–128 个字符;不能是 OK。使用方遇到不认识的码按 HTTP 状态归类处理。",
|
|
515
101
|
type: "string",
|
|
516
|
-
pattern: "^[A-Za-z][A-Za-z0-9_]{0,127}$",
|
|
102
|
+
pattern: "^[A-Za-z][A-Za-z0-9_]{0,127}$(?![\\s\\S])",
|
|
517
103
|
not: {
|
|
518
104
|
const: "OK"
|
|
519
105
|
}
|
|
@@ -522,7 +108,7 @@ const d = {
|
|
|
522
108
|
description: "说明,不能是纯空白。",
|
|
523
109
|
type: "string",
|
|
524
110
|
maxLength: 1e3,
|
|
525
|
-
pattern: "\\
|
|
111
|
+
pattern: "[^\\t\\n\\v\\f\\r \\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]"
|
|
526
112
|
},
|
|
527
113
|
data: {
|
|
528
114
|
description: "错误体恒为 null。",
|
|
@@ -534,7 +120,7 @@ const d = {
|
|
|
534
120
|
requestId: {
|
|
535
121
|
description: "请求标识,1–128 个字符,不含空白字符。",
|
|
536
122
|
type: "string",
|
|
537
|
-
pattern: "^\\
|
|
123
|
+
pattern: "^[^\\t\\n\\v\\f\\r \\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]{1,128}$(?![\\s\\S])"
|
|
538
124
|
},
|
|
539
125
|
detail: {
|
|
540
126
|
description: "补充说明,可选,不限长。",
|
|
@@ -543,11 +129,6 @@ const d = {
|
|
|
543
129
|
},
|
|
544
130
|
required: ["code", "message", "data", "error", "requestId"],
|
|
545
131
|
additionalProperties: !1,
|
|
546
|
-
allOf: [
|
|
547
|
-
{
|
|
548
|
-
$ref: "common-error-codes.schema.json"
|
|
549
|
-
}
|
|
550
|
-
],
|
|
551
132
|
$defs: {
|
|
552
133
|
errorDetail: {
|
|
553
134
|
title: "ErrorDetail",
|
|
@@ -585,18 +166,18 @@ const d = {
|
|
|
585
166
|
code: {
|
|
586
167
|
description: "字段级错误码:字母开头,只含字母、数字、下划线、点、短横线,1–128 个字符。",
|
|
587
168
|
type: "string",
|
|
588
|
-
pattern: "^[A-Za-z][A-Za-z0-9_.\\-]{0,127}$"
|
|
169
|
+
pattern: "^[A-Za-z][A-Za-z0-9_.\\-]{0,127}$(?![\\s\\S])"
|
|
589
170
|
},
|
|
590
171
|
message: {
|
|
591
172
|
description: "说明,不能是纯空白。",
|
|
592
173
|
type: "string",
|
|
593
174
|
maxLength: 1e3,
|
|
594
|
-
pattern: "\\
|
|
175
|
+
pattern: "[^\\t\\n\\v\\f\\r \\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]"
|
|
595
176
|
},
|
|
596
177
|
pointer: {
|
|
597
178
|
description: "请求体内的位置,RFC 6901 JSON Pointer。",
|
|
598
179
|
type: "string",
|
|
599
|
-
pattern: "^(?:(?:/(?:[^~/]|~[01])*)*/(?:(?:[^~/]|~[01])*(?:[^~/\\n]|~[01]))?)?$"
|
|
180
|
+
pattern: "^(?:(?:/(?:[^~/]|~[01])*)*/(?:(?:[^~/]|~[01])*(?:[^~/\\n]|~[01]))?)?$(?![\\s\\S])"
|
|
600
181
|
},
|
|
601
182
|
parameter: {
|
|
602
183
|
description: "参数名,1–256 个字符。",
|
|
@@ -638,7 +219,7 @@ const d = {
|
|
|
638
219
|
"x-pathConstants": "LIST_FILTER_PARAMS",
|
|
639
220
|
type: "object",
|
|
640
221
|
patternProperties: {
|
|
641
|
-
"^[a-z][a-zA-Z0-9]*$": {
|
|
222
|
+
"^[a-z][a-zA-Z0-9]*$(?![\\s\\S])": {
|
|
642
223
|
$ref: "#/$defs/condition"
|
|
643
224
|
}
|
|
644
225
|
},
|
|
@@ -662,23 +243,21 @@ const d = {
|
|
|
662
243
|
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
663
244
|
$id: "paged-list-request.schema.json",
|
|
664
245
|
title: "PagedListRequest",
|
|
665
|
-
description:
|
|
246
|
+
description: '页码式列表的请求参数。线上以 page. 前缀的查询参数传递(如 page.pageSize=20),本定义约束解码后的对象;前缀下未声明的参数不合法。线上名为「前缀.字段名」。查询串里的整数参数(type 为 integer 的字段)只收整串匹配 x-queryIntegerPattern 的十进制数字串,解码成整数后再按本定义校验;"02"、"+2"、" 2"、"2.0"、"1e1"、空串都不合法。',
|
|
247
|
+
"x-queryIntegerPattern": "^(?:0|[1-9][0-9]*)$(?![\\s\\S])",
|
|
666
248
|
"x-paramPrefix": "page",
|
|
667
249
|
"x-pathConstants": "PAGED_LIST_REQUEST_PARAMS",
|
|
668
250
|
type: "object",
|
|
669
251
|
properties: {
|
|
670
252
|
page: {
|
|
671
|
-
description: "页码,从 1
|
|
253
|
+
description: "页码,从 1 开始;不带时的含义由接口自己声明。",
|
|
672
254
|
type: "integer",
|
|
673
|
-
minimum: 1
|
|
674
|
-
default: 1
|
|
255
|
+
minimum: 1
|
|
675
256
|
},
|
|
676
257
|
pageSize: {
|
|
677
|
-
description: "
|
|
258
|
+
description: "每页条数,至少 1;不带时的含义与上限由接口自己声明。",
|
|
678
259
|
type: "integer",
|
|
679
|
-
minimum: 1
|
|
680
|
-
maximum: 100,
|
|
681
|
-
default: 10
|
|
260
|
+
minimum: 1
|
|
682
261
|
},
|
|
683
262
|
query: {
|
|
684
263
|
description: "模糊搜索词,最多 200 个字符。",
|
|
@@ -689,11 +268,11 @@ const d = {
|
|
|
689
268
|
description: "排序:逗号分隔,每段是小驼峰字段名,后面可跟一个空格加 asc 或 desc(缺省 asc);逗号后可有一个空格;最多 200 个字符。",
|
|
690
269
|
type: "string",
|
|
691
270
|
maxLength: 200,
|
|
692
|
-
pattern: "^[a-z][a-zA-Z0-9]*(?: (?:asc|desc))?(?:, ?[a-z][a-zA-Z0-9]*(?: (?:asc|desc))?)*$"
|
|
271
|
+
pattern: "^[a-z][a-zA-Z0-9]*(?: (?:asc|desc))?(?:, ?[a-z][a-zA-Z0-9]*(?: (?:asc|desc))?)*$(?![\\s\\S])"
|
|
693
272
|
}
|
|
694
273
|
},
|
|
695
274
|
additionalProperties: !1
|
|
696
|
-
},
|
|
275
|
+
}, o = {
|
|
697
276
|
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
698
277
|
$id: "paged-list.schema.json",
|
|
699
278
|
title: "PagedList",
|
|
@@ -724,10 +303,9 @@ const d = {
|
|
|
724
303
|
minimum: 0
|
|
725
304
|
},
|
|
726
305
|
pageSize: {
|
|
727
|
-
description: "
|
|
306
|
+
description: "每页条数,回显请求值,至少 1。",
|
|
728
307
|
type: "integer",
|
|
729
|
-
minimum: 1
|
|
730
|
-
maximum: 100
|
|
308
|
+
minimum: 1
|
|
731
309
|
},
|
|
732
310
|
totalPage: {
|
|
733
311
|
description: "总页数。",
|
|
@@ -755,17 +333,17 @@ const d = {
|
|
|
755
333
|
"x-totalPageEqualsCeil": !0
|
|
756
334
|
}
|
|
757
335
|
}
|
|
758
|
-
},
|
|
336
|
+
}, n = {
|
|
759
337
|
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
760
338
|
$id: "service-error-codes.schema.json",
|
|
761
339
|
title: "ServiceErrorCodes",
|
|
762
|
-
description: "
|
|
340
|
+
description: "一个服务的专有业务码清单。OK 与 HTTP_<数字> 形式的码是结构保留字,不得使用;比较按字节精确进行,不做大小写归一。专有码是否要避开某组通用码由使用方显式检查:把那组码传给参考资源出口的检查函数,不传就不比。",
|
|
763
341
|
type: "object",
|
|
764
342
|
properties: {
|
|
765
343
|
service: {
|
|
766
344
|
description: "服务标识:小写字母开头,只含小写字母、数字、短横线,最长 64 个字符。",
|
|
767
345
|
type: "string",
|
|
768
|
-
pattern: "^[a-z][a-z0-9\\-]{0,63}$"
|
|
346
|
+
pattern: "^[a-z][a-z0-9\\-]{0,63}$(?![\\s\\S])"
|
|
769
347
|
},
|
|
770
348
|
codes: {
|
|
771
349
|
description: "专有码,至少 1 项;code 在清单内不重复(x-uniqueItemsBy)。",
|
|
@@ -789,7 +367,7 @@ const d = {
|
|
|
789
367
|
description: "码:整体大写下划线或整体小写下划线写法,字母开头,不以下划线结尾,不含连续下划线,最长 128 个字符。",
|
|
790
368
|
type: "string",
|
|
791
369
|
maxLength: 128,
|
|
792
|
-
pattern: "^(?:[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*|[a-z][a-z0-9]*(?:_[a-z0-9]+)*)$",
|
|
370
|
+
pattern: "^(?:[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*|[a-z][a-z0-9]*(?:_[a-z0-9]+)*)$(?![\\s\\S])",
|
|
793
371
|
allOf: [
|
|
794
372
|
{
|
|
795
373
|
not: {
|
|
@@ -799,12 +377,7 @@ const d = {
|
|
|
799
377
|
{
|
|
800
378
|
not: {
|
|
801
379
|
type: "string",
|
|
802
|
-
pattern: "^HTTP_[0-9]+$"
|
|
803
|
-
}
|
|
804
|
-
},
|
|
805
|
-
{
|
|
806
|
-
not: {
|
|
807
|
-
$ref: "common-error-codes.schema.json#/$defs/code"
|
|
380
|
+
pattern: "^HTTP_[0-9]+$(?![\\s\\S])"
|
|
808
381
|
}
|
|
809
382
|
}
|
|
810
383
|
]
|
|
@@ -870,7 +443,7 @@ const d = {
|
|
|
870
443
|
}
|
|
871
444
|
}
|
|
872
445
|
}
|
|
873
|
-
},
|
|
446
|
+
}, p = {
|
|
874
447
|
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
875
448
|
$id: "success-envelope.schema.json",
|
|
876
449
|
title: "SuccessEnvelope",
|
|
@@ -894,37 +467,27 @@ const d = {
|
|
|
894
467
|
},
|
|
895
468
|
required: ["code", "message", "data"],
|
|
896
469
|
additionalProperties: !1
|
|
897
|
-
},
|
|
470
|
+
}, d = {
|
|
898
471
|
"bounded-list.schema.json": e,
|
|
899
|
-
"
|
|
900
|
-
"cursor-list
|
|
901
|
-
"cursor-list.schema.json": o,
|
|
472
|
+
"cursor-list-request.schema.json": t,
|
|
473
|
+
"cursor-list.schema.json": r,
|
|
902
474
|
"error-body.schema.json": s,
|
|
903
475
|
"list-filter.schema.json": i,
|
|
904
476
|
"paged-list-request.schema.json": a,
|
|
905
|
-
"paged-list.schema.json":
|
|
906
|
-
"service-error-codes.schema.json":
|
|
907
|
-
"success-envelope.schema.json":
|
|
477
|
+
"paged-list.schema.json": o,
|
|
478
|
+
"service-error-codes.schema.json": n,
|
|
479
|
+
"success-envelope.schema.json": p
|
|
908
480
|
};
|
|
909
481
|
export {
|
|
910
|
-
|
|
911
|
-
u as COMMON_ERROR_CODES,
|
|
912
|
-
m as COMMON_ERROR_CODE_TABLE,
|
|
913
|
-
h as CURSOR_LIST_REQUEST_PARAMS,
|
|
914
|
-
E as CURSOR_LIST_RESPONSE_PATHS,
|
|
915
|
-
f as LIST_FILTER_PARAMS,
|
|
916
|
-
g as PAGED_LIST_REQUEST_PARAMS,
|
|
917
|
-
S as PAGED_LIST_RESPONSE_PATHS,
|
|
918
|
-
d as SUCCESS_CODES,
|
|
482
|
+
c as SUCCESS_CODES,
|
|
919
483
|
e as boundedListSchema,
|
|
920
|
-
t as
|
|
921
|
-
r as
|
|
922
|
-
o as cursorListSchema,
|
|
484
|
+
t as cursorListRequestSchema,
|
|
485
|
+
r as cursorListSchema,
|
|
923
486
|
s as errorBodySchema,
|
|
924
487
|
i as listFilterSchema,
|
|
925
488
|
a as pagedListRequestSchema,
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
489
|
+
o as pagedListSchema,
|
|
490
|
+
d as schemas,
|
|
491
|
+
n as serviceErrorCodesSchema,
|
|
492
|
+
p as successEnvelopeSchema
|
|
930
493
|
};
|