Custom Rest API POST endpoint with conditionally required parameters

This is how I solved similar issue using validate callback – this is the part of code where bar argument is defined:

'bar' => array(
     'default' => FALSE,
     'validate_callback' => function($param, $request, $key) {
         if ($request['foo'] == 3)
             return ($param !== FALSE);
         return FALSE;
     }
),

The default parameter causes call of validate callback even if request parameter bar is not supplied. Then in validate callback only if condition is met, check whether parameter has other than default value.