Commit graph

883 commits

Author SHA1 Message Date
Dean Karn
f16354ec03 Add isdefault + fix fqdn
Closes #299
Fixes #306
2017-09-06 20:37:05 -07:00
Dean Karn
e3037695c7 Merge pull request #304 from aaronlehmann/doc-fixes
Documentation fixes
2017-08-30 09:14:21 -07:00
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.
2017-08-29 18:50:00 -07:00
Dean Karn
0d09605a05 100% test coverage 2017-08-20 10:02:01 -07:00
Dean Karn
0b5dc7605b Add isdefault validation 2017-08-20 09:53:47 -07:00
Dean Karn
893aecca31 Merge pull request #302 from pigi72333/v9
Fix doc typo
2017-08-20 09:22:08 -07:00
pigi72333
17c6ef0e87 Fix doc typo 2017-08-13 16:13:40 +03:00
Dean Karn
65480b6f6c Merge pull request #301 from lucasmundim/v9
Fix doc typo
2017-08-12 09:49:35 -07:00
Lucas Mundim
8e400db116 Fix doc typo 2017-08-09 19:31:21 -03:00
Dean Karn
5c4193d98e Update README.md 2017-08-06 21:33:52 -07:00
Dean Karn
d529ee1b0f Merge pull request #298 from senuphtyz/v9
Append new validations hostname and fqdn
2017-08-06 21:31:12 -07:00
Bruno Lorenz
dbd50b343f Code hygiene
- Minor performance improve for FQDN validation
- Fix typo in documentation
- Simplified hostname regex
2017-08-05 17:07:23 +02:00
Bruno Lorenz
1669b6e0ee Fixed "Assignment Branch Condition too high" 2017-08-05 09:12:57 +02:00
Bruno Lorenz
08796346a0 Append new validations
- hostname
- fqdn
2017-08-05 09:01:57 +02:00
Dean Karn
44d9acf0a8 Update README.md 2017-07-29 21:01:30 -07:00
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
2017-07-29 20:49:32 -07:00
Dean Karn
fb68f39656 Add Access to Field Name from FieldLevel (#284) 2017-06-11 22:26:53 -07:00
Dean Karn
27158c7a84 Update README.md 2017-04-05 07:15:46 -04:00
Dean Karn
6d8c18553e Merge pull request #278 from flebel/fix_typo
Fix typo
2017-04-05 07:11:23 -04:00
Dean Karn
755afb9dde Update README.md
Adjustments due to GitHub's new markdown parser
2017-03-27 15:13:06 -04:00
Francois Lebel
7a2859f38d Fix typo 2017-03-08 18:59:29 -08:00
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
2017-02-24 12:48:26 -05:00
Dean Karn
b250b44763 Update test & benchmarks
- Updated failing test for new translation error message.
- Updated benchmarks with new machine at the same time.
2017-02-14 02:20:42 -05:00
Dean Karn
691ea55063 Update README.md 2017-02-01 18:55:12 -05:00
Dean Karn
0cc1e78abb Merge pull request #271 from ellisonleao/patch-1
fix small doc typo
2017-02-01 18:53:55 -05:00
Ellison Leão
7cd869b083 fix small doc typo 2017-02-01 21:49:51 -02:00
Dean Karn
fb258d3590 Merge pull request #267 from osamingo/osamingo-patch-1
Fix usage of printable ascii
2016-12-27 07:09:17 -05:00
Osamu TONOMORI
cf230a98d7 Fix usage of printable ascii 2016-12-27 14:16:31 +09:00
Dean Karn
077c3830f3 Correct Namespace when array or map of structs
namespace was incorrect when array or map of structs, see #266
2016-12-22 21:45:03 -05:00
Dean Karn
49fccadad1 correct structonly functionality
- structonly wasn’t behaving correctly when not used with an accompanying struct validation.
2016-12-06 20:51:45 -05:00
Dean Karn
941ce2cabc Merge pull request #262 from go-playground/unicode-alphas
Add alphaunicode & aplhanumericunicode
2016-11-30 08:42:06 -05:00
Dean Karn
4d76b0dd81 Add alphaunicode & aplhanumericunicode
- added unicode variants of alpha & alphanumeric
2016-11-30 08:37:03 -05:00
Dean Karn
597f93b316 Merge branch 'correct-error-order' into v9 2016-11-15 20:36:43 -05:00
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%
2016-11-15 20:36:34 -05:00
Dean Karn
493dfb6209 correct required tag functionality for pointers, now works like old exists tag. 2016-09-28 10:56:49 -04:00
Dean Karn
506cc5da56 Add Filter logic 2016-09-25 13:48:20 -04:00
Dean Karn
0c0ae405d3 Update README.md 2016-09-22 19:10:05 -04:00
Dean Karn
335c8e2fac Merge pull request #256 from jawher/fix-goimports-diff
Fix universal translator imports so that goimports doesn't get remove them
2016-09-22 19:05:45 -04:00
Jawher Moussa
73e8e76de2 Fix universal translator imports so that goimports doesn't get remove them
Running goimports on the codebase deletes all the imports of "github.com/go-playground/universal-translator".

The fix consists of explicitly qualifying the import statements with ut.
2016-09-22 13:29:12 +02:00
Dean Karn
23e84d2f88 Update README.md 2016-09-19 11:36:13 -04:00
Dean Karn
678f8cf9a3 Merge branch 'field-level-validation2' into v9 2016-09-19 11:35:22 -04:00
Dean Karn
cddc415625 perf enhancements + corrected issue with or's
- or's weren't reporting the param back in the tag, long standing but noticed issue.
- added validation check for or's when more validations exist after the or.
2016-09-19 11:28:38 -04:00
Dean Karn
42a0d6df3b some minor perf with recursion 2016-09-17 14:12:20 -04:00
Dean Karn
7c2b5d8471 Update README.md 2016-09-16 13:24:00 -04:00
Dean Karn
4b3eedc379 Merge branch 'i18n-custom-errors' into v9 2016-09-15 15:58:17 -04:00
Dean Karn
110c8638eb add good documentation 2016-09-15 15:31:31 -04:00
Dean Karn
0e70fdfc72 add translation example + documentation 2016-09-15 15:31:07 -04:00
Dean Karn
a7ca4a1d32 add default translations for "en"
- need help creating more.
2016-09-15 14:50:04 -04:00
Dean Karn
532878b008 initial translation/custom error code 2016-09-14 14:48:46 -04:00
Dean Karn
6f98212623 Update CONTRIBUTING.md 2016-09-01 09:13:50 -04:00