Repository navigation
feat: validateIf for validation options - #1579
Conversation
2ef8ff0 to
0da8f89
Compare
d187345 to
e3c3fb9
Compare
|
I think I prefer the |
|
Handy feature, though! |
There was a problem hiding this comment.
I think this is a good proposal, but I think the function should be normalized to match the predicate function used in ValidateIf.
This is how I see it being the most useful:
@Max(5, { validateIf: (o) => Boolean(o.someOtherProperty) })I am now of the opinion that validateIf might be better than skip / skipIf.
|
See my recent comment in #1721 |
There was a problem hiding this comment.
As discussed in #1721, I think this decorator should have the same signature as ValidateIf.
The signature (value: any, validationArguments: ValidationArguments) => boolean; makes it unnecessarily cumbersome to do simple stuff like:
@IsUUID({ validateIf: o => o.type === "something" })
|
updated @braaar |
|
@braaar Please merge this feature I am waiting for so long... |
|
We are discussing this feature internally right now. Hold on just a little longer, @kevit-kelvin-mandlik and @aoi-umi |
|
@braaar Please merge this feature. I need it for my project. |
|
@aoi-umi check the latest CI / Linters action. The codecov is still not happy with the sourceMap change. Could you try refactoring the code in some way (perhaps inverting or re-ordering some if-statements) to see if that makes codecov happy? |
|
sorry i forget to run the lint, it is ok now? @braaar |
|
Thanks. I'm still hesitant to merge due to the codecov problem. I'm not a test coverage hawk, I'm just worried that it might be catching something we aren't catching. |
|
I think it's time. |
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
Add
validateIffor validation options.If you want to validate that condition by object, you can use
validation validateIf.ValidateIfwill skip all other decorators,validation validateIfonly effect the decorator that use this optionChecklist
Update index.md)develop)npm run prettier:checkpassesnpm run lint:checkpassesFixes
references #1455