Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
deankarn committed Jul 8, 2021
2 parents d074a05 + 9104fe2 commit d54fa74
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package validator
=================
<img align="right" src="https://raw.githubusercontent.com/go-playground/validator/v9/logo.png">[![Join the chat at https://gitter.im/go-playground/validator](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/go-playground/validator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
![Project status](https://img.shields.io/badge/version-10.6.1-green.svg)
![Project status](https://img.shields.io/badge/version-10.6.2-green.svg)
[![Build Status](https://travis-ci.org/go-playground/validator.svg?branch=master)](https://travis-ci.org/go-playground/validator)
[![Coverage Status](https://coveralls.io/repos/go-playground/validator/badge.svg?branch=master&service=github)](https://coveralls.io/github/go-playground/validator?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/go-playground/validator)](https://goreportcard.com/report/github.com/go-playground/validator)
Expand Down
2 changes: 1 addition & 1 deletion translations/ja/ja.go
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,7 @@ func RegisterDefaultTranslations(v *validator.Validate, trans ut.Translator) (er
},
{
tag: "uuid5",
translation: "{0}はバージョンが4の正しいUUIDでなければなりません",
translation: "{0}はバージョンが5の正しいUUIDでなければなりません",
override: false,
},
{
Expand Down
2 changes: 1 addition & 1 deletion translations/ja/ja_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ func TestTranslations(t *testing.T) {
},
{
ns: "Test.UUID5",
expected: "UUID5はバージョンが4の正しいUUIDでなければなりません",
expected: "UUID5はバージョンが5の正しいUUIDでなければなりません",
},
{
ns: "Test.ISBN",
Expand Down
2 changes: 1 addition & 1 deletion validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func (v *validate) traverseField(ctx context.Context, parent reflect.Value, curr
}
}

if !ct.hasTag {
if ct == nil || !ct.hasTag {
return
}

Expand Down
15 changes: 15 additions & 0 deletions validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3285,6 +3285,21 @@ func TestMapDiveValidation(t *testing.T) {
s := fmt.Sprint(errs.Error())
NotEqual(t, s, "")

type TestMapInterface struct {
Errs map[int]interface{} `validate:"dive"`
}

mit := map[int]interface{}{0: Inner{"ok"}, 1: Inner{""}, 3: nil, 5: "string", 6: 33}

msi := &TestMapInterface{
Errs: mit,
}

errs = validate.Struct(msi)
NotEqual(t, errs, nil)
Equal(t, len(errs.(ValidationErrors)), 1)
AssertError(t, errs, "TestMapInterface.Errs[1].Name", "TestMapInterface.Errs[1].Name", "Name", "Name", "required")

type TestMapTimeStruct struct {
Errs map[int]*time.Time `validate:"gt=0,dive,required"`
}
Expand Down

0 comments on commit d54fa74

Please sign in to comment.