REST API: Add more specific error codes for schema validation.

Previously, the majority of JSON Schema validation errors returned a generic `rest_invalid_param` error code. In preparation for #46191, where the underlying validation error code will be exposed, this commit adds specific error codes for each failure scenario.

Fixes #52317.


git-svn-id: https://develop.svn.wordpress.org/trunk@50007 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Timothy Jacobs
2021-01-24 03:57:39 +00:00
parent ffd7fd8168
commit 15c8166424
2 changed files with 27 additions and 27 deletions
@@ -164,7 +164,7 @@ class WP_Test_REST_Controller extends WP_Test_REST_TestCase {
);
$this->assertErrorResponse(
'rest_invalid_param',
'rest_not_in_enum',
rest_validate_request_arg( 'd', $this->request, 'someenum' )
);
}