Thanks to visit codestin.com
Credit goes to github.com

Skip to content

uuid validator not support github.com/google/uuid.UUID #294

@devhaozi

Description

@devhaozi

System (please complete the following information):

  • OS: macOS [e.g. linux, macOS]
  • GO Version: 1.24 [e.g. 1.13]
  • Pkg Version: v1.5.5 [e.g. 1.1.1]

Describe the bug

uuid validator not support github.com/google/uuid.UUID.

To Reproduce

package main

import (
	"fmt"

	"github.com/google/uuid"
	"github.com/gookit/validate"
)

type DepartmentID struct {
	ID uuid.UUID `uri:"id" validate:"required|uuid"`
}

func main() {
	data := DepartmentID{
		ID: uuid.New(),
	}
	err := validate.New(data).ValidateErr()
	if err != nil {
		fmt.Printf("Validation error: %v\n", err)
	} else {
		fmt.Println("OK")
	}
}

Expected behavior

No error.

Screenshots

Image

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions