@corupta/joi-object-id

2.3.3 • Public • Published

@meanie/joi-object-id

npm version node dependencies github issues

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

Meanie

Features

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

Installation

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

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

Usage

const Joi = require('@hapi/joi');
const JoiObjectId = require('@meanie/joi-object-id');

module.exports = Joi.extend(JoiObjectId);

Examples

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

Issues & feature requests

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

Contributing

Pull requests are welcome! If you would like to contribute to Meanie, please check out the Meanie contributing guidelines.

Sponsor

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!

License

(MIT License)

Copyright 2019-2020, Adam Reis

Package Sidebar

Install

npm i @corupta/joi-object-id

Weekly Downloads

1

Version

2.3.3

License

MIT

Unpacked Size

3.6 kB

Total Files

3

Last publish

Collaborators

  • corupta