work on auto-generating parts of docs from JSONSchema

This commit is contained in:
Joel Wetzell
2026-06-01 18:03:47 -05:00
parent e22e25afe2
commit f82b55963b
67 changed files with 2471 additions and 257 deletions
+28
View File
@@ -0,0 +1,28 @@
---
const {schema} = Astro.props
---
<ul>
{Object.keys(schema.properties).map((key)=>{
const propertySchema = schema.properties[key]
const isRequired = schema.required ? schema.required.includes(key) : false
var description = ""
if (!isRequired) {
if (propertySchema.default !== undefined) {
description += `(optional, default <code>${JSON.stringify(propertySchema.default)}</code>)`
} else {
description += "(optional)"
}
}
if (propertySchema.description) {
description += ` ${propertySchema.description}`
}
if (description !== "") {
description = ": " + description
}
return <li><strong>{key}</strong><Fragment set:html={description}/></li>
})}
</ul>