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

In this article

Finds the schema for a property using the patternProperties keyword.

Parameters

$propertystringrequired
The property name to check.
$argsarrayrequired
The schema array to use.

Return

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

Source

 *
 * @since 5.6.0
 *
 * @param string $property The property name to check.
 * @param array  $args     The schema array to use.
 * @return array|null      The schema of matching pattern property, or null if no patterns match.
 */
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 ) ) {

Changelog

VersionDescription
5.6.0Introduced.

User Contributed Notes

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