From 974225c6169d4d487d4aca3600d6868b8937a2d7 Mon Sep 17 00:00:00 2001 From: laudaikinhdi <34116228+laudaikinhdi@users.noreply.github.com> Date: Sat, 1 Jul 2023 05:22:02 +0700 Subject: [PATCH] Also show empty array query parameters in Postman (#691) --- src/Writing/PostmanCollectionWriter.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Writing/PostmanCollectionWriter.php b/src/Writing/PostmanCollectionWriter.php index 71dade1d..f1f334ab 100644 --- a/src/Writing/PostmanCollectionWriter.php +++ b/src/Writing/PostmanCollectionWriter.php @@ -300,6 +300,16 @@ protected function generateUrlObject(OutputEndpointData $endpointData): array 'disabled' => !$parameterData->required && empty($parameterData->example), ]; } + // If there are no values, add one entry so the parameter shows up in the Postman UI. + if (empty($values)) { + $query[] = [ + 'key' => "{$name}[]", + 'value' => '', + 'description' => strip_tags($parameterData->description), + // Default query params to disabled if they aren't required and have empty values + 'disabled' => true, + ]; + } } else { $query[] = [ 'key' => urlencode($name),