{"id":16472061,"url":"https://github.com/mikeibberson/m2e-validator","last_synced_at":"2026-01-16T00:48:30.545Z","repository":{"id":42965259,"uuid":"224314751","full_name":"MikeIbberson/m2e-validator","owner":"MikeIbberson","description":"Convert mongoose schema into an express-validator chain","archived":false,"fork":false,"pushed_at":"2023-03-04T05:17:35.000Z","size":1010,"stargazers_count":0,"open_issues_count":23,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-08T19:13:04.094Z","etag":null,"topics":["expressjs","mongoose","nodejs","validate-js"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/m2e-validator","language":"JavaScript","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/MikeIbberson.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}},"created_at":"2019-11-27T01:00:12.000Z","updated_at":"2021-11-22T19:04:38.000Z","dependencies_parsed_at":"2024-10-28T16:08:27.865Z","dependency_job_id":null,"html_url":"https://github.com/MikeIbberson/m2e-validator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeIbberson%2Fm2e-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeIbberson%2Fm2e-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeIbberson%2Fm2e-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeIbberson%2Fm2e-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MikeIbberson","download_url":"https://codeload.github.com/MikeIbberson/m2e-validator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246939239,"owners_count":20857922,"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":["expressjs","mongoose","nodejs","validate-js"],"created_at":"2024-10-11T12:16:04.177Z","updated_at":"2026-01-16T00:48:30.538Z","avatar_url":"https://github.com/MikeIbberson.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1\u003e🔌 Mongoose to Express-Validator adapter\u003c/h1\u003e\n\u003cp\u003e\n  \u003cimg src=\"https://github.com/MikeIbberson/m2e-validator/workflows/Node%20CI/badge.svg\" alt=\"Status\" /\u003e\n\u003ca href='https://coveralls.io/github/MikeIbberson/m2e-validator?branch=master'\u003e\u003cimg src='https://coveralls.io/repos/github/MikeIbberson/m2e-validator/badge.svg?branch=master' alt='Coverage Status' /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.codacy.com/manual/MikeIbberson/m2e-validator?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=MikeIbberson/m2e-validator\u0026amp;utm_campaign=Badge_Grade\"\u003e\u003cimg src=\"https://api.codacy.com/project/badge/Grade/3f4a7575589c49cc9e1c6b51577ad3ea\"/\u003e\u003c/a\u003e\n\u003cimg src='https://bettercodehub.com/edge/badge/MikeIbberson/m2e-validator?branch=master'\u003e\n\u003c/p\u003e\n\u003cp\u003eThis package converts \u003ca href=\"https://mongoosejs.com/docs/schematypes.html\"\u003eMongoose\u003c/a\u003e schema into a validation chain for \u003ca href=\"https://express-validator.github.io/docs/schema-validation.html\"\u003eExpress\u003c/a\u003e. Currently, it supports most default schema types as well as a few custom ones. For instance, schema types named Email or Phone match validator's implementation. See the full list of supported properties below.\u003c/p\u003e\n\u003ch2\u003eThe plugin\u003c/h2\u003e\n\u003cp\u003eThis module works through a custom Mongoose plugin that appends two static methods,  \u003ccode\u003egetSchemaPaths\u003c/code\u003e and \u003ccode\u003egetChildPaths\u003c/code\u003e. Both work recursively and support child and discriminator schemas. To access a discriminator, though, the request object must contain a reference to its key. See the examples below for more detail.\u003c/p\u003e\n\n``` Javascript\n// coming soon\n```\n\n\u003ch2\u003eThe schemas\u003c/h2\u003e\n\u003cp\u003eAll schema types support required and systemOnly properties. The latter omits the field from validation altogether.\u003c/p\u003e\n\n| Name        | Options                    | Notes                                     |\n| ----------- | -------------------------- | ----------------------------------------- |\n| String      | minLength, maxLength, enum | Auto escapes and trims                    |\n| Number      | min, max                   |                                           |\n| ObjectId    |                            |                                           |\n| SchemaArray |                            |                                           |\n| Date        |                            | Auto converts to ISO string               |\n| Boolean     |                            | Auto converts any non-falsy value to true |\n| URL         | --                         | Auto normalizes                           |\n| Email       | --                         | Auto normalizes                           |\n| Phone       | --                         |                                           |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikeibberson%2Fm2e-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikeibberson%2Fm2e-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikeibberson%2Fm2e-validator/lists"}