class-validator-mongo-object-id
TypeScript icon, indicating that this package has built-in type declarations

1.4.0 • Public • Published

npm

ObjectId Class Validator

This package validates ObjectId in classes. It was originally made to be used in NestJS but works everywhere else.

How to install

npm install --save class-validator-mongo-object-id

How to use

Here is an example along with commonly used IsString from class-validator package.

import { IsString } from 'class-validator';
import { IsObjectId } from 'class-validator-mongo-object-id';

class EditUserDTO {
    @IsObjectId()
    userId: string;

    @IsString()
    username: string;
}

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.4.0
    681
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.4.0
    681
  • 1.3.0
    636
  • 1.2.0
    9
  • 1.1.0
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i class-validator-mongo-object-id

Weekly Downloads

1,326

Version

1.4.0

License

MIT

Unpacked Size

65.3 kB

Total Files

7

Last publish

Collaborators

  • quantumsheep