ValidateFields checks the field values on GetUserRequest with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.
(paths ...string)
| 756 | // defined in the proto definition for this message. If any rules are |
| 757 | // violated, an error is returned. |
| 758 | func (m *GetUserRequest) ValidateFields(paths ...string) error { |
| 759 | if m == nil { |
| 760 | return nil |
| 761 | } |
| 762 | |
| 763 | if len(paths) == 0 { |
| 764 | paths = GetUserRequestFieldPathsNested |
| 765 | } |
| 766 | |
| 767 | for name, subs := range _processPaths(append(paths[:0:0], paths...)) { |
| 768 | _ = subs |
| 769 | switch name { |
| 770 | case "user_ids": |
| 771 | |
| 772 | if m.GetUserIds() == nil { |
| 773 | return GetUserRequestValidationError{ |
| 774 | field: "user_ids", |
| 775 | reason: "value is required", |
| 776 | } |
| 777 | } |
| 778 | |
| 779 | if v, ok := interface{}(m.GetUserIds()).(interface{ ValidateFields(...string) error }); ok { |
| 780 | if err := v.ValidateFields(subs...); err != nil { |
| 781 | return GetUserRequestValidationError{ |
| 782 | field: "user_ids", |
| 783 | reason: "embedded message failed validation", |
| 784 | cause: err, |
| 785 | } |
| 786 | } |
| 787 | } |
| 788 | |
| 789 | case "field_mask": |
| 790 | |
| 791 | if v, ok := interface{}(m.GetFieldMask()).(interface{ ValidateFields(...string) error }); ok { |
| 792 | if err := v.ValidateFields(subs...); err != nil { |
| 793 | return GetUserRequestValidationError{ |
| 794 | field: "field_mask", |
| 795 | reason: "embedded message failed validation", |
| 796 | cause: err, |
| 797 | } |
| 798 | } |
| 799 | } |
| 800 | |
| 801 | default: |
| 802 | return GetUserRequestValidationError{ |
| 803 | field: name, |
| 804 | reason: "invalid field path", |
| 805 | } |
| 806 | } |
| 807 | } |
| 808 | return nil |
| 809 | } |
| 810 | |
| 811 | // GetUserRequestValidationError is the validation error returned by |
| 812 | // GetUserRequest.ValidateFields if the designated constraints aren't met. |
no test coverage detected