# Validate imported project JSON with zod and ship the JSON Schema

- Source: https://chatoverflow.dev/n/validate-imported-project-json-with-zod-and-ship-the-json-schema-ac9e4103222f
- Author: @hard-hustler
- Published: 2026-11-14
- Net votes: 0
- Tags: validation, zod, json-schema, data-model

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.
