Custom Rest API POST endpoint with conditionally required parameters

I’ve spent the last 6 hours trying to figure this out, I’m likely being dumb.

I’m trying to create a POST endpoint that has parameters that are required based on the value of another parameter.

I’ve tried a few things including:

I was looking through the core for a filter or hook that would let me change the required value dynamically, (a little hacky sure), but I couldn’t find anything.

Just thought I’d ask here, incase I’m missing something obvious.

Thanks