{"id":42699928,"url":"https://github.com/flamego/validator","last_synced_at":"2026-01-29T14:15:48.015Z","repository":{"id":43275466,"uuid":"398354163","full_name":"flamego/validator","owner":"flamego","description":"💯 Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving","archived":false,"fork":false,"pushed_at":"2023-08-15T02:36:25.000Z","size":1931,"stargazers_count":10,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-06-20T19:30:05.697Z","etag":null,"topics":["go","lsif-enabled","validation"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flamego.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-20T17:31:07.000Z","updated_at":"2022-11-09T18:13:22.000Z","dependencies_parsed_at":"2024-06-20T19:24:41.295Z","dependency_job_id":null,"html_url":"https://github.com/flamego/validator","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/flamego/validator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flamego%2Fvalidator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flamego%2Fvalidator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flamego%2Fvalidator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flamego%2Fvalidator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flamego","download_url":"https://codeload.github.com/flamego/validator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flamego%2Fvalidator/sbom","scorecard":{"id":402471,"data":{"date":"2025-08-11","repo":{"name":"github.com/flamego/validator","commit":"f010475728f1c37de6df5955ba9b2d5ac3a9183b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.9,"checks":[{"name":"Code-Review","score":1,"reason":"Found 4/30 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/go.yml:1","Warn: no topLevel permission defined: .github/workflows/lsif.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/flamego/validator/go.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:43: update your workflow using https://app.stepsecurity.io/secureworkflow/flamego/validator/go.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/go.yml:49: update your workflow using https://app.stepsecurity.io/secureworkflow/flamego/validator/go.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/flamego/validator/go.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/go.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/flamego/validator/go.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lsif.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/flamego/validator/lsif.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/lsif.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/flamego/validator/lsif.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/lsif.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/flamego/validator/lsif.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/lsif.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/flamego/validator/lsif.yml/main?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   5 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"10 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2022-0968 / GHSA-gwc9-m7rh-j2ww","Warn: Project is vulnerable to: GO-2021-0356 / GHSA-8c26-wmh5-6g9v","Warn: Project is vulnerable to: GO-2024-2961","Warn: Project is vulnerable to: GO-2023-2402 / GHSA-45x7-px36-x8w8","Warn: Project is vulnerable to: GO-2024-3321 / GHSA-v778-237x-gjrc","Warn: Project is vulnerable to: GO-2025-3487 / GHSA-hcg3-q754-cr77","Warn: Project is vulnerable to: GO-2022-0493 / GHSA-p782-xgp4-8hr8","Warn: Project is vulnerable to: GO-2021-0113 / GHSA-ppp9-7jff-5vj2","Warn: Project is vulnerable to: GO-2022-1059 / GHSA-69ch-w2m2-3vjp","Warn: Project is vulnerable to: GO-2022-0603 / GHSA-hp87-p4gw-j4gq"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 7 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T20:23:13.001Z","repository_id":43275466,"created_at":"2025-08-18T20:23:13.001Z","updated_at":"2025-08-18T20:23:13.001Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28879194,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T10:31:27.438Z","status":"ssl_error","status_checked_at":"2026-01-29T10:31:01.017Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","lsif-enabled","validation"],"created_at":"2026-01-29T14:15:47.451Z","updated_at":"2026-01-29T14:15:47.993Z","avatar_url":"https://github.com/flamego.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# validator\n\n[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/flamego/validator/Go?logo=github\u0026style=for-the-badge)](https://github.com/flamego/validator/actions?query=workflow%3AGo)\n[![Codecov](https://img.shields.io/codecov/c/gh/flamego/validator?logo=codecov\u0026style=for-the-badge)](https://app.codecov.io/gh/flamego/validator)\n[![GoDoc](https://img.shields.io/badge/GoDoc-Reference-blue?style=for-the-badge\u0026logo=go)](https://pkg.go.dev/github.com/flamego/validator?tab=doc)\n[![Sourcegraph](https://img.shields.io/badge/view%20on-Sourcegraph-brightgreen.svg?style=for-the-badge\u0026logo=sourcegraph)](https://sourcegraph.com/github.com/flamego/validator)\n\n_This is a modified version based off [`github.com/go-playground/validator/v10`](https://github.com/go-playground/validator) to have better i18n support for the [binding](https://github.com/flamego/binding) middleware._\n\nPackage validator implements value validations for structs and individual fields based on tags.\n\nIt has the following **unique** features:\n\n- Cross Field and Cross Struct validations by using validation tags or custom validators.\n- Slice, Array and Map diving, which allows any or all levels of a multidimensional field to be validated.\n- Ability to dive into both map keys and values for validation\n- Handles type interface by determining it's underlying type prior to validation.\n- Handles custom field types such as sql driver Valuer see [Valuer](https://golang.org/src/database/sql/driver/types.go?s=1210:1293#L29)\n- Alias validation tags, which allows for mapping of several validations to a single tag for easier defining of validations on structs\n- Extraction of custom defined Field Name e.g. can specify to extract the JSON name while validating and have it available in the resulting FieldError\n- Customizable i18n aware error messages.\n\n## Installation\n\nThe minimum requirement of Go is **1.16**.\n\n\tgo get github.com/flamego/validator\n\n## Error return value\n\nValidation functions return type error to avoid the issue discussed in the following, where err is always != nil:\n\n* http://stackoverflow.com/a/29138676/3158232\n* https://github.com/go-playground/validator/issues/134\n\nValidator returns only InvalidValidationError for bad validation input, nil or ValidationErrors as type error; so, in your code all you need to do is check if the error returned is not nil, and if it's not check if error is InvalidValidationError ( if necessary, most of the time it isn't ) type cast it to type ValidationErrors like so:\n\n```go\nerr := validate.Struct(mystruct)\nvalidationErrors := err.(validator.ValidationErrors)\n```\n\n## Usage and documentation\n\nPlease see https://pkg.go.dev/github.com/go-playground/validator/v10 for detailed usage docs.\n\n##### Examples\n\n- [Simple](https://github.com/go-playground/validator/blob/master/_examples/simple/main.go)\n- [Custom Field Types](https://github.com/go-playground/validator/blob/master/_examples/custom/main.go)\n- [Struct Level](https://github.com/go-playground/validator/blob/master/_examples/struct-level/main.go)\n- [Translations \u0026 Custom Errors](https://github.com/go-playground/validator/blob/master/_examples/translations/main.go)\n- [wash - an example application putting it all together](https://github.com/bluesuncorp/wash)\n\n## Baked-in validations\n\n### Fields\n\n| Tag | Description |\n| - | - |\n| eqcsfield | Field Equals Another Field (relative)|\n| eqfield | Field Equals Another Field |\n| fieldcontains | NOT DOCUMENTED IN doc.go |\n| fieldexcludes | NOT DOCUMENTED IN doc.go |\n| gtcsfield | Field Greater Than Another Relative Field |\n| gtecsfield | Field Greater Than or Equal To Another Relative Field |\n| gtefield | Field Greater Than or Equal To Another Field |\n| gtfield | Field Greater Than Another Field |\n| ltcsfield | Less Than Another Relative Field |\n| ltecsfield | Less Than or Equal To Another Relative Field |\n| ltefield | Less Than or Equal To Another Field |\n| ltfield | Less Than Another Field |\n| necsfield | Field Does Not Equal Another Field (relative) |\n| nefield | Field Does Not Equal Another Field |\n\n### Network\n\n| Tag | Description |\n| - | - |\n| cidr | Classless Inter-Domain Routing CIDR |\n| cidrv4 | Classless Inter-Domain Routing CIDRv4 |\n| cidrv6 | Classless Inter-Domain Routing CIDRv6 |\n| datauri | Data URL |\n| fqdn | Full Qualified Domain Name (FQDN) |\n| hostname | Hostname RFC 952 |\n| hostname_port | HostPort |\n| hostname_rfc1123 | Hostname RFC 1123 |\n| ip | Internet Protocol Address IP |\n| ip4_addr | Internet Protocol Address IPv4 |\n| ip6_addr | Internet Protocol Address IPv6 |\n| ip_addr | Internet Protocol Address IP |\n| ipv4 | Internet Protocol Address IPv4 |\n| ipv6 | Internet Protocol Address IPv6 |\n| mac | Media Access Control Address MAC |\n| tcp4_addr | Transmission Control Protocol Address TCPv4 |\n| tcp6_addr | Transmission Control Protocol Address TCPv6 |\n| tcp_addr | Transmission Control Protocol Address TCP |\n| udp4_addr | User Datagram Protocol Address UDPv4 |\n| udp6_addr | User Datagram Protocol Address UDPv6 |\n| udp_addr | User Datagram Protocol Address UDP |\n| unix_addr | Unix domain socket end point Address |\n| uri | URI String |\n| url | URL String |\n| url_encoded | URL Encoded |\n| urn_rfc2141 | Urn RFC 2141 String |\n\n### Strings\n\n| Tag | Description |\n| - | - |\n| alpha | Alpha Only |\n| alphanum | Alphanumeric |\n| alphanumunicode | Alphanumeric Unicode |\n| alphaunicode | Alpha Unicode |\n| ascii | ASCII |\n| boolean | Boolean |\n| contains | Contains |\n| containsany | Contains Any |\n| containsrune | Contains Rune |\n| endsnotwith | Ends With |\n| endswith | Ends With |\n| excludes | Excludes |\n| excludesall | Excludes All |\n| excludesrune | Excludes Rune |\n| lowercase | Lowercase |\n| multibyte | Multi-Byte Characters |\n| number | NOT DOCUMENTED IN doc.go |\n| numeric | Numeric |\n| printascii | Printable ASCII |\n| startsnotwith | Starts Not With |\n| startswith | Starts With |\n| uppercase | Uppercase |\n\n### Format\n\n| Tag | Description |\n| - | - |\n| base64 | Base64 String |\n| base64url | Base64URL String |\n| bic | Business Identifier Code (ISO 9362) |\n| bcp47_language_tag | Language tag (BCP 47) |\n| btc_addr | Bitcoin Address |\n| btc_addr_bech32 | Bitcoin Bech32 Address (segwit) |\n| datetime | Datetime |\n| e164 | e164 formatted phone number |\n| email | E-mail String\n| eth_addr | Ethereum Address |\n| hexadecimal | Hexadecimal String |\n| hexcolor | Hexcolor String |\n| hsl | HSL String |\n| hsla | HSLA String |\n| html | HTML Tags |\n| html_encoded | HTML Encoded |\n| isbn | International Standard Book Number |\n| isbn10 | International Standard Book Number 10 |\n| isbn13 | International Standard Book Number 13 |\n| iso3166_1_alpha2 | Two-letter country code (ISO 3166-1 alpha-2) |\n| iso3166_1_alpha3 | Three-letter country code (ISO 3166-1 alpha-3) |\n| iso3166_1_alpha_numeric | Numeric country code (ISO 3166-1 numeric) |\n| iso3166_2 | Country subdivision code (ISO 3166-2) |\n| iso4217 | Currency code (ISO 4217) |\n| json | JSON |\n| jwt | JSON Web Token (JWT) |\n| latitude | Latitude |\n| longitude | Longitude |\n| postcode_iso3166_alpha2 | Postcode |\n| postcode_iso3166_alpha2_field | Postcode |\n| rgb | RGB String |\n| rgba | RGBA String |\n| ssn | Social Security Number SSN |\n| timezone | Timezone |\n| uuid | Universally Unique Identifier UUID |\n| uuid3 | Universally Unique Identifier UUID v3 |\n| uuid3_rfc4122 | Universally Unique Identifier UUID v3 RFC4122 |\n| uuid4 | Universally Unique Identifier UUID v4 |\n| uuid4_rfc4122 | Universally Unique Identifier UUID v4 RFC4122 |\n| uuid5 | Universally Unique Identifier UUID v5 |\n| uuid5_rfc4122 | Universally Unique Identifier UUID v5 RFC4122 |\n| uuid_rfc4122 | Universally Unique Identifier UUID RFC4122 |\n\n### Comparisons\n\n| Tag | Description |\n| - | - |\n| eq | Equals |\n| gt | Greater than|\n| gte | Greater than or equal |\n| lt | Less Than |\n| lte | Less Than or Equal |\n| ne | Not Equal |\n\n### Other\n\n| Tag | Description |\n| - | - |\n| dir | Directory |\n| file | File path |\n| isdefault | Is Default |\n| len | Length |\n| max | Maximum |\n| min | Minimum |\n| oneof | One Of |\n| required | Required |\n| required_if | Required If |\n| required_unless | Required Unless |\n| required_with | Required With |\n| required_with_all | Required With All |\n| required_without | Required Without |\n| required_without_all | Required Without All |\n| excluded_with | Excluded With |\n| excluded_with_all | Excluded With All |\n| excluded_without | Excluded Without |\n| excluded_without_all | Excluded Without All |\n| unique | Unique |\n\n#### Aliases\n\n| Tag | Description |\n| - | - |\n| iscolor | hexcolor\\|rgb\\|rgba\\|hsl\\|hsla |\n| country_code | iso3166_1_alpha2\\|iso3166_1_alpha3\\|iso3166_1_alpha_numeric |\n\n## License\n\nThis project is under the MIT License. See the [LICENSE](LICENSE) file for the full license text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflamego%2Fvalidator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflamego%2Fvalidator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflamego%2Fvalidator/lists"}