【问题标题】:Apply multiple format rules to a single rjsf field将多个格式规则应用于单个 rjsf 字段
【发布时间】:2021-09-13 14:02:44
【问题描述】:

我喜欢 rjsf 格式的 api,它非常适合我:

"format": "alphanumeric"

但我想为单个字段分配多个格式规则,并使用transformErrors api 为每个字段显示不同的消息,从而为用户提供更准确的错误反馈。大致如下:

"format": ["alphanumeric", "mustBeginWithLetter"]

但是这个数组表示法不起作用,而是破坏了格式:)

有没有一种干净的方法来实现我想要的?

【问题讨论】:

    标签: jsonschema react-jsonschema-forms


    【解决方案1】:

    "allOf": [ {"format": "alphanumeric"}, {"format": "mustBeginWithLetter"} ]

    【讨论】:

    • 效果很好,谢谢!有没有办法为这种格式组合创建别名?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多