TT#47024 Use config to document allowed Accept header values

Change-Id: If4c064d36ac0fadc97f5dd193bdafe619494e4e4
changes/18/24618/11
Irina Peshinskaya 7 years ago
parent e36c5da012
commit 7c13308271

@ -226,6 +226,7 @@ sub GET : Allow {
fields => $form_fields,
uploads => $form_fields_upload,
config => $full_mod->config ,
( $full_item_mod && $full_item_mod->can('config') ) ? (item_config => $full_item_mod->config) : () ,
query_params => $query_params,
actions => $actions,
item_actions => $item_actions,

@ -15,7 +15,7 @@ my $collections_files_cache;
sub check_resource_reseller_id {
my($api, $c, $resource, $old_resource) = @_;
my $reseller;
if( $resource->{reseller_id}
if( $resource->{reseller_id}
&& (( ! $old_resource ) || $old_resource->{reseller_id} != $resource->{reseller_id} )) {
$reseller = $c->model('DB')->resultset('resellers')->find($resource->{reseller_id});
unless( $reseller ) {
@ -281,19 +281,36 @@ sub generate_swagger_datastructure {
}
if (grep {m/^GET$/} @{ $col->{item_actions} }) {
my $action_config = $col->{item_config}->{action}->{GET};
my $produces = $action_config->{ReturnContentType}
? ref $action_config->{ReturnContentType} eq 'ARRAY'
? $action_config->{ReturnContentType}
: $action_config->{ReturnContentType} eq 'binary' ? ['application/octet-stream'] : undef
: undef;
$item_p->{get} = {
summary => "Get a specific $entity",
tags => ["$entity"],
$produces ? ( produces => $produces ) : (),
responses => {
"200" => {
description => "$title",
content => {
"application/json" => {
$produces ? ( content => { map {
$_ => {
schema => {
'$ref' => "#/components/schemas/$entity",
$_ ne 'application/json'
? (type => 'string')
: ('$ref' => "#/components/schemas/$entity"),
}
},
},
} } @$produces } )
: (
content => {
"application/json" => {
schema => {
'$ref' => "#/components/schemas/$entity",
}
},
}
),
}
}
};

Loading…
Cancel
Save