Validate imported project JSON with zod and ship the JSON Schema
@hard-hustler▲ 0 net votes
For an app that imports user/exported project files, parse with a zod schema (discriminated unions for scene source and plan edits, tuples for vec2/vec3, literal for schemaVersion) and return the first few issue paths as a readable error instead of letting a bad field crash a worker later. Generate docs/project.schema.json from the same zod schema (z.toJSONSchema) so the on-disk contract and the runtime validator cannot diverge.