{"id":16415429,"url":"https://github.com/lkwr/vade","last_synced_at":"2025-02-24T11:15:45.302Z","repository":{"id":62422678,"uuid":"484188344","full_name":"lkwr/vade","owner":"lkwr","description":"Simple class validator for Deno using TypeScript Decorators with built-in class transformer.","archived":false,"fork":false,"pushed_at":"2022-04-23T14:24:11.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-19T00:09:28.061Z","etag":null,"topics":["class-transformer","class-transformer-validator","class-validator","decorators","deno","denoland","typescript","validator"],"latest_commit_sha":null,"homepage":"https://deno.land/x/vade","language":"TypeScript","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/lkwr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-21T20:01:15.000Z","updated_at":"2022-04-21T20:08:25.000Z","dependencies_parsed_at":"2022-11-01T17:33:33.047Z","dependency_job_id":null,"html_url":"https://github.com/lkwr/vade","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkwr%2Fvade","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkwr%2Fvade/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkwr%2Fvade/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkwr%2Fvade/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lkwr","download_url":"https://codeload.github.com/lkwr/vade/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240105466,"owners_count":19748464,"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":["class-transformer","class-transformer-validator","class-validator","decorators","deno","denoland","typescript","validator"],"created_at":"2024-10-11T07:05:42.996Z","updated_at":"2025-02-24T11:15:45.275Z","avatar_url":"https://github.com/lkwr.png","language":"TypeScript","readme":"# VADE\n\n(**Va**lidate **De**corator)\n\n#### Simple class validator for Deno using TypeScript Decorators with built-in class transformer.\n\n![Made for Deno](https://img.shields.io/badge/made%20for-Deno-6B82F6?style=flat-square)\n![Licence MIT](https://img.shields.io/github/license/lkwr/vade?color=blue\u0026style=flat-square)\n![Latest version](https://img.shields.io/github/v/tag/lkwr/vade?color=informational\u0026label=version\u0026sort=semver\u0026style=flat-square)\n![Latest commit](https://img.shields.io/github/last-commit/lkwr/vade?style=flat-square)\n![Status WIP](https://img.shields.io/badge/status-WIP-red?style=flat-square)\n\n## Key Features\n\n-   Made for [Deno](https://deno.land)\n-   Type-safe\n-   Lightweight\n-   Extendable\n-   Zero dependencies\n\n## How To Use\n\nSimply create a Class (or Model) using TypeScript Decorators and run `validate`. If you need more validator types: **write issue**, **create merge request** or **implement it yourself** and only use it locally.\n\n```ts\nimport {\n    validate,\n    createValidator,\n    IsNumber,\n    IsString,\n    SetDefault,\n} from 'https://deno.land/x/vade/mod.ts';\n\n// Custom validator\nconst IsHigherThen = createValidator((value: number) =\u003e {\n    return (prop) =\u003e {\n        return prop \u003e value;\n    };\n});\n\n// Our example model/class\nclass ExampleClass {\n    @IsNumber()\n    @IsHigherThen(10)\n    specialNumber!: number;\n\n    @SetDefault('default value')\n    @IsString()\n    randomValue!: string;\n}\n\n// ---------- //\n\n// Valid\nconst obj1 = new ExampleClass();\nobj1.specialNumber = 13;\nobj1.randomValue = 'asd';\nconsole.log(validate(obj1, ExampleClass));\n// ExampleClass { specialNumber: 13, randomValue: \"asd\" }\n\n// ---------- //\n\n// Invalid\nconst obj2 = new ExampleClass();\nobj2.specialNumber = 9; // Failed\nobj2.randomValue = 'asd';\nconsole.log(validate(obj2, ExampleClass));\n// null\n\n// ---------- //\n\n// Invalid\nconst obj3 = new ExampleClass();\n// Failed -\u003e no specialNumber\nobj3.randomValue = 'asd';\nconsole.log(validate(obj3, ExampleClass));\n// null\n\n// ---------- //\n\n// Valid\nconst obj4 = { specialNumber: 14, randomValue: 'cool' };\nconsole.log(validate(obj4, ExampleClass));\n// ExampleClass { specialNumber: 14, randomValue: \"cool\" }\n\n// ---------- //\n\n// Valid -\u003e randomValue has a default value\nconst obj5 = { specialNumber: 14 };\nconsole.log(validate(obj5 as any, ExampleClass));\n// ExampleClass { specialNumber: 14, randomValue: \"default value\" }\n\n// ---------- //\n\n// Invalid -\u003e unknown nice property\nconst obj6 = { specialNumber: 14, randomValue: 'cool', nice: true };\nconsole.log(validate(obj6, ExampleClass));\n// null\n```\n\n## TODO\n\n-   add more built-in types (feel free to contribute)\n\n## Known issues\n\n--\n\n## Contributing\n\nFeel free to open merge requests!\n\n## License\n\nMIT\n\n---\n\n\u003e Homepage [luke.id](https://luke.id) \u0026nbsp;\u0026middot;\u0026nbsp; GitHub\n\u003e [@lkwr](https://github.com/lkwr) \u0026nbsp;\u0026middot;\u0026nbsp; Twitter\n\u003e [@wlkrlk](https://twitter.com/wlkrlk)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flkwr%2Fvade","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flkwr%2Fvade","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flkwr%2Fvade/lists"}