提问人:טומי ברוור 提问时间:10/3/2023 最后编辑:DBSטומי ברוור 更新时间:10/3/2023 访问量:26
我怎样才能解决这个JOI问题
how can i fix this joi issue
问:
我有一个字段和多个条件,其中一个大于 0
barrageRadius: {
key: "barrageRadius",
label: "רדיוס מטח (m)",
condition: Joi.number()
.optional()
.max(40)
.greater(0)
.messages({
...errorMessage.required,
...errorMessage.type.numeric,
...errorMessage.type.max.number(40000),
"number.greater": "Value must be greater than 0",
}),
transferData: (val) => val / 1000,
type: INPUT_TYPES.custom,
validation: {
max: 40000,
},
},
{
"type": "number",
"$_root": {
"_types": {},
"version": "17.6.0",
"cache": {}
},
"$_temp": {
"ruleset": null,
"whens": {}
},
"_ids": {
"_byId": {},
"_byKey": {},
"_schemaChain": false
},
"_preferences": {
"messages": {
"any.required": {
"source": "שדה חסר",
"rendered": "שדה חסר",
"_template": null
},
"number.base": {
"source": "השדה מוגדר כמספר",
"rendered": "השדה מוגדר כמספר",
"_template": null
},
"number.max": {
"source": "40000 הערך התקין המקסימלי הוא ",
"rendered": "40000 הערך התקין המקסימלי הוא ",
"_template": null
},
"number.greater": {
"source": "Value must be greater than 0",
"rendered": "Value must be greater than 0",
"_template": null
}
}
},
"_valids": null,
"_invalids": null,
"_rules": [
{
"name": "max",
"method": "compare",
"args": {
"limit": 40
},
"operator": "<=",
"_resolve": []
},
{
"name": "greater",
"method": "compare",
"args": {
"limit": 0
},
"operator": ">",
"_resolve": []
}
],
"_singleRules": {},
"_refs": {
"refs": []
},
"_flags": {
"presence": "optional"
},
"_cache": null,
"$_terms": {
"alterations": null,
"examples": null,
"externals": null,
"metas": [],
"notes": [],
"shared": null,
"tags": [],
"whens": null
},
"$_super": {}
}
出于某种原因,当键入0
答: 暂无答案
评论