import schema from "../../../sequoia.schema.json" with { type: "json" }; type PropertyInfo = { path: string; type: string; required: boolean; default?: string | number | boolean; description?: string; }; function extractProperties( properties: Record, required: string[], parentPath: string, parentRequired: boolean, result: PropertyInfo[], ): void { for (const [key, value] of Object.entries(properties)) { const prop = value as Record; const fullPath = parentPath ? `${parentPath}.${key}` : key; const isRequired = parentRequired && required.includes(key); if (prop.properties) { extractProperties( prop.properties as Record, (prop.required as string[]) || [], fullPath, isRequired, result, ); } else { result.push({ path: fullPath, type: prop.type, required: isRequired, default: prop.default, description: prop.description, } as PropertyInfo); } } } export default function ConfigTable() { const rows: PropertyInfo[] = []; extractProperties( schema.properties as Record, schema.required as string[], "", true, rows, ); // Show $schema, then required fields alphabetically, then optional fields alphabetically. rows.sort( (a, b) => Number(b.path === "$schema") - Number(a.path === "$schema") || Number(b.required) - Number(a.required) || a.path.localeCompare(b.path), ); return ( {rows.map((row) => ( ))}
Field Type Required Default Description
{row.path} {row.type} {row.required ? "Yes" : ""} {row.default === undefined ? ( "" ) : ( {typeof row.default === "string" ? `"${row.default}"` : `${row.default}`} )} {row.description || ""}
); }