rest_find_matching_pattern_property_schema( string $property, array $args ): array|null

Finds the schema for a property using the patternProperties keyword.


Parameters

$property string Required
The property name to check.
$args array Required
The schema array to use.

Top ↑

Return

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


Top ↑

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


Top ↑

Changelog

Changelog
Version Description
5.6.0 Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.