Skip to content

Commit

Permalink
chore: add jsdoc to the isenum validator
Browse files Browse the repository at this point in the history
  • Loading branch information
Bendakh committed Dec 11, 2023
1 parent ea8e090 commit d084e4b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/class-validators/src/is-enum.decorator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { IsEnum as OriginalIsEnum, ValidationOptions } from 'class-validator';

/**
* Checks if a given value is the member of the provided enum.
*
* This an override for the class-validator IsEnum validator.
* The error message is enhanced with the invalid value
*/
export const IsEnum = (entity: object, validationOptions?: ValidationOptions): PropertyDecorator =>
OriginalIsEnum(entity, {
message: '$property has the value $value but must be one of the following values: $constraint2',
Expand Down

0 comments on commit d084e4b

Please sign in to comment.