将多个格式规则应用于单个 rjsf 字段
Apply multiple format rules to a single rjsf field
我喜欢 rjsf 格式 api,它非常适合我:
"format": "alphanumeric"
但我想将多个格式规则分配给一个字段,并使用 transformErrors api 为每个显示不同的消息,为用户提供更准确的错误反馈。大致如下:
"format": ["alphanumeric", "mustBeginWithLetter"]
但是这个数组符号不起作用并且会破坏格式:)
有没有一种干净的方法来实现我想要的?
"allOf": [ {"format": "alphanumeric"}, {"format": "mustBeginWithLetter"} ]
我喜欢 rjsf 格式 api,它非常适合我:
"format": "alphanumeric"
但我想将多个格式规则分配给一个字段,并使用 transformErrors api 为每个显示不同的消息,为用户提供更准确的错误反馈。大致如下:
"format": ["alphanumeric", "mustBeginWithLetter"]
但是这个数组符号不起作用并且会破坏格式:)
有没有一种干净的方法来实现我想要的?
"allOf": [ {"format": "alphanumeric"}, {"format": "mustBeginWithLetter"} ]