Skip to content

Commit c66a836

Browse files
committed
build(docs): avoid empty parameters tables
1 parent e0203a8 commit c66a836

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

scripts/update-endpoints/docs.js

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,24 @@ ${param.description}
5151
})`
5252
: "()");
5353

54+
const parametersTable = `
55+
<table>
56+
<thead>
57+
<tr>
58+
<th>name</th>
59+
<th>required</th>
60+
<th>description</th>
61+
</tr>
62+
</thead>
63+
<tbody>
64+
${parameterRows.join("\n")}
65+
</tbody>
66+
</table>`;
67+
68+
const parameters = endpoint.parameters.length
69+
? parametersTable
70+
: `This endpoint has no parameters`;
71+
5472
const content = `
5573
# ${endpoint.name}
5674
@@ -66,18 +84,7 @@ ${example}
6684
6785
## Parameters
6886
69-
<table>
70-
<thead>
71-
<tr>
72-
<th>name</th>
73-
<th>required</th>
74-
<th>description</th>
75-
</tr>
76-
</thead>
77-
<tbody>
78-
${parameterRows.join("\n")}
79-
</tbody>
80-
</table>
87+
${parameters}
8188
8289
See also: [GitHub Developer Guide documentation](endpoint.documentationUrl).`;
8390

0 commit comments

Comments
 (0)