From da08aee2cb685337337b6f796e13bacff27aa916 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 8 May 2025 17:39:47 +0200 Subject: [PATCH] feat: allow setting system config values with json value Signed-off-by: Robin Appelman --- core/Command/Config/System/SetConfig.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/Command/Config/System/SetConfig.php b/core/Command/Config/System/SetConfig.php index 693bc9bb12b18..4ea3383695641 100644 --- a/core/Command/Config/System/SetConfig.php +++ b/core/Command/Config/System/SetConfig.php @@ -142,6 +142,13 @@ protected function castValue($value, $type) { 'readable-value' => ($value === '') ? 'empty string' : 'string ' . $value, ]; + case 'json': + $value = json_decode($value, true); + return [ + 'value' => $value, + 'readable-value' => 'json ' . json_encode($value), + ]; + default: throw new \InvalidArgumentException('Invalid type'); } @@ -183,7 +190,7 @@ protected function mergeArrayValue(array $configNames, $existingValues, $value, */ public function completeOptionValues($optionName, CompletionContext $context) { if ($optionName === 'type') { - return ['string', 'integer', 'double', 'boolean']; + return ['string', 'integer', 'double', 'boolean', 'json', 'null']; } return parent::completeOptionValues($optionName, $context); }