Skip to content

Commit

Permalink
feat: ability to merge docs;
Browse files Browse the repository at this point in the history
Refs: #45
  • Loading branch information
pirs1337 committed Aug 7, 2022
1 parent 6c0e1cf commit 5405dba
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/Http/Controllers/AutoDocController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public function documentation()
$additionalDocs = config('auto-doc.additional_paths');

if (!empty($additionalDocs)) {
foreach ($additionalDocs as $filePath) {
array_map(function ($filePath) {
$fileContent = json_decode(file_get_contents($filePath), true);

$paths = array_keys($fileContent['paths']);

$callback = function ($path) use ($fileContent) {
array_map(function ($path) use ($fileContent) {
if (empty($this->documentation['paths'][$path])) {
$this->documentation['paths'][$path] = $fileContent['paths'][$path];
} else {
Expand All @@ -50,10 +50,8 @@ public function documentation()
$this->documentation['definitions'][$definition] = $fileContent['definitions'][$definition];
}
}, $definitions);
};

array_map($callback, $paths);
}
}, $paths);
}, $additionalDocs);
}

return response()->json($this->documentation);
Expand Down

0 comments on commit 5405dba

Please sign in to comment.