In Adding Custom Endpoints, validate_callback for arguments list is described like below.
validate_callback: Used to pass a function that will be passed the value of the argument. That function should return true if the value is valid, and false if not.
source: https://github.com/WP-API/docs/blob/master/extending-the-rest-api/adding-custom-endpoints.md?plain=1#L123
But it seems that extra descriptions are required.
- It also accepts
WP_Error as return value. WP_Error adds extra messages to response.
false is checked strictly, so other falsey values like '', 0, and null will be recognized as valid.
Code is here: https://github.com/WordPress/WordPress/blob/master/wp-includes/rest-api/class-wp-rest-request.php#L911-L923