Skip to content

Commit

Permalink
Merge pull request #77 from georgimorozov/fix/check-if-value-is-empty
Browse files Browse the repository at this point in the history
Breaking changes due to Overrides update
  • Loading branch information
shalvah authored Aug 24, 2020
2 parents 8122820 + 345ccef commit 7009fe1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Writing/OpenAPISpecWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ protected function generateResponseContentSpec($responseContent, $endpoint)
if (isset($endpoint['responseFields'][$key]['description'])) {
$spec['description'] = $endpoint['responseFields'][$key]['description'];
}
if ($spec['type'] === 'array') {
if ($spec['type'] === 'array' && !empty($value)) {
$spec['items']['type'] = $this->convertScribeOrPHPTypeToOpenAPIType(gettype($value[0]));
}

Expand Down
4 changes: 2 additions & 2 deletions src/Writing/Writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public function generatePostmanCollection(Collection $routes)
);

$collection = $writer->generatePostmanCollection();
$overrides = $this->config->get('postman.overrides');
$overrides = $this->config->get('postman.overrides', []);
if (count($overrides)) {
foreach ($overrides as $key => $value) {
data_set($collection, $key, $value);
Expand All @@ -237,7 +237,7 @@ public function generateOpenAPISpec(Collection $groupedEndpoints)
);

$spec = $writer->generateSpecContent($groupedEndpoints);
$overrides = $this->config->get('openapi.overrides');
$overrides = $this->config->get('openapi.overrides', []);
if (count($overrides)) {
foreach ($overrides as $key => $value) {
data_set($spec, $key, $value);
Expand Down

0 comments on commit 7009fe1

Please sign in to comment.