From e8cc96954ceb3a738acade28e9e694b3d2269085 Mon Sep 17 00:00:00 2001 From: James Edmonds Date: Sat, 2 Nov 2024 09:08:30 +1030 Subject: [PATCH] fix!: use default passed to generate (#215) * fix: use default passed to generate * lint * update text expectation --- src/core/generate.test.ts | 4 ++-- src/core/generate.ts | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/core/generate.test.ts b/src/core/generate.test.ts index ca9dd569..d285a8c1 100644 --- a/src/core/generate.test.ts +++ b/src/core/generate.test.ts @@ -1177,11 +1177,11 @@ describe("generate", () => { "// Generated by ts-to-zod import { z } from "zod"; - import { heroSchema } from "${output}"; + import { zHero } from "${output}"; export const zPerson = z.object({ id: z.number(), - hero: heroSchema + hero: zHero }); " `); diff --git a/src/core/generate.ts b/src/core/generate.ts index 24838b19..1257a938 100644 --- a/src/core/generate.ts +++ b/src/core/generate.ts @@ -141,8 +141,7 @@ export function generate({ ); if (eligibleMapping) { - const schemaMethod = - eligibleMapping.getSchemaName || DEFAULT_GET_SCHEMA; + const schemaMethod = eligibleMapping.getSchemaName || getSchemaName; const identifiers = getImportIdentifiers(node); identifiers.forEach((i) =>