Skip to content

Remove redundant field name declarations in object protocol#159

Merged
hotlong merged 2 commits intomainfrom
copilot/fix-duplicate-name-field
Jan 25, 2026
Merged

Remove redundant field name declarations in object protocol#159
hotlong merged 2 commits intomainfrom
copilot/fix-duplicate-name-field

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 25, 2026

Field names were declared twice in the object fields protocol - once as the map key and again as a name property within the field definition.

Before:

fields: {
  account: {
    name: 'account',  // redundant
    label: 'Account',
    type: 'lookup',
    reference: 'account',
  }
}

After:

fields: {
  account: {
    label: 'Account',
    type: 'lookup',
    reference: 'account',
  }
}

Changes

  • Removed redundant name properties from field definitions in object.test.ts
  • FieldSchema.name remains optional for standalone field validation use cases

Examples and documentation already followed the correct pattern; only test assertions needed alignment.

Original prompt

object fields 协议中,name感觉写了两遍

fields: {

account: {
  name: 'account',
  label: 'Account',
  type: 'lookup',
  reference: 'account',
  required: true
},

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

@vercel
Copy link
Copy Markdown

vercel bot commented Jan 25, 2026

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

Project Deployment Review Updated (UTC)
spec Ready Ready Preview, Comment Jan 25, 2026 2:42pm

Request Review

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix duplicate name field in object fields protocol Remove redundant field name declarations in object protocol Jan 25, 2026
Copilot AI requested a review from hotlong January 25, 2026 14:37
@hotlong hotlong marked this pull request as ready for review January 25, 2026 14:48
Copilot AI review requested due to automatic review settings January 25, 2026 14:48
@hotlong hotlong merged commit ff91f77 into main Jan 25, 2026
2 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes redundant field name declarations from the object protocol test file. Field names were being specified twice: once as the map key in the fields object, and again as a name property within each field definition. Since ObjectSchema.fields uses z.record(FieldSchema) where map keys serve as field identifiers, and FieldSchema.name is already optional, the duplication was unnecessary.

Changes:

  • Removed redundant name properties from all field definitions in object.test.ts where fields are defined within an object's fields map
  • Maintained proper usage where the name property is derived from the map key (e.g., first_name, account_name, subject)

Sign up for free to 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.

3 participants