validator icon indicating copy to clipboard operation
validator copied to clipboard

Mandatory omit a field if some other field equals some value

Open vishal1132 opened this issue 3 years ago • 3 comments

  • [X] I have looked at the documentation here first?
  • [X] I have looked at the examples provided that may showcase my question here?

Package version eg. v9, v10:

v10.4.0

Issue, Question or Enhancement:

Mandatory omit a field if some other field is present in the struct already.

Code sample, to showcase or reproduce:

For example-

type A struct{
    B string  
    C string
}

C should definitely not be there if B equals something like "abcd"

vishal1132 avatar Jun 07 '21 13:06 vishal1132

The excluded_if tag is needed, as opposed to required_if.

Nikachev avatar Jul 20 '21 23:07 Nikachev

Hello, is excluded_if implemented at all? I am unable to find it in the documentation nor in the source.

johnnybubonic avatar Aug 05 '21 23:08 johnnybubonic

I've added a PR against with #847.

jh125486 avatar Oct 14 '21 12:10 jh125486