sequelize-typescript icon indicating copy to clipboard operation
sequelize-typescript copied to clipboard

add custom validation message to IsDate, isAlpha, Is ,.....

Open karimabdelhakim opened this issue 6 years ago • 3 comments

for example @IsDate(msg:"please enter a valid date")

karimabdelhakim avatar Jan 07 '18 17:01 karimabdelhakim

@karimabdelhakim yeah, this would be useful and should be implemented. For now you can achieve this like so:

@Column({
  ...,
  validate: {
    isDate: {msg: 'your message'}
  }
})

Any PRs are welcome :) ;)

RobinBuschmann avatar Jan 09 '18 19:01 RobinBuschmann

Some update about this feature?

jrafaels avatar May 07 '20 19:05 jrafaels

You can see this is implemented for some validators but not all of them: https://github.com/RobinBuschmann/sequelize-typescript/blob/master/src/validation/length.ts

You would basically just need to copy this to every validator in this folder, it wouldn't be a massive lift.

yocontra avatar Jun 30 '21 20:06 yocontra