Need to create conditional validation using Yup

Viewed 27

I have the following dataset

{
    "json_schema": {
        "properties": {
            "analyst_time": {
                "description": "Analyst Task Time, in minutes",
                "is_duration_field": true,
                "mouseover_help": "...",
                "order": 11,
                "required_positive": true,
                "type": "integer"
            }
        },
        "required_one_of": [
            [
                "analyst_time",
                "instrument_time"
            ]
        ]
    }
}

properties object includes all of the fields

Form fields and validation are formed from properties. Need to extend the validation. It is required to add conditional validation to the field sets from the required_one_of array so that the fields from this set are required until at least one of them is filled.

I tried to do it with yup.when, but I got an error, since the fields have a looped relationship enter image description here

0 Answers
Related