* [pve-devel] [PATCH common 1/2] indentation fix
@ 2021-03-18 8:44 Fabian Ebner
2021-03-18 8:44 ` [pve-devel] [PATCH common 2/2] schema: check format: parse list formats as arrays Fabian Ebner
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Fabian Ebner @ 2021-03-18 8:44 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
src/PVE/JSONSchema.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
index 20d72b3..e9d10da 100644
--- a/src/PVE/JSONSchema.pm
+++ b/src/PVE/JSONSchema.pm
@@ -715,7 +715,7 @@ sub check_format {
}
} elsif ($format_type eq 'opt') {
$parsed = $registered->($value) if $value;
- } else {
+ } else {
if (ref($registered) eq 'HASH') {
# Note: this is the only case where a validator function could be
# attached, hence it's safe to handle that in parse_property_string.
--
2.20.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [pve-devel] [PATCH common 2/2] schema: check format: parse list formats as arrays
2021-03-18 8:44 [pve-devel] [PATCH common 1/2] indentation fix Fabian Ebner
@ 2021-03-18 8:44 ` Fabian Ebner
2021-05-03 11:05 ` [pve-devel] applied: " Thomas Lamprecht
2021-04-30 6:39 ` [pve-devel] [PATCH common 1/2] indentation fix Fabian Ebner
2021-05-03 11:05 ` [pve-devel] applied: " Thomas Lamprecht
2 siblings, 1 reply; 5+ messages in thread
From: Fabian Ebner @ 2021-03-18 8:44 UTC (permalink / raw)
To: pve-devel
Previously, the returned value would be only the last element or undef in case
of an empty list. There's only a handful of callers of check_format() that look
at the return value and AFAICT none of the exisitng ones is for a -list format.
But best to avoid any future surprises.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
src/PVE/JSONSchema.pm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
index e9d10da..0586105 100644
--- a/src/PVE/JSONSchema.pm
+++ b/src/PVE/JSONSchema.pm
@@ -709,9 +709,10 @@ sub check_format {
if $format_type ne 'none' && ref($registered) ne 'CODE';
if ($format_type eq 'list') {
+ $parsed = [];
# Note: we allow empty lists
foreach my $v (split_list($value)) {
- $parsed = $registered->($v);
+ push @{$parsed}, $registered->($v);
}
} elsif ($format_type eq 'opt') {
$parsed = $registered->($value) if $value;
--
2.20.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [pve-devel] applied: [PATCH common 2/2] schema: check format: parse list formats as arrays
2021-03-18 8:44 ` [pve-devel] [PATCH common 2/2] schema: check format: parse list formats as arrays Fabian Ebner
@ 2021-05-03 11:05 ` Thomas Lamprecht
0 siblings, 0 replies; 5+ messages in thread
From: Thomas Lamprecht @ 2021-05-03 11:05 UTC (permalink / raw)
To: Proxmox VE development discussion, Fabian Ebner
On 18.03.21 09:44, Fabian Ebner wrote:
> Previously, the returned value would be only the last element or undef in case
> of an empty list. There's only a handful of callers of check_format() that look
> at the return value and AFAICT none of the exisitng ones is for a -list format.
> But best to avoid any future surprises.
>
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
> src/PVE/JSONSchema.pm | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>
applied, thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [pve-devel] [PATCH common 1/2] indentation fix
2021-03-18 8:44 [pve-devel] [PATCH common 1/2] indentation fix Fabian Ebner
2021-03-18 8:44 ` [pve-devel] [PATCH common 2/2] schema: check format: parse list formats as arrays Fabian Ebner
@ 2021-04-30 6:39 ` Fabian Ebner
2021-05-03 11:05 ` [pve-devel] applied: " Thomas Lamprecht
2 siblings, 0 replies; 5+ messages in thread
From: Fabian Ebner @ 2021-04-30 6:39 UTC (permalink / raw)
To: pve-devel
Ping for both patches
Am 18.03.21 um 09:44 schrieb Fabian Ebner:
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
> src/PVE/JSONSchema.pm | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
> index 20d72b3..e9d10da 100644
> --- a/src/PVE/JSONSchema.pm
> +++ b/src/PVE/JSONSchema.pm
> @@ -715,7 +715,7 @@ sub check_format {
> }
> } elsif ($format_type eq 'opt') {
> $parsed = $registered->($value) if $value;
> - } else {
> + } else {
> if (ref($registered) eq 'HASH') {
> # Note: this is the only case where a validator function could be
> # attached, hence it's safe to handle that in parse_property_string.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [pve-devel] applied: [PATCH common 1/2] indentation fix
2021-03-18 8:44 [pve-devel] [PATCH common 1/2] indentation fix Fabian Ebner
2021-03-18 8:44 ` [pve-devel] [PATCH common 2/2] schema: check format: parse list formats as arrays Fabian Ebner
2021-04-30 6:39 ` [pve-devel] [PATCH common 1/2] indentation fix Fabian Ebner
@ 2021-05-03 11:05 ` Thomas Lamprecht
2 siblings, 0 replies; 5+ messages in thread
From: Thomas Lamprecht @ 2021-05-03 11:05 UTC (permalink / raw)
To: Proxmox VE development discussion, Fabian Ebner
On 18.03.21 09:44, Fabian Ebner wrote:
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
> src/PVE/JSONSchema.pm | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>
applied, thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-05-03 11:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18 8:44 [pve-devel] [PATCH common 1/2] indentation fix Fabian Ebner
2021-03-18 8:44 ` [pve-devel] [PATCH common 2/2] schema: check format: parse list formats as arrays Fabian Ebner
2021-05-03 11:05 ` [pve-devel] applied: " Thomas Lamprecht
2021-04-30 6:39 ` [pve-devel] [PATCH common 1/2] indentation fix Fabian Ebner
2021-05-03 11:05 ` [pve-devel] applied: " Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox