A Joi extension to automatically convert ISO date strings to object-id objects
- Extends the existing
string
validator - Validates incoming values as MongoDB ObjectId values
- Automatically converts values to Mongoose
ObjectId
instances
#npm
npm install @meanie/joi-object-id
#yarn
yarn add @meanie/joi-object-id
const Joi = require('@hapi/joi');
const JoiObjectId = require('@meanie/joi-object-id');
module.exports = Joi.extend(JoiObjectId);
const schema = Joi.object({
user: Joi.string().objectId(),
});
Please report any bugs, issues, suggestions and feature requests in the meanie-joi-object-id issue tracker.
Pull requests are welcome! If you would like to contribute to Meanie, please check out the Meanie contributing guidelines.
This package has been kindly sponsored by Hello Club, an all in one club and membership management solution complete with booking system, automated membership renewals, online payments and integrated access and light control. Check us out if you happen to belong to any kind of club or if you know someone who helps run a club!
(MIT License)
Copyright 2019-2020, Adam Reis