[#2868] fixed unique validator detailed error message not being returned when camelCase field name is used

This commit is contained in:
Gani Georgiev
2023-07-06 23:14:18 +03:00
parent 08b4fc20a9
commit d77479131a
2 changed files with 120 additions and 9 deletions

View File

@@ -896,7 +896,7 @@ func (form *RecordUpsert) prepareError(err error) error {
c := form.record.Collection()
for _, f := range c.Schema.Fields() {
// blank space to unify multi-columns lookup
if strings.Contains(msg+" ", fmt.Sprintf("%s.%s ", strings.ToLower(c.Name), f.Name)) {
if strings.Contains(msg+" ", strings.ToLower(c.Name+"."+f.Name)) {
validationErrs[f.Name] = validation.NewError("validation_not_unique", "Value must be unique")
}
}