(defs: Record<string, unknown>)
| 169 | } |
| 170 | |
| 171 | function renameBrandDefinitionKeys(defs: Record<string, unknown>): void { |
| 172 | for (const oldKey of Object.keys(defs)) { |
| 173 | const newKey = fixBrandCasing(oldKey); |
| 174 | if (newKey === oldKey) continue; |
| 175 | if (newKey in defs && stableStringify(defs[newKey]) !== stableStringify(defs[oldKey])) { |
| 176 | throw new Error( |
| 177 | `Brand-casing normalization collision: "${oldKey}" -> "${newKey}" but a different definition already exists under "${newKey}".` |
| 178 | ); |
| 179 | } |
| 180 | defs[newKey] = defs[oldKey]; |
| 181 | delete defs[oldKey]; |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | /** Load a JSON schema file and normalize GitHub brand casing in titles, refs, and definition keys. */ |
| 186 | export async function loadSchemaJson<T>(filePath: string): Promise<T> { |
no test coverage detected
searching dependent graphs…