REST API: Support the uuid JSON Schema format.
This accepts a uuid of any version. A future commit could add support for restricting uuids to a specific version. Props johnwatkins0. Fixes #50053. Built from https://develop.svn.wordpress.org/trunk@47753 git-svn-id: http://core.svn.wordpress.org/trunk@47529 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c215a6dc27
commit
ac3c2fe60a
|
@ -1393,6 +1393,12 @@ function rest_validate_value_from_schema( $value, $args, $param = '' ) {
|
|||
return new WP_Error( 'rest_invalid_param', sprintf( __( '%s is not a valid IP address.' ), $param ) );
|
||||
}
|
||||
break;
|
||||
case 'uuid':
|
||||
if ( ! wp_is_uuid( $value ) ) {
|
||||
/* translators: %s is the name of a JSON field expecting a valid uuid. */
|
||||
return new WP_Error( 'rest_invalid_uuid', sprintf( __( '%s is not a valid UUID.' ), $param ) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1549,6 +1555,9 @@ function rest_sanitize_value_from_schema( $value, $args ) {
|
|||
|
||||
case 'ip':
|
||||
return sanitize_text_field( $value );
|
||||
|
||||
case 'uuid':
|
||||
return sanitize_text_field( $value );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.5-alpha-47752';
|
||||
$wp_version = '5.5-alpha-47753';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue