Commit graph

154 commits

Author SHA1 Message Date
Dean Karn
456221b630
Fix time.Duration parsing for int param (#678)
This fixes an issue where if the param of a time.Durtion type is specified
as an integer, denoting nanosecond precision, instead of time duration
string the validation would panic.

the fixes ensures it falls back to the previous expected behaviour.
2020-10-17 08:49:42 -07:00
krhubert
f32fea830e
Add country code validation (#615) 2020-09-27 15:46:23 -07:00
Elias Rodrigues
4407f4dea0
Add checksum validation for Ethereum address (#630) 2020-09-27 12:04:32 -07:00
Dean Karn
f0805c61ba
Merge pull request #641 from math-nao/master
Add support for time zone validation
2020-09-27 11:47:15 -07:00
Dean Karn
76981ccf75
Merge pull request #642 from elias19r/issue-584-add-support-for-time-duration-type
Add support for time.Duration type
2020-09-27 11:45:09 -07:00
Dean Karn
57b4fab34b
Merge pull request #644 from longit644/bugfix/make-unique-tag-work-with-pointer-fields
Make unique tag work with pointer fields.
2020-09-27 11:42:30 -07:00
Dean Karn
e6eee3ea88
Merge branch 'master' into master 2020-09-27 11:25:00 -07:00
root
742006d126 Closes #660 added excluded with and without 2020-09-15 18:13:38 +02:00
hzw
44a150f359 add required_if and required_unless 2020-09-03 20:34:19 +08:00
math-nao
7dbe685a02 Update timeZone tag name to timezone 2020-08-02 13:59:46 +02:00
Long Bui
67c4fdf0de Make unique tag work with pointer fields. 2020-07-29 23:07:14 +07:00
Elias Rodrigues
1cbd3081e4 Add function asIntFromType 2020-07-28 11:47:26 -03:00
Elias Rodrigues
04749bc4d4 Fix golangci-lint issues 2020-07-25 23:06:22 -03:00
Elias Rodrigues
48684f91aa Add baked-in support for time.Duration 2020-07-25 23:02:42 -03:00
math-nao
44f3347f13 Add support for time zone validation 2020-07-25 19:39:27 +02:00
Dean Karn
50166a5a06
Merge branch 'master' into bugfix/fqdn 2020-05-20 23:06:53 -07:00
Giuliano Scaglioni
7d6236a898 add updated regex for fqdn 2020-05-20 21:15:27 -03:00
Milan Divkovic
f3b347cc29 Add validators that check if string does not start/end with supplied parameter 2020-02-19 10:15:03 +01:00
Pantelis Sampaziotis
14f963703b Add datetime validation 2020-02-09 19:28:20 +02:00
Dean Karn
0c80f876cd Merge branch 'master' into json 2020-02-09 09:11:31 -08:00
Dean Karn
1f676c755a
Merge branch 'master' into master 2020-02-09 08:59:24 -08:00
Pantelis Sampaziotis
9e58bcdee1 Empty strings are not lowercase or uppercase 2020-02-07 16:30:58 +02:00
Pantelis Sampaziotis
5b51bff4e6 Add isLowercase and isUppercase valitation 2020-02-05 22:39:47 +02:00
Pantelis Sampaziotis
581d2698d5 Added isJSON validation 2020-02-04 18:04:58 +02:00
Ravi Terala
893747e5ee Add hostname_port validator feature 2020-01-03 11:30:08 -08:00
Shi Han NG
8f604265e0 Implement unique=FieldName 2019-12-24 20:28:41 -08:00
Taylor
e7c70798c9 Add e.164 support 2019-12-24 20:08:33 -08:00
Dean Karn
a6a294bfeb
Merge pull request #541 from JonathanWThom/jt/space-separated-oneof
Adds ability to validate oneof for space separated strings
2019-12-24 10:54:55 -08:00
Dean Karn
1d93fb999e
Merge pull request #547 from atomicleads/master
Added boolean type support for “eq” validator
2019-12-24 10:37:35 -08:00
Nguyễn Văn Hưng
da6897303a error is always nil 2019-12-18 17:57:44 +07:00
Jonathan Thom
685d3e21f3
Makes regex constant & moves single quote replace logic to parseOneOfParam2 2019-11-20 20:04:39 -08:00
Dmitry M. Gavrovsky
dfc652373a Added boolean type support for “eq” validator 2019-11-19 21:00:18 +02:00
Dean Karn
c0f05c7b3d fix required_* 2019-11-17 13:02:10 -08:00
Jonathan Thom
432c17028a
Adds ability to validate oneof for space separated strings
Fixes Or Enhances https://github.com/go-playground/validator/issues/525.

**Make sure that you've checked the boxes below before you submit PR:**
- [x] Tests exist or have been written that cover this particular change.

Change Details:

* Adds the ability to match on space separated strings when using the
`oneof` validation. Space separted strings must be surrounded by single
quotes to be validated as one string. For example:

```
oneof='Awaiting Verification' 'Verified' 'Failed Verification'
```

passes validation for a field that is exactly `Failed Verification`
(though just `Failed` would...fail).

@go-playground/admins
2019-11-16 23:12:25 -08:00
Dean Karn
6484d9f2fb fix required_with_* 2019-09-29 14:12:27 -07:00
Dean Karn
cc25246f01 fix required_without_* 2019-09-29 13:39:27 -07:00
Zuyang Kou
54db112759 Make required_without work with pointer
Fix #483, #473
2019-06-14 03:06:35 +08:00
A Mashmooli
8c221696bb simplify required check field kind 2019-05-01 16:39:21 +04:30
A Mashmooli
3ec10f9949 add required_without_all validator 2019-04-29 16:05:30 +04:30
A Mashmooli
03bfd38cc1 add required_without validator 2019-04-29 16:01:11 +04:30
A Mashmooli
ebfddc5784 add required_with_all validator 2019-04-29 15:46:48 +04:30
A Mashmooli
1e6bddb6b3 fix comment 2019-04-29 15:35:35 +04:30
A Mashmooli
adbd5e9b33 add required_with validator 2019-04-29 15:32:37 +04:30
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.
2019-03-15 15:30:07 -06:00
Dean Karn
1b32ac03ca
Merge pull request #450 from agalal/add-dir-validator
Add validation for directories
2019-02-12 07:19:04 -08:00
Dean Karn
e10c2c9ddb
Merge pull request #440 from RaMin0/feature/numeric_geo_coords
Allow latitude/longitude validation for numeric values
2019-02-12 07:18:23 -08:00
Abdallah Galal
94ba218708 Add validation for directories 2019-02-08 16:03:16 +01:00
Ramy Aboul Naga
cbd5cf6393 Use type switch in favor of fmt.Sprint 2019-01-28 11:14:55 +01:00
Rohan Sathe
76020d061e Fixes #26 (#437) 2019-01-27 21:00:13 -08:00
Ramy Aboul Naga
52ea448998 Allow latitude/longitude validation for numeric values 2019-01-26 18:06:17 +01:00