Skip to content

Commit b2cbeb1

Browse files
fix: reuse shared conditionsSchema for discussion conditions
Use z.lazy(() => conditionsSchema) instead of duplicating the array schema inline, ensuring discussion conditions get the same altTemplateContext support and error messages as element conditions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d9314d9 commit b2cbeb1

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

server/src/preFlight/validateTreatmentFile.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -283,16 +283,7 @@ export const discussionSchema = z
283283
// New: allow discussion-level position-based visibility controls
284284
showToPositions: showToPositionsSchema.optional(),
285285
hideFromPositions: hideFromPositionsSchema.optional(),
286-
conditions: z
287-
.array(
288-
z.lazy(() => conditionSchema),
289-
{
290-
invalid_type_error:
291-
"Expected an array for `conditions`. Make sure each item starts with a dash (`-`) in YAML.",
292-
}
293-
)
294-
.nonempty()
295-
.optional(),
286+
conditions: z.lazy(() => conditionsSchema).optional(),
296287
})
297288
.strict()
298289
.superRefine((data, ctx) => {

0 commit comments

Comments
 (0)