@reis/joi-object-id

3.0.0 • Public • Published

@reis/joi-object-id

npm version github issues

A Joi extension to automatically convert ISO date strings to object-id objects

Features

  • Extends the existing string validator
  • Validates incoming values as MongoDB ObjectId values
  • Automatically converts values to Mongoose ObjectId instances

Installation

#npm
npm install @reis/joi-object-id

#yarn
yarn add @reis/joi-object-id

Usage

import Joi from 'joi'
import JoiObjectId from '@reis/joi-object-id'

export default Joi.extend(JoiObjectId)

Examples

const schema = Joi.object({
  userId: Joi.string().objectId(),
});

Issues & feature requests

Please report any bugs, issues, suggestions and feature requests in the joi-object-id issue tracker.

License

(MIT License)

Copyright 2019-2023, Adam Reis

Package Sidebar

Install

npm i @reis/joi-object-id

Weekly Downloads

40

Version

3.0.0

License

MIT

Unpacked Size

4.17 kB

Total Files

6

Last publish

Collaborators

  • adamreisnz