Validation and buildRules with custom condition

Hello,

I have an API that calls cakePHP Rest Api. That api can’t handle “null” in an integer field (c#). Is it possible to modify validators and/or buildRules that way, that the “existsIn”-Check is only executed, when the value (here of “archive_id”) is greater than 0?

I tried many possibilities and read the cookbook, but had no luck with that task.

Please help me with the powerful validation of Cake.

Thank in advance!

This is how you can customize Data Validation, check this link.
https://book.cakephp.org/3.0/en/orm/validation.html#creating-a-rules-checker