Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Continue validating after doing nested properties
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejolley committed Nov 20, 2023
1 parent a7205fc commit e6ae687
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/StoreApi/Schemas/V1/AbstractSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,18 @@ protected function get_recursive_validate_callback( $properties ) {
}

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

Expand Down

0 comments on commit e6ae687

Please sign in to comment.