Skip to content

Commit

Permalink
allow extra fields at top level
Browse files Browse the repository at this point in the history
Some fields are added from the front end rather than an author.json
file. Since we aren't updating those, we shouldn't count them as
different.
  • Loading branch information
haarg committed Feb 23, 2024
1 parent 398c512 commit 8cce2a7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/MetaCPAN/Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,11 @@ sub single_valued_arrayref_to_scalar {
}

sub diff_struct {
my (@queue) = [ @_, '' ];
my ( $old_root, $new_root, $allow_extra ) = @_;
my (@queue) = [ $old_root, $new_root, '', $allow_extra ];

while ( my $check = shift @queue ) {
my ( $old, $new, $path ) = @$check;
my ( $old, $new, $path, $allow_extra ) = @$check;
if ( !defined $new ) {
return [ $path, $old, $new ]
if defined $old;
Expand All @@ -184,7 +185,8 @@ sub diff_struct {
}
elsif ( is_plain_hashref($new) ) {
return [ $path, $old, $new ]
if !is_plain_hashref($old) || keys %$new != keys %$old;
if !is_plain_hashref($old)
|| !$allow_extra && keys %$new != keys %$old;
push @queue, map [ $old->{$_}, $new->{$_}, "$path/$_" ],
keys %$new;
}
Expand Down

0 comments on commit 8cce2a7

Please sign in to comment.