|
|
|
@ -8622,11 +8622,11 @@ func TestEndsWithValidation(t *testing.T) { |
|
|
|
|
func TestRequiredWith(t *testing.T) { |
|
|
|
|
|
|
|
|
|
test := struct { |
|
|
|
|
Field1 string `validate:"omitempty" json:"field_1"` |
|
|
|
|
Field2 string `validate:"omitempty" json:"field_2"` |
|
|
|
|
Field1 *string `validate:"omitempty" json:"field_1"` |
|
|
|
|
Field2 []string `validate:"omitempty" json:"field_2"` |
|
|
|
|
Field3 string `validate:"required_with=Field1 Field2" json:"field_3"` |
|
|
|
|
}{ |
|
|
|
|
Field1: "test_field1", |
|
|
|
|
Field2: []string{"test_field2"}, |
|
|
|
|
Field3: "test_field3", |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -8643,11 +8643,11 @@ func TestRequiredWithAll(t *testing.T) { |
|
|
|
|
|
|
|
|
|
test := struct { |
|
|
|
|
Field1 string `validate:"omitempty" json:"field_1"` |
|
|
|
|
Field2 string `validate:"omitempty" json:"field_2"` |
|
|
|
|
Field2 []string `validate:"omitempty" json:"field_2"` |
|
|
|
|
Field3 string `validate:"required_with_all=Field1 Field2" json:"field_3"` |
|
|
|
|
}{ |
|
|
|
|
Field1: "test_field1", |
|
|
|
|
Field2: "test_field2", |
|
|
|
|
Field2: []string{"test_field2"}, |
|
|
|
|
Field3: "test_field3", |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -8663,8 +8663,8 @@ func TestRequiredWithAll(t *testing.T) { |
|
|
|
|
func TestRequiredWithout(t *testing.T) { |
|
|
|
|
|
|
|
|
|
test := struct { |
|
|
|
|
Field1 string `validate:"omitempty" json:"field_1"` |
|
|
|
|
Field2 string `validate:"omitempty" json:"field_2"` |
|
|
|
|
Field1 *string `validate:"omitempty" json:"field_1"` |
|
|
|
|
Field2 []string `validate:"omitempty" json:"field_2"` |
|
|
|
|
Field3 string `validate:"required_without=Field1 Field2" json:"field_3"` |
|
|
|
|
}{ |
|
|
|
|
Field3: "test_field3", |
|
|
|
@ -8682,8 +8682,8 @@ func TestRequiredWithout(t *testing.T) { |
|
|
|
|
func TestRequiredWithoutAll(t *testing.T) { |
|
|
|
|
|
|
|
|
|
test := struct { |
|
|
|
|
Field1 string `validate:"omitempty" json:"field_1"` |
|
|
|
|
Field2 string `validate:"omitempty" json:"field_2"` |
|
|
|
|
Field1 *string `validate:"omitempty" json:"field_1"` |
|
|
|
|
Field2 []string `validate:"omitempty" json:"field_2"` |
|
|
|
|
Field3 string `validate:"required_without_all=Field1 Field2" json:"field_3"` |
|
|
|
|
}{ |
|
|
|
|
Field3: "test_field3", |
|
|
|
|