From 2f60f9d45b7e4691f7135334ed910edb9ad069e8 Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Mon, 13 Apr 2026 22:00:41 -0400 Subject: [PATCH] refactor(question): use withStatics for answer schema Replace the ad hoc Object.assign wrapper with the shared schema helper so the Answer schema follows the same static attachment pattern as the rest of the codebase. --- packages/opencode/src/question/index.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/opencode/src/question/index.ts b/packages/opencode/src/question/index.ts index 2675736169..ba76efa640 100644 --- a/packages/opencode/src/question/index.ts +++ b/packages/opencode/src/question/index.ts @@ -5,6 +5,7 @@ import { InstanceState } from "@/effect/instance-state" import { SessionID, MessageID } from "@/session/schema" import { zod } from "@/util/effect-zod" import { Log } from "@/util/log" +import { withStatics } from "@/util/schema" import { QuestionID } from "./schema" export namespace Question { @@ -69,9 +70,10 @@ export namespace Question { static readonly zod = zod(this) } - const _Answer = Schema.Array(Schema.String).annotate({ identifier: "QuestionAnswer" }) - export const Answer = Object.assign(_Answer, { zod: zod(_Answer) }) - export type Answer = Schema.Schema.Type + export const Answer = Schema.Array(Schema.String) + .annotate({ identifier: "QuestionAnswer" }) + .pipe(withStatics((s) => ({ zod: zod(s) }))) + export type Answer = Schema.Schema.Type export class Reply extends Schema.Class("QuestionReply")({ answers: Schema.Array(Answer).annotate({