|
|
|
@ -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",
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|