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

How can get a property validators?

Open mib-kamel opened this issue 3 years ago • 1 comments

I am making a library which integrates with class-validator

I need to check if the property has the validator @IsOptional() or not to use the answer in an IF condition?

Is that possible?

mib-kamel avatar Aug 30 '22 19:08 mib-kamel

This should be possible, yes.

Study the code in these folders to learn more:

  • https://github.com/typestack/class-validator/tree/develop/src/validation
  • https://github.com/typestack/class-validator/tree/develop/src/metadata

braaar avatar Aug 31 '22 08:08 braaar

Closing this as solved.

If the issue still persists, you may open a new Q&A in the discussions tab and someone from the community may be able to help.

NoNameProvided avatar Nov 13 '22 14:11 NoNameProvided

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Dec 14 '22 00:12 github-actions[bot]