(data: unknown)
| 81 | // per failure (empty array = valid). The shared single-item check behind both the |
| 82 | // batch parse and the interactive folder prompt, so both reject the same shapes. |
| 83 | export function validateComponent(data: unknown): string[] { |
| 84 | const validate = compileDeployComponentValidator(); |
| 85 | if (validate(data)) return []; |
| 86 | return (validate.errors ?? []).map((e) => { |
| 87 | const p = e.params as Record<string, unknown>; |
| 88 | // Name the offending key for the two errors where it's the whole point: |
| 89 | // an unknown/typo'd property and a missing required one. |
| 90 | const which = p.additionalProperty ?? p.missingProperty; |
| 91 | const detail = typeof which === "string" ? ` "${which}"` : ""; |
| 92 | return `${e.instancePath || "/"} ${e.message ?? "invalid"}${detail}`; |
| 93 | }); |
| 94 | } |
| 95 | |
| 96 | // Validates each parsed component.json against the contract, collecting every |
| 97 | // failure as "<source>: <message>" before throwing — the same all-at-once style as |
no test coverage detected