{"id":25429866,"url":"https://github.com/leadcodedev/vine","last_synced_at":"2025-07-07T17:35:42.112Z","repository":{"id":276835529,"uuid":"930199423","full_name":"LeadcodeDev/vine","owner":"LeadcodeDev","description":"Vine is a robust, typed validation library for Dart/Flutter, designed to simplify and secure data validation in applications.","archived":false,"fork":false,"pushed_at":"2025-04-27T21:44:17.000Z","size":228,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-14T10:32:51.595Z","etag":null,"topics":["dartlang","data-validation","vinejs"],"latest_commit_sha":null,"homepage":"","language":"Dart","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/LeadcodeDev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2025-02-10T08:42:53.000Z","updated_at":"2025-04-27T21:43:28.000Z","dependencies_parsed_at":"2025-02-26T21:22:35.203Z","dependency_job_id":"4cd4fe1a-1e23-42be-9cc9-b20308db8671","html_url":"https://github.com/LeadcodeDev/vine","commit_stats":null,"previous_names":["leadcodedev/vine"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeadcodeDev%2Fvine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeadcodeDev%2Fvine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeadcodeDev%2Fvine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeadcodeDev%2Fvine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LeadcodeDev","download_url":"https://codeload.github.com/LeadcodeDev/vine/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254121136,"owners_count":22018110,"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":["dartlang","data-validation","vinejs"],"created_at":"2025-02-17T02:32:01.903Z","updated_at":"2025-05-14T10:35:12.132Z","avatar_url":"https://github.com/LeadcodeDev.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🌿 Vine\n\n**Vine** is a robust, typed validation library for Dart/Flutter, designed to simplify and secure data management in\napplications inspired by [Vine.js](https://vinejs.dev/docs/introduction)..\n\nIts main objective is to solve the recurring problem of validating user input, external APIs or internal configurations,\na critical step that is often a source of errors and complexity in development.\n\nUnlike manual methods or ad hoc checks, Vine offers a structured, declarative approach to defining validation schemes,\nensuring that data complies with an expected format before it is used, which reduces bugs and improves reliability.\n\n![icons technologies](https://skillicons.dev/icons?i=dart,flutter)\n\n## 🛠 Key features\n\n| Feature                   | Description                                                  |\n|---------------------------|--------------------------------------------------------------|\n| ✅ Type-Safe Validation    | Define schemas with a fluent API and ensure data integrity   |\n| 🧱 Rich Set of Validators | Strings, numbers, booleans, arrays, enums, objects, and more |\n| 🔄 Data Transformation    | Trim, normalize, and transform values during validation      |\n| 🚧 Null Safety            | Full support for nullable and optional fields                |\n| ⚙️ Composable             | Compiled and reusable schemas                                |\n| ⚡ Fast Performance        | ~ 29 000 000 ops/s                                           |\n| 📦 Extremely small size   | Package size `\u003c 21kb`                                        |\n| 🚀 OpenApi reporter       | Export your schemas as OpenApi spec                          |\n\n## 🚀 Usage\n\nVine is a data structure validation library for Dart. You may use it to validate the HTTP request body or any data in\nyour backend applications.\n\n\u003e See related [article](https://dev.to/baptiste_parmantier/validate-your-data-structures-with-vine-in-your-dart-projects-111p) in `Dev.to` to discover how to use Vine in your Dart projects.\n\n### Built for validating form data and JSON payloads\n\nSerializing an HTML form to FormData or a JSON object comes with its own set of quirks.\n\nFor example:\n\n- Numbers and booleans are serialized as strings\n- Checkboxes are not booleans\n- And empty fields are represented as empty strings\n\nVine handles all these quirks natively, and you never have to perform manual normalization in your codebase.\n\n### Maintainability and reusability\n\nThis library meets the typical need for maintainability and security in dynamic ecosystems such as Flutter, where\nuncontrolled data can lead to crashes or vulnerabilities.\n\nIt offers an elegant solution via a fluid, chainable API, enabling complex validation rules (text length, numeric\nranges, email formats, UUID, etc.) to be described in just a few lines.\n\nFor example, a user form can be validated with precise constraints (e.g. `vine.string().email().minLength(5)`) while\ntransforming the data (trim, case conversion, normalisation), thus avoiding redundant code and repeated checks.\n\n```dart\nimport 'package:vine/vine.dart';\n\nvoid main() {\n  final validator = vine.compile(\n    vine.object({\n      'username': vine.string().minLength(3).maxLength(20),\n      'email': vine.string().email(),\n      'age': vine.number().min(18).optional(),\n      'isAdmin': vine.boolean(),\n      'features': vine.array(vine.string()),\n    }));\n\n  try {\n    final payload = {\n      'username': 'john Doe',\n      'email': 'john@example.com',\n      'age': 25,\n      'isAdmin': true,\n      'features': ['MANAGE'],\n    };\n\n    final data = validator.validate(payload);\n    print('Valid data: $data');\n  } on ValidationException catch (e) {\n    print('Validation error: ${e.message}');\n  }\n}\n```\n\n### OpenAPI reporter\n\nVine can generate an OpenAPI schema from your validation schemas. \nThis feature is useful when you want to document your API\n\n```dart\nfinal schema = vine.object({\n  'stringField': vine.string().minLength(3).maxLength(20),\n  'emailField': vine.string().email(),\n  'numberField': vine.number().min(18).max(100),\n  'booleanField': vine.boolean(),\n  'enumField': vine.enumerate(MyEnum.values),\n  'arrayField': vine.array(vine.string().minLength(3).maxLength(20)).minLength(1),\n  'unionField': vine.union([\n    vine.string().minLength(3).maxLength(20),\n    vine.number().min(10).max(20),\n  ]),\n});\n\nfinal reporter = vine.openApi.report(schemas: {'MySchema': schema});\nprint(reporter);\n```\n\n## ❤️ Credit\n\nI would like to thank [Harminder Virk](https://github.com/thetutlage) for all his open-source work on Adonis.js and for\nhis permission to\nreuse the name `Vine` for this package. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleadcodedev%2Fvine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleadcodedev%2Fvine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleadcodedev%2Fvine/lists"}