Skip to content

Commit f94766b

Browse files
Enhance SchemaRow component to indicate required fields (#19504)
1 parent 27cec60 commit f94766b

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/components/models/SchemaRow.astro

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,15 @@ const { node, root } = Astro.props;
1212
node.title ? (
1313
<span class="mr-2 font-bold">{node.title}</span>
1414
) : (
15-
<code class="mr-2 !pr-0 font-mono rounded-md bg-gray-100">
15+
<code class="mr-2 rounded-md bg-gray-100 !pr-0 font-mono">
1616
{node.subpath[node.subpath.length - 1]}
17+
{node.parent.fragment?.required?.includes(
18+
node.subpath[node.subpath.length - 1],
19+
) ? (
20+
<span class="font-semibold text-red-500">*</span>
21+
) : (
22+
""
23+
)}
1724
</code>
1825
)
1926
}
@@ -46,7 +53,7 @@ const { node, root } = Astro.props;
4653

4754
{
4855
node.children && (
49-
<ul class="!list-none m-0 p-0 ml-4">
56+
<ul class="m-0 ml-4 !list-none p-0">
5057
{node.children.map((node: SchemaNode) => (
5158
<Astro.self node={node} />
5259
))}

src/pages/workers-ai/models/[name].astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ const starlightPageProps = {
223223
}
224224

225225
<h2 id="Parameters">Parameters</h2>
226+
<p><span class="text-red-500">*</span> indicates a required field</p>
226227
<h3 id="Input">Input</h3>
227228
<SchemaViewer schema={model.schema.input} />
228229

0 commit comments

Comments
 (0)