{"id":17548945,"url":"https://github.com/saucecodee/joi-objectid-validator","last_synced_at":"2025-04-24T00:44:48.715Z","repository":{"id":53710083,"uuid":"348875169","full_name":"saucecodee/joi-objectid-validator","owner":"saucecodee","description":"MongoDB ObjectId validator for Joi","archived":false,"fork":false,"pushed_at":"2021-09-17T06:04:20.000Z","size":128,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-24T00:44:36.072Z","etag":null,"topics":["joi","mongodb-objectid","objectid","validator"],"latest_commit_sha":null,"homepage":"","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/saucecodee.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}},"created_at":"2021-03-17T22:58:32.000Z","updated_at":"2022-01-25T17:36:26.000Z","dependencies_parsed_at":"2022-09-23T12:38:14.908Z","dependency_job_id":null,"html_url":"https://github.com/saucecodee/joi-objectid-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/saucecodee%2Fjoi-objectid-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saucecodee%2Fjoi-objectid-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saucecodee%2Fjoi-objectid-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saucecodee%2Fjoi-objectid-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saucecodee","download_url":"https://codeload.github.com/saucecodee/joi-objectid-validator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250540953,"owners_count":21447426,"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":["joi","mongodb-objectid","objectid","validator"],"created_at":"2024-10-21T02:47:19.062Z","updated_at":"2025-04-24T00:44:48.694Z","avatar_url":"https://github.com/saucecodee.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Joi Objectid validator\n\nMongoDB ObjectId validator for Joi.\n\n\n### Installation\n\n```\nnpm install joi-objectid-validator --save\n```\n\n## Usage\n\nThe `joi-objectid-validator` validates only valid MongoDB ObjectId so it accepts either a 24 character hexadecimal String or an ObjectId type\n\n\n```js\nconst Joi = require('@hapi/joi')\n// Add joi-objectid-validator to Joi object\nJoi.objectId = require('joi-objectid-validator')(Joi)\n\nconst schema = Joi.object({\n  id: Joi.objectId(\"Custom error message here\"),\n})\n\n\n// VALID values\n//\n// new ObjectID()                           \n// new ObjectID(\"ccd563780134d5678901234a\")  \n// '6053a49e634e0ec405295ba8'                \n\n\n// INVALID values\n//\n// '$bcd56778c9a345678901234'\n// ' bcd56789012345678901234'\n// '6053a49e634e0ec405g95ba8'\n// 748397383836789234567823  \n// { }\n// null\n```\n\n\n### Development\n\n####  Testing\n\n- `npm test`\n\n## License\n\n[MIT](https://github.com/saucecodee/joi-objectid-validator/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaucecodee%2Fjoi-objectid-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaucecodee%2Fjoi-objectid-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaucecodee%2Fjoi-objectid-validator/lists"}