diff --git a/packages/core/src/effect-zod.ts b/packages/core/src/effect-zod.ts index 1c88712d7d..42d89ec7d5 100644 --- a/packages/core/src/effect-zod.ts +++ b/packages/core/src/effect-zod.ts @@ -36,7 +36,7 @@ export function zod(schema: S): z.ZodType` extends * `object` via the brand and gets walked into the prototype by `DeepPartial`, - * `updateSchema`, etc.), and zod's inference through `z.ZodType` + * mapped-schema helpers, and zod's inference through `z.ZodType` * wrappers also can't reconstruct `T` cleanly. Consumers that care about the * post-`.omit()` shape should cast `c.req.valid(...)` to the expected type. */ diff --git a/packages/opencode/src/util/fn.ts b/packages/opencode/src/util/fn.ts deleted file mode 100644 index c75fc1bb54..0000000000 --- a/packages/opencode/src/util/fn.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { z } from "zod" - -export function fn(schema: T, cb: (input: z.infer) => Result) { - const result = (input: z.infer) => { - let parsed - try { - parsed = schema.parse(input) - } catch (e) { - console.trace("schema validation failure stack trace:") - if (e instanceof z.ZodError) { - console.error("schema validation issues:", JSON.stringify(e.issues, null, 2)) - } - throw e - } - - return cb(parsed) - } - result.force = (input: z.infer) => cb(input) - result.schema = schema - return result -} diff --git a/packages/opencode/src/util/update-schema.ts b/packages/opencode/src/util/update-schema.ts deleted file mode 100644 index f2246ece33..0000000000 --- a/packages/opencode/src/util/update-schema.ts +++ /dev/null @@ -1,13 +0,0 @@ -import z from "zod" - -export function updateSchema(schema: z.ZodObject) { - const next = {} as { - [K in keyof T]: z.ZodOptional> - } - - for (const [k, v] of Object.entries(schema.required().shape) as [keyof T & string, z.ZodTypeAny][]) { - next[k] = v.nullable() as unknown as (typeof next)[typeof k] - } - - return z.object(next) -}