go-playground / validator

:100:Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving
MIT License
16.64k stars 1.31k forks source link

Is is possible to check if an array is greater then 0 in required_if #1276

Open arjendevos opened 3 months ago

arjendevos commented 3 months ago

Package version eg. v9, v10:

v10

Issue, Question or Enhancement:

Is it possible to do this?

type ValidationStruct struct {
    FirstArray []string `json:"firstArray" validate:"required_if=secondArray lte=0,dive"`
    SecondArray []string `json:"secondArray" validate:"required_if=firstArray lte=0,dive"`
}