Validate custom fields before save using WordPress Rest API

By searching a lot to API documentation, I found the solution to my problem finally:

function my_rest_prepare_post(  $prepared_post, $request ) {

...

}
add_filter( 'rest_pre_insert_posttype', 'my_rest_prepare_post', 10, 3 );