diff --git a/extensions/envoyproxy_validate/envoyproxy_validate.go b/extensions/envoyproxy_validate/envoyproxy_validate.go index c5b83e57..70941f65 100644 --- a/extensions/envoyproxy_validate/envoyproxy_validate.go +++ b/extensions/envoyproxy_validate/envoyproxy_validate.go @@ -73,6 +73,7 @@ func flattenRules(prefix string, vv reflect.Value) (rules []ValidateRule) { if vv.Len() == 0 { return nil } + fallthrough default: rules = append(rules, ValidateRule{Name: prefix, Value: vv.Interface()}) } diff --git a/extensions/envoyproxy_validate/envoyproxy_validate_test.go b/extensions/envoyproxy_validate/envoyproxy_validate_test.go index 3d5f3f10..7c6cae87 100644 --- a/extensions/envoyproxy_validate/envoyproxy_validate_test.go +++ b/extensions/envoyproxy_validate/envoyproxy_validate_test.go @@ -15,6 +15,7 @@ func TestTransform(t *testing.T) { Type: &validate.FieldRules_String_{ String_: &validate.StringRules{ MinLen: proto.Uint64(1), + NotIn: []string{"invalid"}, }, }, } @@ -25,5 +26,6 @@ func TestTransform(t *testing.T) { rules := transformed["validate.rules"].(ValidateExtension).Rules() require.Equal(t, rules, []ValidateRule{ {Name: "string.min_len", Value: uint64(1)}, + {Name: "string.not_in", Value: []string{"invalid"}}, }) }