Skip to content

Commit

Permalink
Fix FieldPathString parameter type (#182)
Browse files Browse the repository at this point in the history
I guess this got messed up during the refactor, and I just simply missed
it when re-exporting. Oops :(
  • Loading branch information
jchadwick-buf authored Jan 31, 2025
1 parent 4459217 commit 107b51b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions error_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ func finalizeViolationPaths(err error) {

// FieldPathString takes a FieldPath and encodes it to a string-based dotted
// field path.
func FieldPathString(path []*validate.FieldPathElement) string {
func FieldPathString(path *validate.FieldPath) string {
var result strings.Builder
for i, element := range path {
for i, element := range path.GetElements() {
if i > 0 {
result.WriteByte('.')
}
Expand Down
2 changes: 1 addition & 1 deletion validation_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (err *ValidationError) Error() string {
bldr.WriteString("validation error:")
for _, violation := range err.Violations {
bldr.WriteString("\n - ")
if fieldPath := FieldPathString(violation.Proto.GetField().GetElements()); fieldPath != "" {
if fieldPath := FieldPathString(violation.Proto.GetField()); fieldPath != "" {
bldr.WriteString(fieldPath)
bldr.WriteString(": ")
}
Expand Down

0 comments on commit 107b51b

Please sign in to comment.