rest_find_any_matching_schema
函数
rest_find_any_matching_schema ( $value, $args, $param )
- 参数
-
-
(mixed)
$value
The value to validate.- Required: 是
-
(array)
$args
The schema array to use.- Required: 是
-
(string)
$param
The parameter name, used in error messages.- Required: 是
-
(mixed)
- 返回值
-
- (array|WP_Error) The matching schema or WP_Error instance if all schemas do not match.
- 定义位置
-
-
wp-includes/rest-api.php
, line 1858
-
wp-includes/rest-api.php
- 引入
- 5.6.0
- 弃用
- –
Finds the matching schema among the “anyOf” schemas.
function rest_find_any_matching_schema( $value, $args, $param ) { $errors = array(); foreach ( $args['anyOf'] as $index => $schema ) { if ( ! isset( $schema['type'] ) && isset( $args['type'] ) ) { $schema['type'] = $args['type']; } $is_valid = rest_validate_value_from_schema( $value, $schema, $param ); if ( ! is_wp_error( $is_valid ) ) { return $schema; } $errors[] = array( 'error_object' => $is_valid, 'schema' => $schema, 'index' => $index, ); } return rest_get_combining_operation_error( $value, $param, $errors ); }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。