class-validator icon indicating copy to clipboard operation
class-validator copied to clipboard

feat: `validateIf` for validation options

Open aoi-umi opened this issue 2 years ago • 11 comments

Description

Add validateIf for validation options. If you want to validate that condition by object, you can use validation validateIf.

ValidateIf will skip all other decorators, validation validateIf only effect the decorator that use this option

Checklist

  • [x] the pull request title describes what this PR does (not a vague title like Update index.md)
  • [x] the pull request targets the default branch of the repository (develop)
  • [x] the code follows the established code style of the repository
    • npm run prettier:check passes
    • npm run lint:check passes
  • [x] tests are added for the changes I made (if any source code was modified)
  • [x] documentation added or updated
  • [x] I have run the project locally and verified that there are no errors

Fixes

references https://github.com/typestack/class-validator/issues/1455

aoi-umi avatar Mar 11 '22 14:03 aoi-umi

I think I prefer the skip or skipIf name for this option. I think validateIf is a bit confusing, since you can get it mixed up with the ValidateIf decorator.

braaar avatar Dec 05 '22 07:12 braaar

Handy feature, though!

braaar avatar Dec 05 '22 07:12 braaar

See my recent comment in #1721

braaar avatar Dec 15 '23 05:12 braaar

updated @braaar

aoi-umi avatar Jan 24 '24 13:01 aoi-umi

@braaar Please merge this feature I am waiting for so long...

kevit-kelvin-mandlik avatar Feb 26 '24 06:02 kevit-kelvin-mandlik

@braaar @aoi-umi What are you guys waiting upon this? Can we please move forward with this?

kevit-kelvin-mandlik avatar Mar 14 '24 05:03 kevit-kelvin-mandlik

@braaar @aoi-umi What are you guys waiting upon this? Can we please move forward with this?

haha, i don't know either

aoi-umi avatar Mar 14 '24 07:03 aoi-umi

We are discussing this feature internally right now. Hold on just a little longer, @kevit-kelvin-mandlik and @aoi-umi

braaar avatar Mar 19 '24 07:03 braaar

@braaar Are we good to go on this??

kevit-kelvin-mandlik avatar Apr 24 '24 13:04 kevit-kelvin-mandlik

Any updates on this PR? I've been looking forward to using this feature for a quite long time!

yasaichi avatar May 16 '24 05:05 yasaichi