{"id":23408570,"url":"https://github.com/mkafonso/schema","last_synced_at":"2026-01-12T02:53:58.020Z","repository":{"id":196426798,"uuid":"696046452","full_name":"mkafonso/schema","owner":"mkafonso","description":"A Golang schema validation toolkit that takes inspiration from https://zod.dev/ - because who doesn't love a good source of inspiration? 🎉","archived":false,"fork":false,"pushed_at":"2024-11-22T01:47:18.000Z","size":70,"stargazers_count":37,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-11T23:52:56.799Z","etag":null,"topics":["go","go-schema","go-verify","golang","open-source","string-validation","struct-validator","toolkit","validation","zod"],"latest_commit_sha":null,"homepage":"","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/mkafonso.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2023-09-25T01:00:04.000Z","updated_at":"2025-02-11T15:31:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"63ab2f91-aca6-472d-9a6b-2620d62c290c","html_url":"https://github.com/mkafonso/schema","commit_stats":{"total_commits":48,"total_committers":1,"mean_commits":48.0,"dds":0.0,"last_synced_commit":"ee0736dccba7752878dee08081f54b68719e3105"},"previous_names":["mkafonso/go-schema","mkafonso/go-verify"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkafonso%2Fschema","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkafonso%2Fschema/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkafonso%2Fschema/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkafonso%2Fschema/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkafonso","download_url":"https://codeload.github.com/mkafonso/schema/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248497851,"owners_count":21113984,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","go-schema","go-verify","golang","open-source","string-validation","struct-validator","toolkit","validation","zod"],"created_at":"2024-12-22T15:15:50.624Z","updated_at":"2026-01-12T02:53:58.015Z","avatar_url":"https://github.com/mkafonso.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Example\n\n![Untitled](https://github.com/user-attachments/assets/ae518aa4-c4ba-420c-af1c-236271114b33)\n\n\n# Schema - A Go Validation Library\n\n\nThis is an open-source schema validation toolkit inspired by zod.dev. It provides a simple and expressive API for validating strings, numbers, struct, ... with various constraints. Schema is designed to be easy to use, extensible, and suitable for a wide range of applications.\n\nFeel free to use and modify it for any purpose. If you have any suggestions for improvement, please don't hesitate to reach out. Thank you!\n\n---\n\nFeatures include:\n\n-   String Validation: Min/Max length, email format, and more.\n-   Number Validation: Min/Max value, integer check, positive/negative, even/odd, divisibility, and more.\n-   Custom Error Messages: Provide custom error messages for failed validations.\n-   Composability: Combine multiple validations easily.\n-   Extensible: Easy to add custom validation logic.\n\n---\n\n## Installation\n\nTo install this package, use `go get`:\n\n    go get github.com/mkafonso/schema\n\n---\n\n## Get started:\n\n-   Install schema with [one line of code](#installation)\n-   Check out the API Documentation https://pkg.go.dev/github.com/mkafonso/schema\n\n## [`String Validation`](https://pkg.go.dev/github.com/mkafonso/schema/string \"API documentation\") package\n\n-   Minimum Length: Ensure the string has a minimum length.\n-   Maximum Length: Ensure the string does not exceed a maximum length.\n-   Email Format: Validate the string as an email format.\n\nSee it in action:\n\n```go\npackage yours\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/mkafonso/schema/pkg/validator\"\n)\n\nfunc ValidateEmailExample() {\n\tinput := \"mkafonso.dev@gmail.com\"\n\n\t// Defining a validation schema\n\tstringValidator := validator.NewStringValidator().\n\t\tMinLength(5, \"A string deve ter no mínimo 5 caracteres\").   // Sets minimum length constraint\n\t\tMaxLength(50, \"A string deve ter no máximo 50 caracteres\"). // Sets maximum length constraint\n\t\tIsEmail(\"Formato de email inválido\")                        // Validates as an email format\n\n\t// Validating the input\n\tresult := stringValidator.Validate(input)\n\n\t// Handling validation result\n\tif result.IsValid {\n\t\tfmt.Println(\"Validation successful!\") // Message for successful validation\n\t} else {\n\t\tfmt.Println(\"Validation error:\", result.Errors) // Printing validation errors\n\t}\n}\n```\n\n---\n\n# License\n\nThis project is licensed under the terms of the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkafonso%2Fschema","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkafonso%2Fschema","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkafonso%2Fschema/lists"}