• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

go-playground / validator / 14502637003
74%
v8: 100%

Build:
Build:
LAST BUILD BRANCH: master
DEFAULT BRANCH: v8
Ran 16 Apr 2025 09:09PM UTC
Jobs 1
Files 34
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

16 Apr 2025 09:08PM UTC coverage: 73.653% (+0.05%) from 73.607%
14502637003

push

github

web-flow
add support to tag validateFn (#1363)

## Fixes Or Enhances

This Pull Requests adds a new tag called `isvalid`

If the field is marked with the validator tag `isvalid`, the type must
implement the interface `Validate() error` and the return must be nil to
be considered `valid`

A possible use case is: when dealing with Enumerations, the type can
support a method `Validate() error` to check if the value is in specific
the range defined. If we use
[enumer](https://github.com/dmarkham/enumer) it generates a `IsA<Type>()
bool` method that can be used to verify if the enumeration is valid or
not, instead force the `oneof` tag (that needs to be always updated when
we add one new value.

I wrote a pull request to add a Validate method on enumerations
[here](https://github.com/dmarkham/enumer/pull/102) and the interface
`Validate() error` seems pretty common.

It may clash with existing tags that people may register, this is
something that I don't know how to solve.

**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.

@go-playground/validator-maintainers

---------

Co-authored-by: nodivbyzero <nodivbyzero@gmail.com>

51 of 53 new or added lines in 2 files covered. (96.23%)

14310 of 19429 relevant lines covered (73.65%)

73.61 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
2
96.04
-0.02% baked_in.go
Jobs
ID Job ID Ran Files Coverage
1 14502637003.1 16 Apr 2025 09:09PM UTC 34
73.65
GitHub Action Run
Source Files on build 14502637003
  • Tree
  • List 34
  • Changed 4
  • Source Changed 0
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 8032f400 on github
  • Prev Build on master (#14408902078)
  • Next Build on master (#14502736801)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc