Skip to content

Enhance FormSectionSchema with type-safe column constraints - #84

Closed
hotlong with Copilot wants to merge 3 commits into
mainfrom
copilot/enhance-form-layout-schema
Closed

Enhance FormSectionSchema with type-safe column constraints#84
hotlong with Copilot wants to merge 3 commits into
mainfrom
copilot/enhance-form-layout-schema

Conversation

CopilotAI commented Jan 23, 2026

Copy link
Copy Markdown
Contributor

Improves form layout flexibility by adding title field and replacing string-based column enumeration with numeric constraints.

Changes

  • FormSectionSchema (view.zod.ts)

    • Add title: z.string().optional() for section headers
    • Replace columns: z.enum(['1', '2', '3', '4']).transform() with z.number().min(1).max(4).default(2)
    • Mark label as legacy in favor of title
    • Remove redundant .optional() on collapsible (default value implies optional)
  • Tests (view.test.ts)

    • Update column values from strings to numbers
    • Add test coverage for title field and column boundary validation

Example

// Before: string-based enum with runtime transformconstsection={label: 'Contact Info',columns: '2',// stringfields: ['name','email']}// After: type-safe numeric validationconstsection={title: 'Contact Info',// semantic namingcolumns: 2,// number with min(1).max(4)fields: ['name','email']}

Backward compatible - existing schemas using label and numeric columns continue to work.

Original prompt
  1. 表单布局引擎 (优先级: 低)

// 增强 view.zod.ts
FormLayoutSchema.extend({
sections: z.array(z.object({
title: z.string(),
columns: z.number().min(1).max(4),
fields: z.array(z.string()),
collapsible: z.boolean().optional(),
})),
});
影响: 更灵活的表单设计


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel

vercelBot commented Jan 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentReviewUpdated (UTC)
specReadyReadyPreview, CommentJan 23, 2026 9:42am

Request Review

CopilotAIand others added 2 commits January 23, 2026 09:39
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
CopilotAI changed the title [WIP] Enhance FormLayoutSchema with sections fieldEnhance FormSectionSchema with type-safe column constraintsJan 23, 2026
CopilotAI requested a review from hotlongJanuary 23, 2026 09:42
@hotlonghotlong closed this Jan 23, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@hotlong