{"id":13786687,"url":"https://github.com/guiferpa/gody","last_synced_at":"2026-02-17T20:12:57.077Z","repository":{"id":47797111,"uuid":"155776017","full_name":"guiferpa/gody","owner":"guiferpa","description":":balloon: A lightweight struct validator for Go","archived":false,"fork":false,"pushed_at":"2025-05-30T02:35:36.000Z","size":88,"stargazers_count":136,"open_issues_count":1,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-30T03:31:22.591Z","etag":null,"topics":["go","golang","struct","struct-tags","validator","validator-struct"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/guiferpa/gody","language":"Go","has_issues":true,"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/guiferpa.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,"zenodo":null}},"created_at":"2018-11-01T21:08:16.000Z","updated_at":"2025-05-30T02:35:40.000Z","dependencies_parsed_at":"2025-01-17T14:43:49.515Z","dependency_job_id":"ff5bec00-5172-4521-b74e-2e2b7997dbe1","html_url":"https://github.com/guiferpa/gody","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/guiferpa/gody","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guiferpa%2Fgody","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guiferpa%2Fgody/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guiferpa%2Fgody/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guiferpa%2Fgody/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guiferpa","download_url":"https://codeload.github.com/guiferpa/gody/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guiferpa%2Fgody/sbom","scorecard":{"id":448491,"data":{"date":"2025-08-11","repo":{"name":"github.com/guiferpa/gody","commit":"6cb7c3199b3e8efde396b3dea079c0f6572bd7a6"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.9,"checks":[{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/pipeline.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":5,"reason":"7 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 1/26 approved changesets -- score normalized to 0","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":"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/pipeline.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/guiferpa/gody/pipeline.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pipeline.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/guiferpa/gody/pipeline.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/pipeline.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/guiferpa/gody/pipeline.yml/main?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 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":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"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":10,"reason":"0 existing vulnerabilities detected","details":null,"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 5 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-19T07:31:59.968Z","repository_id":47797111,"created_at":"2025-08-19T07:31:59.968Z","updated_at":"2025-08-19T07:31:59.968Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29556603,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T18:16:07.221Z","status":"ssl_error","status_checked_at":"2026-02-17T18:16:04.782Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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","golang","struct","struct-tags","validator","validator-struct"],"created_at":"2024-08-03T19:01:28.513Z","updated_at":"2026-02-17T20:12:52.060Z","avatar_url":"https://github.com/guiferpa.png","language":"Go","funding_links":[],"categories":["Validation","Utility","验证","校验库","校验库`用于校验的库`"],"sub_categories":["Utility/Miscellaneous","HTTP Clients","实用程序/Miscellaneous","Fail injection","查询语"],"readme":"# gody\n\n[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)\n[![GoDoc](https://godoc.org/github.com/guiferpa/gody?status.svg)](https://godoc.org/github.com/guiferpa/gody)\n[![Go Report Card](https://goreportcard.com/badge/github.com/guiferpa/gody)](https://goreportcard.com/report/github.com/guiferpa/gody)\n[![Build Status](https://cloud.drone.io/api/badges/guiferpa/gody/status.svg)](https://cloud.drone.io/guiferpa/gody)\n[![Coverage Status](https://coveralls.io/repos/github/guiferpa/gody/badge.svg?branch=master)](https://coveralls.io/github/guiferpa/gody?branch=master)\n[![GitHub release (latest by date)](https://img.shields.io/github/v/release/guiferpa/gody?color=purple\u0026label=latest)](https://github.com/guiferpa/gody/releases/latest)\n\n### [Go versions supported](https://github.com/guiferpa/gody/commit/312f2e79be13aeb17e351d61283dfa0ea7aef15a#diff-b31f1e5654d027d84c24cdba2ff31ab79e3ea617091ed348a97476a27b076078R12)\n\n### Installation\n```bash\ngo get github.com/guiferpa/gody/v2\n```\n\n### Usage\n\n```go\npackage main\n\nimport (\n    \"encoding/json\"\n    \"fmt\"\n    \"net/http\"\n\n    gody \"github.com/guiferpa/gody/v2\"\n    \"github.com/guiferpa/gody/v2/rule\"\n) \n\ntype RequestBody struct {\n    Name string `json:\"name\" validate:\"not_empty\"`\n    Age  int    `json:\"age\" validate:\"min=21\"`\n}\n\nfunc HTTPHandler(v *gody.Validator) http.HandlerFunc {\n    return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n        var body RequestBody\n        if err := json.NewDecoder(r.Body).Decode(\u0026body); err != nil {\n\t    // ...\n    \t}\n\tdefer r.Body.Close()\n\n\tif isValidated, err := v.Validate(body); err != nil {\n\t    // ...                                                                                \n\t}\n    })\n}\n\nfunc main() {\n    validator := gody.NewValidator()\n\n    validator.AddRules(rule.NotEmpty, rule.Min)\n\n    port := \":3000\"\n    http.ListenAndServe(port, HTTPHandler(validator))\n}\n```\n\n### Others ways for validation\n\nThere are others ways to valid a struct, take a look on functions below:\n\n- **RawValidate** - It's a function that make validate with no rule, it's necessary put the struct for validation, some rule(s) and tag name.\n\n```go\ngody.RawValidate(interface{}, string, []gody.Rule) (bool, error)\n```\n\n- **Validate** - It's a function that make validate with no rule, it's necessary put the struct for validation and some rule(s).\n```go\ngody.Validate(interface{}, []gody.Rule) (bool, error)\n```\n\n- **RawDefaultValidate** - It's a function that already have [built-in rules](https://github.com/guiferpa/gody/blob/72ce1caecc5fdacf40ee282716ec1b5abe6f7adf/validate.go#L15-L23) configured, it's necessary put the struct for validation, tag name and optional custom rule(s).\n```go\ngody.RawDefaultValidate(interface{}, string, []gody.Rule) (bool, error)\n```\n\n- **DefaultValidate** - It's a function that already have [built-in rules](https://github.com/guiferpa/gody/blob/72ce1caecc5fdacf40ee282716ec1b5abe6f7adf/validate.go#L15-L23) configured, it's necessary put the struct for validation and optional custom rule(s).\n```go\ngody.DefaultValidate(interface{}, []gody.Rule) (bool, error)\n```\n\n### Contribution policies\n\n1. At this time the only policy is don't create a Pull Request directly, it's necessary some discussions for some implementation then open an issue before to dicussion anything about the project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguiferpa%2Fgody","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguiferpa%2Fgody","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguiferpa%2Fgody/lists"}