wpseek.com
A WordPress-centric search engine for devs and theme authors
rest_find_any_matching_schema › WordPress Function
Since5.6.0
Deprecatedn/a
› rest_find_any_matching_schema ( $value, $args, $param )
| Parameters: (3) |
|
| Returns: |
|
| Defined at: |
|
| Codex: |
Finds the matching schema among the "anyOf" schemas.
Source
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 );
}