Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/LaravelRequestDocs.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,23 @@ public function filterByMethods($docs, $get, $post, $put, $path, $delete, $head)

public function groupDocs($docs, $group = 'default')
{
if ($group === 'default') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better than before, but still not quite there.
Screen Shot 2023-02-25 at 17 28 30

 { "uri": "api/v1/health", "methods": [ "GET" ], "middlewares": [ "api" ], .... ], "group": "api/v1/health", "group_index": 0 }, { "uri": "api/v1/not-health", "methods": [ "GET" ], 

merged but will reopen the issue #143
Won't push new tag yet.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loop on UI is here

{lrdDocsJson.map((lrdDocsItem) => (
lrdDocsItem.methods.map((method, methodIndex) => (
<div key={shortid.generate()}>
{(lrdDocsItem.group != null && lrdDocsItem.group != "" && lrdDocsItem.group_index == 0 && methodIndex == 0) && (
<li className="pt-5 text-slate-600">
{/* Only in case of controller names full path -> just controller name */}
{lrdDocsItem.group.split('\\').pop()}
</li>
)}
<li>
<AnchorLink href={'#' + method + lrdDocsItem.uri} className="flex flex-row px-0 py-1">
<span className={`method-${method} uppercase text-xs w-12 p-0 flex flex-row-reverse`}>
{method}
</span>
<span className="flex-1 p-0 text-sm text-left break-all">
{lrdDocsItem.uri}
</span>
</AnchorLink>
</li>
</div>
))
))}

return $docs;
}

$groupDocs = [];

if ($group === 'api_uri') {
return $this->groupDocsByAPIURI($docs);
$groupDocs = $this->groupDocsByAPIURI($docs);
}

if ($group === 'controller_full_path') {
return $this->groupDocsByFQController($docs);
$groupDocs = $this->groupDocsByFQController($docs);
}

return $docs;
return collect($groupDocs)->sortBy(['group', 'group_index'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably this

 return collect($groupDocs)->groupBy(['group', 'group_index']) ->values() ->flatten(2) ->toArray(); 
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 $groupBy = ['group', 'group_index']; return collect($groupDocs)->groupBy($groupBy) ->values() ->flatten(count($groupBy)) ->toArray(); 
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes here #150

Copy link
Member

@kevincobain2000 kevincobain2000 Feb 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix is fine but
ah UT failed, so will revert changes c938063
Will wait for your pull req

->values()
->toArray();
}

public function getControllersInfo(): array
Expand Down
Loading