Skip to content
Snippets Groups Projects
Commit 62309c8c authored by Fabian Seidl's avatar Fabian Seidl
Browse files

fix use of deprecated field of struct, needs helper because non comparable impl.MessageState

parent dcc90ec7
No related branches found
No related tags found
1 merge request!1116[renovate] Update module buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go to v1.35.2-20241127180247-a33202765966.1
Pipeline #239088 passed
This commit is part of merge request !1116. Comments created here will be created in the context of that merge request.
......@@ -9,7 +9,7 @@ import (
func contains(array []*validate.Violation, err *validate.Violation) bool {
for _, v := range array {
if *v.FieldPath == *err.FieldPath && *v.ConstraintId == *err.ConstraintId && *v.Message == *err.Message {
if isEqualFieldPaths(v.Field, err.Field) && *v.ConstraintId == *err.ConstraintId && *v.Message == *err.Message {
return true
}
}
......@@ -17,6 +17,20 @@ func contains(array []*validate.Violation, err *validate.Violation) bool {
return false
}
func isEqualFieldPaths(violationFieldPath, errFieldPath *validate.FieldPath) bool {
if len(violationFieldPath.GetElements()) != len(errFieldPath.GetElements()) {
return false
}
for i, elem := range violationFieldPath.GetElements() {
if elem != errFieldPath.GetElements()[i] {
return false
}
}
return true
}
func assertValidationErrors(t *testing.T, err error, expectedValidationErrors []*validate.Violation) {
st := status.Convert(err)
errDetails := st.Details()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment