{"id":28377368,"url":"https://github.com/equilaterus/simple-ts-validation-mapping","last_synced_at":"2025-08-02T10:32:58.734Z","repository":{"id":251690706,"uuid":"810089735","full_name":"equilaterus/simple-ts-validation-mapping","owner":"equilaterus","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-08T03:51:56.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"dev","last_synced_at":"2025-06-26T18:43:23.507Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/equilaterus.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":"2024-06-04T03:00:29.000Z","updated_at":"2024-08-08T03:51:26.000Z","dependencies_parsed_at":"2024-08-05T04:49:35.778Z","dependency_job_id":"87beb257-24d6-4bfb-ae25-ce6ea55a05d7","html_url":"https://github.com/equilaterus/simple-ts-validation-mapping","commit_stats":null,"previous_names":["equilaterus/simple-ts-validator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/equilaterus/simple-ts-validation-mapping","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/equilaterus%2Fsimple-ts-validation-mapping","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/equilaterus%2Fsimple-ts-validation-mapping/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/equilaterus%2Fsimple-ts-validation-mapping/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/equilaterus%2Fsimple-ts-validation-mapping/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/equilaterus","download_url":"https://codeload.github.com/equilaterus/simple-ts-validation-mapping/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/equilaterus%2Fsimple-ts-validation-mapping/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268370870,"owners_count":24239780,"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","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-05-30T01:04:49.858Z","updated_at":"2025-08-02T10:32:58.683Z","avatar_url":"https://github.com/equilaterus.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple Typescript Validation and Mapping\n\n* Clean **entity validation** and **auto-mapping**.\n* Prevents **overposting** attacks.\n* Simple and extensible.\n\n## Usage\n\nDefine your target model:\n\n```ts\nexport class TargetModel {\n  requiredField: string = \"\";\n  optionalField: string | null = null;\n}\n```\n\nAnd validate it! For example, if you want to check a request on ExpressJS:\n\n```ts\nconst [targetModel, isValid, validationErrors] = validateModel(TargetModel, req.body);\n    \nif (!isValid) {\n    res.status(400).send(validationErrors);\n} else {\n    const result = await doSomethingWithTargetModel({\n        additionalFields: true,\n        ...command,\n    } as targetWithAdditionalFields)\n\n    res.send(result);\n}\n```\n\nFor more examples, see **sample.ts**. To run this project locally simply use these commands:\n\n```\nnpm install\nnpm start\n```\n\n## FAQ\n\n* **How to integrate this with my project?** Just copy the contents from *validator.ts* into your project, extend and modify as required.\n\n* **Why there is no NPM package?** This is a *base code* that you can use, extend and customize so there isn't (and probably won't be) an available NPM package.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fequilaterus%2Fsimple-ts-validation-mapping","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fequilaterus%2Fsimple-ts-validation-mapping","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fequilaterus%2Fsimple-ts-validation-mapping/lists"}