Open pklanka opened 10 months ago
package main import ( "fmt" "github.com/go-playground/validator/v10" ) type SampleStruct struct { FileUrl string `json:"file_url" validate:"omitempty,url"` } func main() { Validator := validator.New() sample := SampleStruct{ FileUrl: "file://tmp/abcd", } if err := Validator.Struct(sample); err != nil { // this passes fmt.Println(err) } sample2 := SampleStruct{ FileUrl: "file:///tmp/abcd", } if err := Validator.Struct(sample2); err != nil { // this fails fmt.Println(err) } }
file:///tmp/abcd should a valid file URL - ref: https://jkorpela.fi/fileurl.html
Package version eg. v9, v10: v10
Issue, Question or Enhancement: Issue
Code sample, to showcase or reproduce: