Add validating sub structures
This commit is contained in:
		| @ -199,6 +199,17 @@ func Validate(obj interface{}, parents ...string) error { | |||||||
| 						return err | 						return err | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
|  | 			} else { | ||||||
|  | 				fieldType := field.Type.Kind() | ||||||
|  | 				if fieldType == reflect.Struct { | ||||||
|  | 					if reflect.DeepEqual(zero, fieldValue) { | ||||||
|  | 						continue | ||||||
|  | 					} | ||||||
|  | 					err := Validate(fieldValue, field.Name) | ||||||
|  | 					if err != nil { | ||||||
|  | 						return err | ||||||
|  | 					} | ||||||
|  | 				} | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	case reflect.Slice: | 	case reflect.Slice: | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user