We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
in
not_in
The generated code for in/not_in rules for map keys/values does not include the lookup tables.
A failing test case is here: haines@41fe774
This generates invalid Go code (the same applies for C++):
message MapKeysValuesIn { map<string, string> val = 1 [(validate.rules).map = {keys: {string: {in: ["foo", "bar"]}}, values: {string: {in: ["baz", "qux"]}}}]; }
func (m *MapKeysValuesIn) validate(all bool) error { if m == nil { return nil } var errors []error { sorted_keys := make([]string, len(m.GetVal())) i := 0 for key := range m.GetVal() { sorted_keys[i] = key i++ } sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] }) for _, key := range sorted_keys { val := m.GetVal()[key] _ = val if _, ok := _MapKeysValuesIn_Val_InLookup[key]; !ok { err := MapKeysValuesInValidationError{ field: fmt.Sprintf("Val[%v]", key), reason: "value must be in list [foo bar]", } if !all { return err } errors = append(errors, err) } if _, ok := _MapKeysValuesIn_Val_InLookup[val]; !ok { err := MapKeysValuesInValidationError{ field: fmt.Sprintf("Val[%v]", key), reason: "value must be in list [baz qux]", } if !all { return err } errors = append(errors, err) } } } if len(errors) > 0 { return MapKeysValuesInMultiError(errors) } return nil }
There are two issues that need to be solved
_MapKeysValuesIn_Val_InLookup
The text was updated successfully, but these errors were encountered:
#619 #673
Sorry, something went wrong.
No branches or pull requests
The generated code for
in
/not_in
rules for map keys/values does not include the lookup tables.A failing test case is here: haines@41fe774
This generates invalid Go code (the same applies for C++):
There are two issues that need to be solved
_MapKeysValuesIn_Val_InLookup
) is not defined anywhere, so the code doesn't compile._MapKeysValuesIn_Val_InLookup
, but they should be referring to different lookups.The text was updated successfully, but these errors were encountered: