MCPcopy Create free account
hub / github.com/Permify/permify / validate

Method validate

pkg/pb/base/v1/base.pb.validate.go:2814–2884  ·  view source on GitHub ↗
(all bool)

Source from the content-addressed store, hash-verified

2812}
2813
2814func (m *TupleToUserSet) validate(all bool) error {
2815 if m == nil {
2816 return nil
2817 }
2818
2819 var errors []error
2820
2821 if all {
2822 switch v := interface{}(m.GetTupleSet()).(type) {
2823 case interface{ ValidateAll() error }:
2824 if err := v.ValidateAll(); err != nil {
2825 errors = append(errors, TupleToUserSetValidationError{
2826 field: "TupleSet",
2827 reason: "embedded message failed validation",
2828 cause: err,
2829 })
2830 }
2831 case interface{ Validate() error }:
2832 if err := v.Validate(); err != nil {
2833 errors = append(errors, TupleToUserSetValidationError{
2834 field: "TupleSet",
2835 reason: "embedded message failed validation",
2836 cause: err,
2837 })
2838 }
2839 }
2840 } else if v, ok := interface{}(m.GetTupleSet()).(interface{ Validate() error }); ok {
2841 if err := v.Validate(); err != nil {
2842 return TupleToUserSetValidationError{
2843 field: "TupleSet",
2844 reason: "embedded message failed validation",
2845 cause: err,
2846 }
2847 }
2848 }
2849
2850 if all {
2851 switch v := interface{}(m.GetComputed()).(type) {
2852 case interface{ ValidateAll() error }:
2853 if err := v.ValidateAll(); err != nil {
2854 errors = append(errors, TupleToUserSetValidationError{
2855 field: "Computed",
2856 reason: "embedded message failed validation",
2857 cause: err,
2858 })
2859 }
2860 case interface{ Validate() error }:
2861 if err := v.Validate(); err != nil {
2862 errors = append(errors, TupleToUserSetValidationError{
2863 field: "Computed",
2864 reason: "embedded message failed validation",
2865 cause: err,
2866 })
2867 }
2868 }
2869 } else if v, ok := interface{}(m.GetComputed()).(interface{ Validate() error }); ok {
2870 if err := v.Validate(); err != nil {
2871 return TupleToUserSetValidationError{

Callers 2

ValidateMethod · 0.95
ValidateAllMethod · 0.95

Calls 5

GetTupleSetMethod · 0.95
GetComputedMethod · 0.95
TupleToUserSetMultiErrorTypeAlias · 0.85
ValidateAllMethod · 0.45
ValidateMethod · 0.45

Tested by

no test coverage detected