npm promotes metadefinitions

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

    1.2.0 • Public • Published

    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;
    }

    Install

    npm i class-validator-mongo-object-id

    DownloadsWeekly Downloads

    227

    Version

    1.2.0

    License

    MIT

    Unpacked Size

    157 kB

    Total Files

    7

    Last publish

    Collaborators

    • quantumsheep