Skip to content

Releases: go-playground/validator

Release v5.9

27 Jun 18:36

Choose a tag to compare

At long last support for traversing through slice, array and maps and validating at any or all levels!

see documentation for the new "dive" tag

benchmarks have slightly increased ns/op and B/ops for this functionality and an additional allocation for single field validation.

$ go test -cpu=4 -bench=. -benchmem=true
PASS
BenchmarkValidateField-4             3000000           439 ns/op         192 B/op          2 allocs/op
BenchmarkValidateStructSimple-4      1000000          2382 ns/op         656 B/op         10 allocs/op
BenchmarkTemplateParallelSimple-4    2000000           910 ns/op         656 B/op         10 allocs/op
BenchmarkValidateStructLarge-4        100000         13201 ns/op        4309 B/op         60 allocs/op
BenchmarkTemplateParallelLarge-4      300000          5240 ns/op        4311 B/op         60 allocs/op

for #78

Release 5.8.1

20 Jun 16:03

Choose a tag to compare

Fix Issue with nested struct as pointer being nil causing validation to fail

Release 5.8

17 Jun 14:05

Choose a tag to compare

RGB and RGBA regexes

updated to properly validate rgb 255 or rgb percentabe, it no longer allows mixing and matching; either all percentages or all numbers from 0-155

GODOC

Added some godoc examples to better illustrate functions usages

Validators

A huge shout out to @asaskevich for having allot of these validations that I ported from his govalidator, I would not have been able to add them so quickly without his groundwork, Thanks!

ADDED:
isbn10
isbn13
uuid
uuid3
uuid4
uuid5
ascii
printascii
multibyte
datauri
latitude
longitude
ssn

Release 5.7.1

09 Jun 01:51

Choose a tag to compare

merge change forgot to call new method in test to maintain my 100% test coverage

Release 5.7

09 Jun 01:38

Choose a tag to compare

add ability to use comma and = in params i.e. excludesall=,=
added some struct caching pool to reuse objects, reduce garbage collection and reduce memory allocations.

new benchmarks:

Old Benchmarks
$ go test -cpu=4 -bench=. -benchmem=true
PASS
BenchmarkValidateField-4             5000000           333 ns/op          16 B/op          1 allocs/op
BenchmarkValidateStructSimple-4       500000          2597 ns/op         752 B/op         13 allocs/op
BenchmarkTemplateParallelSimple-4    1000000          1138 ns/op         753 B/op         13 allocs/op
BenchmarkValidateStructLarge-4        100000         14663 ns/op        4806 B/op         78 allocs/op
BenchmarkTemplateParallelLarge-4      200000          7112 ns/op        4810 B/op         78 allocs/op

New Benchmarks
$ go test -cpu=4 -bench=. -benchmem=true
PASS
BenchmarkValidateField-4             5000000           318 ns/op          16 B/op          1 allocs/op
BenchmarkValidateStructSimple-4       500000          2471 ns/op         624 B/op         10 allocs/op
BenchmarkTemplateParallelSimple-4    2000000           975 ns/op         624 B/op         10 allocs/op
BenchmarkValidateStructLarge-4        100000         13979 ns/op        4293 B/op         66 allocs/op
BenchmarkTemplateParallelLarge-4      200000          5947 ns/op        4298 B/op         66 allocs/op

Release 5.6.1

08 Jun 20:52

Choose a tag to compare

Remove trimming of param option in tags as space could be a valid param option or char

for #63

Release 5.6

08 Jun 12:54

Choose a tag to compare

Implemented automatic struct and field schema/metadata caching
merged a documentation fix, thanks @xboston

New Performance Numbers!

Original Benchmarks
$ go test -bench=. -benchmem=true
PASS
BenchmarkValidateField   2000000           651 ns/op         176 B/op          5 allocs/op
BenchmarkValidateStruct   200000          6274 ns/op        1584 B/op         37 allocs/op

Optimized No Cache Benchmarks
$ go test -cpu=4 -bench=. -benchmem=true
PASS
BenchmarkValidateField-4             3000000           473 ns/op          80 B/op          4 allocs/op
BenchmarkValidateStructSimple-4       300000          5010 ns/op        1200 B/op         33 allocs/op
BenchmarkTemplateParallelSimple-4    1000000          2185 ns/op        1200 B/op         33 allocs/op
BenchmarkValidateStructLarge-4         50000         28706 ns/op        6980 B/op        201 allocs/op
BenchmarkTemplateParallelLarge-4      200000         14362 ns/op        6983 B/op        201 allocs/op

Optimized Cached Benchmarks
$ go test -cpu=4 -bench=. -benchmem=true
PASS
BenchmarkValidateField-4             5000000           333 ns/op          16 B/op          1 allocs/op
BenchmarkValidateStructSimple-4       500000          2597 ns/op         752 B/op         13 allocs/op
BenchmarkTemplateParallelSimple-4    1000000          1138 ns/op         753 B/op         13 allocs/op
BenchmarkValidateStructLarge-4        100000         14663 ns/op        4806 B/op         78 allocs/op
BenchmarkTemplateParallelLarge-4      200000          7112 ns/op        4810 B/op         78 allocs/op

Release 5.5.1

31 May 01:06

Choose a tag to compare

minor performance updates

Release 5.5

27 May 01:42

Choose a tag to compare

converted to native go testing

not changes but updating the testing file

Release 5.4

23 May 02:34

Choose a tag to compare

remove extra line breaks in error statements

add contains, containsany, containsrune, excludes, excludesall and excludes rune validation functions.