Skip to content

Commit

Permalink
Also show empty array query parameters in Postman (#691)
Browse files Browse the repository at this point in the history
  • Loading branch information
laudaikinhdi authored Jun 30, 2023
1 parent ff59a30 commit 974225c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Writing/PostmanCollectionWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 974225c

Please sign in to comment.