Geoff Baskwill
866bd2a946
Support translating field errors when field is of kind reflect.Ptr
...
Previously, if fields were of kind `reflect.Ptr`, the translation of
validation errors used the default string, resulting in unexpected
output.
Now the default translations use the field's `Elem()` kind (for example
for `*string` the `Elem()` is `string`), resulting in much more natural
output.
7 years ago
Dean Karn
48a433ba4b
Merge pull request #336 from go-playground/correct-var-lock
...
Correct Var tagCache locking
7 years ago
Dean Karn
e00f5e092a
split out to function, defer is needed to handle panics
7 years ago
Dean Karn
b962f3d7d5
Correct Var tagCache locking
7 years ago
Dean Karn
230db62e07
update docs to clarify or vs tag separators ( #334 )
7 years ago
Dean Karn
b1f51f36f1
Correct consequtive or logic ( #330 )
7 years ago
Dean Karn
61caf9d303
add map key validation support ( #324 )
7 years ago
Dean Karn
1304298bf1
Update README.md
7 years ago
Dean Karn
11e5ebe8a1
Merge pull request #317 from go-playground/add-unique
...
Add unique
7 years ago
Dean Karn
34b84953ff
change related software
7 years ago
Dean Karn
11a1fab51d
Add unique validation
7 years ago
Dean Karn
946d444376
Add custom validation example
7 years ago
Dean Karn
a021b2ec9a
Merge pull request #307 from go-playground/fix_fqdn
...
Fix fqdn + add isdefault
7 years ago
Dean Karn
f16354ec03
Add isdefault + fix fqdn
...
Closes #299
Fixes #306
7 years ago
Dean Karn
e3037695c7
Merge pull request #304 from aaronlehmann/doc-fixes
...
Documentation fixes
7 years ago
Aaron Lehmann
770163b1e1
Documentation fixes
...
This fixes a few documentation issues I noticed.
- Explain what Func is supposed to return.
- Remove change reference to ActualNamespace to mention StructNamespace
instead.
- Remove references to Validatable, which no longer exists.
- Fix godoc formatting.
- Delete extra text from ReportValidationErrors comment.
- Change ReportError interface definition so its arguments are named
consistently with what they do.
7 years ago
Dean Karn
0d09605a05
100% test coverage
7 years ago
Dean Karn
0b5dc7605b
Add isdefault validation
7 years ago
Dean Karn
893aecca31
Merge pull request #302 from pigi72333/v9
...
Fix doc typo
7 years ago
pigi72333
17c6ef0e87
Fix doc typo
7 years ago
Dean Karn
65480b6f6c
Merge pull request #301 from lucasmundim/v9
...
Fix doc typo
7 years ago
Lucas Mundim
8e400db116
Fix doc typo
7 years ago
Dean Karn
5c4193d98e
Update README.md
7 years ago
Dean Karn
d529ee1b0f
Merge pull request #298 from senuphtyz/v9
...
Append new validations hostname and fqdn
7 years ago
Bruno Lorenz
dbd50b343f
Code hygiene
...
- Minor performance improve for FQDN validation
- Fix typo in documentation
- Simplified hostname regex
7 years ago
Bruno Lorenz
1669b6e0ee
Fixed "Assignment Branch Condition too high"
7 years ago
Bruno Lorenz
08796346a0
Append new validations
...
- hostname
- fqdn
7 years ago
Dean Karn
44d9acf0a8
Update README.md
7 years ago
Dean Karn
0f6f568263
Add contextual validation support via context.Context ( #296 )
...
* Add contextual validation support via context.Context
Added:
- RegisterValidationCtx
- RegisterStructValidationCtx
- StructCtx
- StructFilteredCtx
- StructPartialCtx
- StructExceptCtx
- VarCtx
- VarWithValueCtx
7 years ago
Dean Karn
fb68f39656
Add Access to Field Name from FieldLevel ( #284 )
8 years ago
Dean Karn
27158c7a84
Update README.md
8 years ago
Dean Karn
6d8c18553e
Merge pull request #278 from flebel/fix_typo
...
Fix typo
8 years ago
Dean Karn
755afb9dde
Update README.md
...
Adjustments due to GitHub's new markdown parser
8 years ago
Francois Lebel
7a2859f38d
Fix typo
8 years ago
Dean Karn
4bd1935852
Updated README
...
- Corrected some typos in README which Fixes #273
- Updated Benchmarks for Go 1.8
- updated lint issue in one of the tests
8 years ago
Dean Karn
b250b44763
Update test & benchmarks
...
- Updated failing test for new translation error message.
- Updated benchmarks with new machine at the same time.
8 years ago
Dean Karn
691ea55063
Update README.md
8 years ago
Dean Karn
0cc1e78abb
Merge pull request #271 from ellisonleao/patch-1
...
fix small doc typo
8 years ago
Ellison Leão
7cd869b083
fix small doc typo
8 years ago
Dean Karn
fb258d3590
Merge pull request #267 from osamingo/osamingo-patch-1
...
Fix usage of printable ascii
8 years ago
Osamu TONOMORI
cf230a98d7
Fix usage of printable ascii
8 years ago
Dean Karn
077c3830f3
Correct Namespace when array or map of structs
...
namespace was incorrect when array or map of structs, see #266
8 years ago
Dean Karn
49fccadad1
correct structonly functionality
...
- structonly wasn’t behaving correctly when not used with an accompanying struct validation.
8 years ago
Dean Karn
941ce2cabc
Merge pull request #262 from go-playground/unicode-alphas
...
Add alphaunicode & aplhanumericunicode
8 years ago
Dean Karn
4d76b0dd81
Add alphaunicode & aplhanumericunicode
...
- added unicode variants of alpha & alphanumeric
8 years ago
Dean Karn
597f93b316
Merge branch 'correct-error-order' into v9
8 years ago
Dean Karn
4e43fa1562
change field cache to array
...
- errors now come out in order for unit tests
- speed improvement using array vs map
benchmark old ns/op new ns/op delta
BenchmarkFieldSuccess-8 101 100 -0.99%
BenchmarkFieldSuccessParallel-8 33.2 33.7 +1.51%
BenchmarkFieldFailure-8 323 332 +2.79%
BenchmarkFieldFailureParallel-8 112 113 +0.89%
BenchmarkFieldDiveSuccess-8 719 714 -0.70%
BenchmarkFieldDiveSuccessParallel-8 230 225 -2.17%
BenchmarkFieldDiveFailure-8 1001 987 -1.40%
BenchmarkFieldDiveFailureParallel-8 323 317 -1.86%
BenchmarkFieldCustomTypeSuccess-8 263 264 +0.38%
BenchmarkFieldCustomTypeSuccessParallel-8 82.6 81.4 -1.45%
BenchmarkFieldCustomTypeFailure-8 327 328 +0.31%
BenchmarkFieldCustomTypeFailureParallel-8 116 116 +0.00%
BenchmarkFieldOrTagSuccess-8 871 878 +0.80%
BenchmarkFieldOrTagSuccessParallel-8 394 402 +2.03%
BenchmarkFieldOrTagFailure-8 568 569 +0.18%
BenchmarkFieldOrTagFailureParallel-8 397 401 +1.01%
BenchmarkStructLevelValidationSuccess-8 332 267 -19.58%
BenchmarkStructLevelValidationSuccessParallel-8 105 82.4 -21.52%
BenchmarkStructLevelValidationFailure-8 637 557 -12.56%
BenchmarkStructLevelValidationFailureParallel-8 260 226 -13.08%
BenchmarkStructSimpleCustomTypeSuccess-8 525 452 -13.90%
BenchmarkStructSimpleCustomTypeSuccessParallel-8 155 144 -7.10%
BenchmarkStructSimpleCustomTypeFailure-8 828 738 -10.87%
BenchmarkStructSimpleCustomTypeFailureParallel-8 345 285 -17.39%
BenchmarkStructFilteredSuccess-8 744 664 -10.75%
BenchmarkStructFilteredSuccessParallel-8 274 257 -6.20%
BenchmarkStructFilteredFailure-8 595 517 -13.11%
BenchmarkStructFilteredFailureParallel-8 250 195 -22.00%
BenchmarkStructPartialSuccess-8 674 608 -9.79%
BenchmarkStructPartialSuccessParallel-8 256 225 -12.11%
BenchmarkStructPartialFailure-8 928 848 -8.62%
BenchmarkStructPartialFailureParallel-8 399 360 -9.77%
BenchmarkStructExceptSuccess-8 1076 934 -13.20%
BenchmarkStructExceptSuccessParallel-8 237 200 -15.61%
BenchmarkStructExceptFailure-8 873 787 -9.85%
BenchmarkStructExceptFailureParallel-8 365 333 -8.77%
BenchmarkStructSimpleCrossFieldSuccess-8 539 489 -9.28%
BenchmarkStructSimpleCrossFieldSuccessParallel-8 201 168 -16.42%
BenchmarkStructSimpleCrossFieldFailure-8 788 709 -10.03%
BenchmarkStructSimpleCrossFieldFailureParallel-8 322 299 -7.14%
BenchmarkStructSimpleCrossStructCrossFieldSuccess-8 795 683 -14.09%
BenchmarkStructSimpleCrossStructCrossFieldSuccessParallel-8 241 211 -12.45%
BenchmarkStructSimpleCrossStructCrossFieldFailure-8 1110 940 -15.32%
BenchmarkStructSimpleCrossStructCrossFieldFailureParallel-8 399 333 -16.54%
BenchmarkStructSimpleSuccess-8 367 285 -22.34%
BenchmarkStructSimpleSuccessParallel-8 108 91.0 -15.74%
BenchmarkStructSimpleFailure-8 776 698 -10.05%
BenchmarkStructSimpleFailureParallel-8 307 284 -7.49%
BenchmarkStructComplexSuccess-8 2224 1622 -27.07%
BenchmarkStructComplexSuccessParallel-8 718 526 -26.74%
BenchmarkStructComplexFailure-8 5350 4717 -11.83%
BenchmarkStructComplexFailureParallel-8 2097 1853 -11.64%
8 years ago
Dean Karn
493dfb6209
correct required tag functionality for pointers, now works like old `exists` tag.
8 years ago
Dean Karn
506cc5da56
Add Filter logic
8 years ago
Dean Karn
0c0ae405d3
Update README.md
8 years ago