Continue validating after doing nested properties (https://github.com/woocommerce/woocommerce-blocks/pull/11792)

This commit is contained in:
Mike Jolley 2023-11-20 13:05:42 +00:00 committed by GitHub
parent cc84383730
commit 0981e973c5
1 changed files with 7 additions and 1 deletions

View File

@ -173,12 +173,18 @@ abstract class AbstractSchema {
}
if ( ! $result || is_wp_error( $result ) ) {
// If schema validation fails, we return here as we don't need to validate any deeper.
return $result;
}
if ( isset( $property_value['properties'] ) ) {
$validate_callback = $this->get_recursive_validate_callback( $property_value['properties'] );
return $validate_callback( $current_value, $request, $param . ' > ' . $property_key );
$result = $validate_callback( $current_value, $request, $param . ' > ' . $property_key );
if ( ! $result || is_wp_error( $result ) ) {
// If schema validation fails, we return here as we don't need to validate any deeper.
return $result;
}
}
}