Tyler Cipriani
3945da16ee
Add `startswith` and `endswith` validators
...
`HasPrefix` and `HasSuffix` are both part of the `strings` package.
These seem like generally useful validations to include and cover some
subset of the use-cases of a general regex validator without having any
of the problems outlined by the validator docs.
6 years ago
Abdallah Galal
94ba218708
Add validation for directories
6 years ago
Ramy Aboul Naga
d1d2da5f73
Fix typo in isLongitude test
6 years ago
Ramy Aboul Naga
cbd5cf6393
Use type switch in favor of fmt.Sprint
6 years ago
Rohan Sathe
76020d061e
Fixes #26 ( #437 )
6 years ago
Ramy Aboul Naga
52ea448998
Allow latitude/longitude validation for numeric values
6 years ago
franklin
91d81934ab
Add baked in validators for containsfield and excludesfield ( #424 )
...
* Add baked in validators for containsfield and excludesfield
* Add ContainsAndExcludes test
* Add NotEqual tests before AssertError
* Add tests for missing fields
* containsfield -> fieldcontains, excludesfield -> fieldexcludes
6 years ago
Leonardo Di Donato
0482874b86
Update: Rename urn tag into urn_rfc2141
...
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
6 years ago
Leonardo Di Donato
c5423e4116
New: URN
...
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
6 years ago
andreas
8ed00e2e12
Change behavior instead of error, we Indirect it to get the non-pointer value
6 years ago
andreas
9eeca29136
detail error message on RegisterStructValidationCtx finding pointer arg
6 years ago
andreas
5b14fca011
Returns error when passing pointer to RegisterStructValidation
6 years ago
heatwole
0a9b75fbfd
Adding html and url encoding and updating docs
6 years ago
Noi Bar
f2fdb60d7d
Add file path validation
7 years ago
Dean Karn
ffe836d736
Expanded numeric & number validations
...
It was originally intended for these to only be used on strings, however
it makes sense to also use them if your dealing with type interface{}
so now ints and floats return true for this validation also as they are
both numeric and numbers.
closes #356
7 years ago
Joachim Adomeit
379fb67047
Fix for Email - Hostname is not validated correctly #359
7 years ago
Dean Karn
54da7fa48f
fix linting and spelling errors
7 years ago
James Service
8ae3903dd3
Extend the unique tag to also cover map values.
7 years ago
josh
073682ea75
added in more test cases and removed some redundant validation steps
7 years ago
josh
ce6284a6fc
confirm only all upper or all lower case address are valid
7 years ago
josh
6deddf27eb
proper bech32 address validation
7 years ago
josh
3df85bdcfc
p2sh validation and more tests
7 years ago
josh
60417282a4
verifies p2pkh addresses
7 years ago
josh
36d83b0b83
Added in validation function, tests, and docs
7 years ago
Kyriakos Georgiou
030800a855
Add validation for base64 URL safe values
7 years ago
Russ Egan
15217303f9
Add oneof validation
...
Validates that a string or number value equals one of a set of allowed values. Examples:
validator.Var(“red”, “oneof=red green”)
validator.Var(6, “oneof=6 7 8”)
7 years ago
Dean Karn
5e036656b8
Add hostname_rfc1123 validation
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
11a1fab51d
Add unique validation
7 years ago
Dean Karn
f16354ec03
Add isdefault + fix fqdn
...
Closes #299
Fixes #306
7 years ago
Dean Karn
0d09605a05
100% test coverage
7 years ago
Dean Karn
0b5dc7605b
Add isdefault validation
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
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
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
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
4d76b0dd81
Add alphaunicode & aplhanumericunicode
...
- added unicode variants of alpha & alphanumeric
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
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.
8 years ago
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.
8 years ago
Dean Karn
532878b008
initial translation/custom error code
8 years ago
joeybloggs
6765805f88
continuing perf optimizations
8 years ago
joeybloggs
01925e342a
regain 100% test coverage
8 years ago
joeybloggs
98dee40973
perf updates all around!
8 years ago