-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for time.Duration type #642
Add support for time.Duration type #642
Conversation
Hi,It breaks our code! type Type struct {
Field time.Duration `yaml:"field" validate:"required,min=5,max=300"`
} field: 5 And get this
|
Thank you for letting us know! I'm sorry to hear that To maintain backward compatibility, should we handle this Lines 233 to 240 in d6b17fd
What do you think? @deankarn @islishude |
I suggest reverting this commit. my code is the same as below
|
Thanks for reporting @islishude I'll try and take a look at this tonight after work, I think we just have to handle parsing of the param as an integer value also which will fix this. |
@islishude @elias19r This has been fixed in release 10.4.1 |
Fixes Or Enhances #584
Make sure that you've checked the boxes below before you submit PR:
Change Details:
Validations for
time.Duration
eq=
isEq()
TestIsEqValidation()
ne=
isNe()
(not changed)TestIsNeValidation()
lt=
isLt()
TestIsLt()
lte=
isLte()
TestIsLte()
gt=
isGt()
TestIsGt()
gte=
isGte()
TestIsGte()
min=
hasMinOf()
(not changed)TestMinValidation()
(new),TestMinMaxValidation()
(new)max=
hasMaxOf()
(not changed)TestMaxValidation()
(new),TestMinMaxValidation()
(new)len=
hasLengthOf()
TestLenValidation()
(new)Cross-Field Validations for
time.Duration
eqfield=
isEqField()
(not changed)TestIsEqFieldValidation()
nefield=
isNeField()
(not changed)TestIsNeFieldValidation()
ltfield=
isLtField()
(not changed)TestLtField()
ltefield=
isLteField()
(not changed)TestLteField()
gtfield=
isGtField()
(not changed)TestGtField()
gtefield=
isGteField()
(not changed)TestGteField()
Cross-Field Validations for
time.Duration
(within a separate struct)eqcsfield=
isEqCrossStructField()
(not changed)TestCrossStructEqFieldValidation()
necsfield=
isNeCrossStructField()
(not changed)TestCrossStructNeFieldValidation()
ltcsfield=
isLtCrossStructField()
(not changed)TestCrossStructLtFieldValidation()
ltecsfield=
isLteCrossStructField()
(not changed)TestCrossStructLteFieldValidation()
gtcsfield=
isGtCrossStructField()
(not changed)TestCrossStructGtFieldValidation()
gtecsfield=
isGteCrossStructField()
(not changed)TestCrossStructGteFieldValidation()
Special
omitempty
required
hasValue()
(not changed)isdefault
isDefault()
(not changed)Docs
Updated in the
doc.go
file.@go-playground/admins