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_Erroras return value.WP_Erroradds extra messages to response.
- falseis checked strictly, so other falsey values like- '',- 0, and- nullwill 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