| 101 | } |
| 102 | |
| 103 | function checkArrayFields( |
| 104 | fm: ParsedFrontmatter, |
| 105 | issues: ValidationIssue[] |
| 106 | ): void { |
| 107 | for (const name of STRING_ARRAY_FIELDS) { |
| 108 | const field = fm.fields.get(name); |
| 109 | if (!field) continue; |
| 110 | |
| 111 | const val = field.value; |
| 112 | // null/undefined means field present but no value, which is fine (treated as empty array) |
| 113 | if (val === null || val === undefined) continue; |
| 114 | |
| 115 | if (!Array.isArray(val)) { |
| 116 | issues.push({ |
| 117 | severity: "error", |
| 118 | message: `'${name}' should be an array, got ${typeof val}`, |
| 119 | field: name, |
| 120 | target: "value", |
| 121 | }); |
| 122 | } |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | function checkDateFields( |
| 127 | fm: ParsedFrontmatter, |