WordPress at a glance
function is not described

rest_find_matching_pattern_property_schema() WP 5.6.0

Finds the schema for a property using the patternProperties keyword.

No Hooks.

Return

Array|null. The schema of matching pattern property, or null if no patterns match.

Usage

rest_find_matching_pattern_property_schema( $property, $args );
$property(string) (required)
The property name to check.
$args(array) (required)
The schema array to use.

Changelog

Since 5.6.0 Introduced.

Code of rest_find_matching_pattern_property_schema() WP 5.7.2

<?php
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;
}