Skip to content

Array $validators are not supported? #593

@fyodorvi

Description

@fyodorvi

$validators do not seem to work for arrays.

Sample schema:

{
    "type": "object",
    "properties": {
        "arr": {
            "title": "Array",
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "name": {
                      "title": "Name",
                      "type": "string"
                    }
                }
            }  
        }
    }
}

Sample form:

[
  {
      "key": "arr",
      "validationMessage": {
        "atLeastTwo": "Please add at least two options"
        }
        $validators: {
            atLeastTwo: function (value) {
                debugger
                return value?.length > 1
            }
        }
  }
]

Is there some workaround for this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions