Skip to content

Commit 2a5e824

Browse files
committed
Replace methods with http_method
1 parent eeb08ff commit 2a5e824

File tree

5 files changed

+30
-36
lines changed

5 files changed

+30
-36
lines changed

src/Doc.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,6 @@ public function toArray(): array
325325
{
326326
$result = [
327327
'uri' => $this->uri,
328-
'methods' => $this->methods,
329328
'middlewares' => $this->middlewares,
330329
'controller' => $this->controller,
331330
'controller_full_path' => $this->controllerFullPath,

ui/src/components/App.tsx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default function App() {
4747
setHost(domain)
4848
url = domain + "/request-docs/api"
4949
}
50-
50+
5151
if (url) {
5252
// extract host from url
5353
const domain = url?.split('/').slice(0, 3).join('/');
@@ -131,21 +131,19 @@ export default function App() {
131131
</div>
132132
<div className="pt-10 col-span-7">
133133
{lrdDocsJson.map((lrdDocsItem) => (
134-
lrdDocsItem.methods.map((method) => (
135-
<div key={shortid.generate()}>
136-
<div className="min-h-screen">
137-
<div className="main-grid grid grid-cols-10 gap-2">
138-
<div className="col-span-4 ml-5">
139-
<ApiInfo lrdDocsItem={lrdDocsItem} method={method}/>
140-
</div>
141-
<div className="col-span-5 ml-5">
142-
<ApiAction lrdDocsItem={lrdDocsItem} method={method} host={host}/>
143-
</div>
134+
<div key={shortid.generate()}>
135+
<div className="min-h-screen">
136+
<div className="main-grid grid grid-cols-10 gap-2">
137+
<div className="col-span-4 ml-5">
138+
<ApiInfo lrdDocsItem={lrdDocsItem} method={lrdDocsItem.http_method}/>
139+
</div>
140+
<div className="col-span-5 ml-5">
141+
<ApiAction lrdDocsItem={lrdDocsItem} method={lrdDocsItem.http_method} host={host}/>
144142
</div>
145143
</div>
146-
<div className="divider"></div>
147144
</div>
148-
))
145+
<div className="divider"></div>
146+
</div>
149147
))}
150148
</div>
151149
</div>

ui/src/components/Sidebar.tsx

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,24 @@ export default function Sidebar(props: Props) {
2020
</h2>
2121
<ul>
2222
{lrdDocsJson.map((lrdDocsItem) => (
23-
lrdDocsItem.methods.map((method, methodIndex) => (
24-
<div key={shortid.generate()}>
25-
{(lrdDocsItem.group != null && lrdDocsItem.group != "" && lrdDocsItem.group_index == 0 && methodIndex == 0) && (
26-
<li className="pt-5 text-slate-600">
27-
{/* Only in case of controller names full path -> just controller name */}
28-
{lrdDocsItem.group.split('\\').pop()}
29-
</li>
30-
)}
31-
<li>
32-
<AnchorLink href={'#' + method + lrdDocsItem.uri} className="flex flex-row px-0 py-1">
33-
<span className={`method-${method} uppercase text-xs w-12 p-0 flex flex-row-reverse`}>
34-
{method}
23+
<div key={shortid.generate()}>
24+
{(lrdDocsItem.group != null && lrdDocsItem.group != "" && lrdDocsItem.group_index == 0) && (
25+
<li className="pt-5 text-slate-600">
26+
{/* Only in case of controller names full path -> just controller name */}
27+
{lrdDocsItem.group.split('\\').pop()}
28+
</li>
29+
)}
30+
<li>
31+
<AnchorLink href={'#' + lrdDocsItem.http_method + lrdDocsItem.uri} className="flex flex-row px-0 py-1">
32+
<span className={`method-${lrdDocsItem.http_method} uppercase text-xs w-12 p-0 flex flex-row-reverse`}>
33+
{lrdDocsItem.http_method}
3534
</span>
36-
<span className="flex-1 p-0 text-sm text-left break-all">
35+
<span className="flex-1 p-0 text-sm text-left break-all">
3736
{lrdDocsItem.uri}
3837
</span>
39-
</AnchorLink>
40-
</li>
41-
</div>
42-
))
38+
</AnchorLink>
39+
</li>
40+
</div>
4341
))}
4442
<li className='bg-transparent'></li>
4543
<li className='bg-transparent'></li>

ui/src/components/elements/ApiActionInfo.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ export default function ApiActionInfo(props: Props) {
3030
<tr>
3131
<th>Method</th>
3232
<td>
33-
<span className={`method-${lrdDocsItem.httpMethod} uppercase`}>
34-
{lrdDocsItem.httpMethod}
33+
<span className={`method-${lrdDocsItem.http_method} uppercase`}>
34+
{lrdDocsItem.http_method}
3535
</span>
3636
</td>
3737
</tr>

ui/src/libs/types.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@ export interface IAPIRule {
33
}
44
export interface IAPIInfo {
55
uri: string;
6-
methods: string[];
76
middlewares: string[];
87
controller: string;
98
controller_full_path: string;
109
method: string;
11-
httpMethod: string;
10+
http_method: string;
1211
rules: IAPIRule;
1312
docBlock: string;
1413
group: string;
1514
group_index: number;
1615
responses: string[];
17-
}
16+
}

0 commit comments

Comments
 (0)