Skip to content

Commit f9c0d18

Browse files
committed
feat: register default data types as schema
1 parent 4de2e89 commit f9c0d18

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

ts/scripts/build-definitions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ async function main() {
333333

334334
const lines = [
335335
`import {z} from "zod";`,
336+
`import {registerSchema} from "${srcRelativePath(def.relModule, "internal/zod-schema")}";`,
336337
...refs.flatMap(ref => {
337338
const refDef = schemaToFile.get(ref);
338339
return refDef ? [`import {${ref}} from "${relativeImport(def.relModule, refDef, refDef.fileName)}";`] : [];
@@ -341,6 +342,8 @@ async function main() {
341342
`export const ${schemaName} = ${body};`,
342343
`export type ${def.className}${typeParams} = z.infer<typeof ${schemaName}>;`,
343344
``,
345+
`registerSchema(${schemaName}, ${JSON.stringify(def.identifier)});`,
346+
``,
344347
];
345348

346349
const outDir = path.join(OUTPUT_DIR, def.relModule);

0 commit comments

Comments
 (0)