On this page
rest_find_matching_pattern_property_schema( string $property, array $args ): array|null
Finds the schema for a property using the patternProperties keyword.
Parameters
$propertystring Required-
The property name to check.
$argsarray Required-
The schema array to use.
Return
array|null The schema of matching pattern property, or null if no patterns match.
Source
File: wp-includes/rest-api.php. View all references
function rest_find_matching_pattern_property_schema( $property, $args ) {
if ( isset( $args['patternProperties'] ) ) {
foreach ( $args['patternProperties'] as $pattern => $child_schema ) {
if ( rest_validate_json_schema_pattern( $pattern, $property ) ) {
return $child_schema;
}
}
}
return null;
}
Related
Uses
| Uses | Description |
|---|---|
| rest_validate_json_schema_pattern() wp-includes/rest-api.php | Validates if the JSON Schema pattern matches a value. |
Used By
| Used By | Description |
|---|---|
| rest_validate_object_value_from_schema() wp-includes/rest-api.php | Validates an object value based on a schema. |
| rest_filter_response_by_context() wp-includes/rest-api.php | Filters the response to remove any fields not available in the given context. |
| rest_sanitize_value_from_schema() wp-includes/rest-api.php | Sanitize a value based on a schema. |
Changelog
| Version | Description |
|---|---|
| 5.6.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/rest_find_matching_pattern_property_schema