TT#153050 add API soft_expand query parameter

* soft_expand=1 in API requests when coped with the expand
  query parameter tells the API to ignore possible expand
  conflicts (such as field mismatch or a permission issue),
  returning 200 OK instead of 409 Conflict

Change-Id: Ib798aabddb1b4d66fc9708acbf713037696ad600
mr10.3
Kirill Solomko 4 years ago
parent 5445c72cc7
commit 4e309b9ef1

@ -1304,6 +1304,7 @@ sub expand_fields {
return unless $resource_form;
my @found_fields;
my $soft_expand = $c->req->params->{soft_expand} // 0;
my $expand_param = $c->req->param('expand') // return 1;
my $all = $expand_param eq 'all' ? 1 : 0;
my @expand_fields = $all ? map { $_->name } $resource_form->fields
@ -1314,7 +1315,7 @@ sub expand_fields {
push @found_fields, $found if $found;
}
unless ($all || $#expand_fields == $#found_fields) {
unless ($soft_expand || $all || $#expand_fields == $#found_fields) {
$c->log->debug("Provided expand fields are invalid");
$self->error($c, HTTP_CONFLICT, "Provided expand fields are invalid");
return;

Loading…
Cancel
Save