[pve-devel] [PATCH pve-manager v2 4/4] api: add replication config read return schema

Nicolas Frey n.frey at proxmox.com
Thu Oct 2 13:18:40 CEST 2025



On 10/2/25 10:51 AM, Thomas Lamprecht wrote:
> Am 24.09.25 um 13:59 schrieb n.frey at proxmox.com:
>> From: Nicolas Frey <n.frey at proxmox.com>
>>
>> removed delete from schema for return types, as it is only used
>> in update/PUT.
>>
>> Signed-off-by: Nicolas Frey <n.frey at proxmox.com>
>> ---
>>  PVE/API2/ReplicationConfig.pm | 11 ++++++-----
>>  1 file changed, 6 insertions(+), 5 deletions(-)
>>
>> diff --git a/PVE/API2/ReplicationConfig.pm b/PVE/API2/ReplicationConfig.pm
>> index 307ebe69..d6451d85 100644
>> --- a/PVE/API2/ReplicationConfig.pm
>> +++ b/PVE/API2/ReplicationConfig.pm
>> @@ -17,6 +17,10 @@ use PVE::API2::Replication;
>>  
>>  use base qw(PVE::RESTHandler);
>>  
>> +my $replication_config_return_type = PVE::ReplicationConfig->createSchema();
>> +# delete only used in update endpoint
>> +delete $replication_config_return_type->{delete};
>> +
> 
> Which makes one rather wonder why it gets returned for the create schema in
> the first place – after all we do have a updateSchema
> 

Thank you for pointing that out. That was an error on my part, I mixed up
code from createSchema/updateSchema. So removing 'delete' is redundant.

AFAICT the create schema *can* be used as the return for this endpoint,
as long as 'guest' and 'digest' properties are added (which I missed in
v2, I apologize).

>>  __PACKAGE__->register_method({
>>      name => 'index',
>>      path => '',
>> @@ -33,10 +37,7 @@ __PACKAGE__->register_method({
>>      },
>>      returns => {
>>          type => 'array',
>> -        items => {
>> -            type => "object",
>> -            properties => {},
>> -        },
>> +        items => $replication_config_return_type,
>>          links => [{ rel => 'child', href => "{id}" }],
>>      },
>>      code => sub {
>> @@ -75,7 +76,7 @@ __PACKAGE__->register_method({
>>              id => get_standard_option('pve-replication-id'),
>>          },
>>      },
>> -    returns => { type => 'object' },
>> +    returns => $replication_config_return_type,
>>      code => sub {
>>          my ($param) = @_;
>>  
> 





More information about the pve-devel mailing list