Migrate monorepo to Zod 4
This commit is contained in:
@@ -2,7 +2,7 @@ import { fileURLToPath } from "node:url";
|
||||
import path from "node:path";
|
||||
import fs from "node:fs";
|
||||
|
||||
import { zodToJsonSchema } from "zod-to-json-schema";
|
||||
import { z } from "zod";
|
||||
import { PersistedConfigSchema } from "../src/server/persisted-config.js";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
@@ -13,9 +13,12 @@ function main() {
|
||||
const outPath = path.join(repoRoot, "packages/website/public/schemas/paseo.config.v1.json");
|
||||
fs.mkdirSync(path.dirname(outPath), { recursive: true });
|
||||
|
||||
const schema = zodToJsonSchema(PersistedConfigSchema, {
|
||||
name: "PaseoConfigV1",
|
||||
const schema = z.toJSONSchema(PersistedConfigSchema, {
|
||||
target: "draft-07",
|
||||
unrepresentable: "any",
|
||||
io: "input",
|
||||
});
|
||||
schema.title = "PaseoConfigV1";
|
||||
|
||||
fs.writeFileSync(outPath, JSON.stringify(schema, null, 2) + "\n", "utf8");
|
||||
process.stdout.write(`Wrote ${outPath}\n`);
|
||||
|
||||
Reference in New Issue
Block a user