How to validate api action in Library?

I’m trying to use the validation system inside the library but it’s not triggered. I’ve try using $_GET and $_PARAM inputs with the validation required and pattern. Then with exec the validation is not running, but if I put the validation inside the API directly it work.