1 | const joi2desc = {
|
2 | 'alternatives.base': '不符合任何一个可选项',
|
3 | 'any.empty': '不允许为空',
|
4 | 'any.required': '必须填写',
|
5 | 'any.unknown': '',
|
6 | 'array.base': '应该为数组类型',
|
7 | 'any.allowOnly': '',
|
8 | 'any.default': '',
|
9 | 'any.invalid': '',
|
10 | 'array.excludes': '',
|
11 | 'array.excludesSingle': '',
|
12 | 'array.includesRequiredBoth': '',
|
13 | 'array.includesRequiredKnowns': '',
|
14 | 'array.includesRequiredUnknowns': '',
|
15 | 'array.includes': '',
|
16 | 'array.includesSingle': '',
|
17 | 'array.length': '',
|
18 | 'array.max': '',
|
19 | 'array.min': '',
|
20 | 'array.orderedLength': '',
|
21 | 'array.ref': '',
|
22 | 'array.sparse': '',
|
23 | 'array.unique': '',
|
24 | 'binary.base': '',
|
25 | 'binary.length': '',
|
26 | 'binary.max': '',
|
27 | 'binary.min': '',
|
28 | 'boolean.base': '应该为布尔值',
|
29 | 'date.base': '应该为一个日期',
|
30 | 'date.greater': '',
|
31 | 'date.isoDate': '',
|
32 | 'date.less': '',
|
33 | 'date.max': '',
|
34 | 'date.min': '',
|
35 | 'date.ref': '',
|
36 | 'date.strict': '',
|
37 | 'date.timestamp.javascript': '',
|
38 | 'date.timestamp.unix': '',
|
39 | 'function.arity': '',
|
40 | 'function.base': '应该为一个函数',
|
41 | 'function.class': '',
|
42 | 'function.maxArity': '',
|
43 | 'function.minArity': '',
|
44 | 'function.ref': '',
|
45 | 'lazy.base': '',
|
46 | 'lazy.schema': '',
|
47 | 'number.base': '应该为一个数字',
|
48 | 'number.greater': '',
|
49 | 'number.integer': '',
|
50 | 'number.less': '',
|
51 | 'number.max': '',
|
52 | 'number.min': '',
|
53 | 'number.multiple': '',
|
54 | 'number.negative': '',
|
55 | 'number.port': '',
|
56 | 'number.positive': '',
|
57 | 'number.precision': '',
|
58 | 'number.ref': '',
|
59 | 'number.unsafe': '',
|
60 | 'object.allowUnknown': '不合法的字段',
|
61 | 'object.and': '',
|
62 | 'object.assert': '',
|
63 | 'object.base': '应该为一个对象',
|
64 | 'object.length': '',
|
65 | 'object.max': '',
|
66 | 'object.min': '',
|
67 | 'object.missing': '',
|
68 | 'object.nand': '',
|
69 | 'object.rename.multiple': '',
|
70 | 'object.rename.override': '',
|
71 | 'object.rename.regex.multiple': '',
|
72 | 'object.rename.regex.override': '',
|
73 | 'object.schema': '',
|
74 | 'object.type': '',
|
75 | 'object.with': '',
|
76 | 'object.without': '',
|
77 | 'object.xor': '',
|
78 | 'string.alphanum': '',
|
79 | 'string.base64': '',
|
80 | 'string.base': '应该为一个字符串',
|
81 | 'string.creditCard': '',
|
82 | 'string.dataUri': '',
|
83 | 'string.email': '',
|
84 | 'string.guid': '',
|
85 | 'string.hexAlign': '',
|
86 | 'string.hex': '',
|
87 | 'string.hostname': '',
|
88 | 'string.ipVersion': '',
|
89 | 'string.ip': '',
|
90 | 'string.isoDate': '',
|
91 | 'string.length': '',
|
92 | 'string.lowercase': '',
|
93 | 'string.max': '',
|
94 | 'string.min': '',
|
95 | 'string.normalize': '',
|
96 | 'string.ref': '',
|
97 | 'string.regex.base': '',
|
98 | 'string.regex.name': '',
|
99 | 'string.regex.invert.base': '',
|
100 | 'string.regex.invert.name': '',
|
101 | 'string.token': '',
|
102 | 'string.trim': '',
|
103 | 'string.uppercase': '',
|
104 | 'string.uri': '',
|
105 | 'string.uriCustomScheme': '',
|
106 | 'string.uriRelativeOnly': '',
|
107 | 'symbol.base': '',
|
108 | 'symbol.map': ''
|
109 | }
|
110 |
|
111 | export default function (error) {
|
112 | return joi2desc[error.type] || error.message
|
113 | }
|