1 package validator 2 3 // Option represents a configurations option to be applied to validator during initialization. 4 type Option func(*Validate) 5 6 // WithRequiredStructEnabled enables required tag on non-pointer structs to be applied instead of ignored. 7 // 8 // This was made opt-in behaviour in order to maintain backward compatibility with the behaviour previous 9 // to being able to apply struct level validations on struct fields directly. 10 // 11 // It is recommended you enabled this as it will be the default behaviour in v11+ 12 func WithRequiredStructEnabled() Option { 13 return func(v *Validate) { 14 v.requiredStructEnabled = true 15 } 16 } 17