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 @reis/joi-object-id
#yarn
yarn add @reis/joi-object-id
import Joi from 'joi'
import JoiObjectId from '@reis/joi-object-id'
export default Joi.extend(JoiObjectId)
const schema = Joi.object({
userId: Joi.string().objectId(),
});
Please report any bugs, issues, suggestions and feature requests in the joi-object-id issue tracker.
(MIT License)
Copyright 2019-2023, Adam Reis