-
Notifications
You must be signed in to change notification settings - Fork 0
Fix ObjectStack spec v0.6.1 protocol compliance - naming conventions #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Fixed Contract.ContractNumber field type: 'autonumber' → 'autoNumber' - Added comprehensive protocol compliance documentation - Created automated validation script for future use - All 8 objects (248 fields, 18 relationships) now fully compliant Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
|
@copilot 我记得协议约定的这段名必须要小写 |
您说得对!根据 @objectstack/spec 协议规范,对象的 我会立即修正所有 8 个对象的 name 属性:
正在修复中... |
|
@copilot 是不是字段名也有类似的约定? |
- Changed all object 'name' properties from PascalCase to lowercase - Updated validation script to enforce lowercase/snake_case for object names - Updated PROTOCOL_COMPLIANCE.md with correct naming conventions - Objects: account, activity, contact, lead, opportunity, contract, quote, case Per @objectstack/spec protocol: machine names (object.name) use snake_case, while field API names use PascalCase. Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
是的!字段名(Field API Name)也有明确的约定: 字段名必须使用 PascalCase(首字母大写的驼峰命名) 示例:
命名规范总结:
当前代码库中所有 248 个字段都已经正确使用 PascalCase 命名,无需修改。✅ |
- Object names use snake_case (not PascalCase) - Field names use PascalCase - Updated example from 'Product' to 'product' - Clarified naming conventions in best practices section Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
There was a problem hiding this 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 pull request fixes ObjectStack spec v0.6.1 protocol compliance violations in object metadata. The primary changes correct naming conventions (object names from PascalCase to lowercase/snake_case, field type from autonumber to autoNumber) and add validation infrastructure.
Changes:
- Fixed all 8 object metadata files to use lowercase/snake_case for object names (e.g.,
Account→account) - Corrected field type casing in contract.object.ts (
autonumber→autoNumber) - Added automated protocol validation script with comprehensive checks
- Created detailed protocol compliance documentation and updated agent guidelines
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/validate-protocol.js | New automated validator for protocol compliance checking |
| packages/crm/src/account.object.ts | Changed object name from 'Account' to 'account' |
| packages/crm/src/activity.object.ts | Changed object name from 'Activity' to 'activity' |
| packages/crm/src/contact.object.ts | Changed object name from 'Contact' to 'contact' |
| packages/crm/src/lead.object.ts | Changed object name from 'Lead' to 'lead' |
| packages/crm/src/opportunity.object.ts | Changed object name from 'Opportunity' to 'opportunity' |
| packages/finance/src/contract.object.ts | Changed object name to 'contract' and fixed field type to 'autoNumber' |
| packages/products/src/quote.object.ts | Changed object name from 'Quote' to 'quote' |
| packages/support/src/case.object.ts | Changed object name from 'Case' to 'case' |
| PROTOCOL_COMPLIANCE.md | New comprehensive protocol compliance documentation |
| README.md | Added reference to protocol compliance documentation |
| .github/agents/metadata-developer.md | Updated with correct naming conventions and examples |
| return; | ||
| } | ||
|
|
||
| const fieldMatch = line.match(/^\s{4}([A-Za-z][A-Za-z0-9_]*):\s*\{/); |
Copilot
AI
Jan 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The field matching regex uses exactly 4 spaces (^\s{4}), but the actual code uses 2-space indentation. This will cause the regex to fail matching field names in the actual object files. The regex should be more flexible to match the actual indentation, such as ^\s{2}([A-Za-z][A-Za-z0-9_]*):\s*\{ for 2-space indentation, or better yet, use a more flexible pattern like ^\s+([A-Za-z][A-Za-z0-9_]*):\s*\{ to handle any amount of indentation.
| const fieldMatch = line.match(/^\s{4}([A-Za-z][A-Za-z0-9_]*):\s*\{/); | |
| const fieldMatch = line.match(/^\s+([A-Za-z][A-Za-z0-9_]*):\s*\{/); |
| - ✅ `BillingStreet` | ||
| - ✅ `IsDecisionMaker` | ||
|
|
||
| ### 2. Field Type Specification |
Copilot
AI
Jan 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both "Field Naming Convention" (line 36) and "Field Type Specification" (line 52) are numbered as section "### 2.". The Field Type Specification section should be numbered "### 3." to maintain correct sequential numbering.
| ### 2. Field Type Specification | |
| ### 3. Field Type Specification |
| 2. **Field Types:** | ||
| - Use `autoNumber` not `autonumber` | ||
| - Use `select` not `picklist` | ||
| - Use `lookup` not `reference` | ||
|
|
||
| 3. **Object Properties:** |
Copilot
AI
Jan 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both "Field Names" (line 184) and "Field Types" (line 189) are numbered as section "2.". The Field Types section should be numbered "3." to maintain correct sequential numbering.
| 2. **Field Types:** | |
| - Use `autoNumber` not `autonumber` | |
| - Use `select` not `picklist` | |
| - Use `lookup` not `reference` | |
| 3. **Object Properties:** | |
| 3. **Field Types:** | |
| - Use `autoNumber` not `autonumber` | |
| - Use `select` not `picklist` | |
| - Use `lookup` not `reference` | |
| 4. **Object Properties:** |
| 3. **Object Properties:** | ||
| - Always include `name`, `label`, `icon`, and `description` | ||
| - Define `fields` object with all field metadata | ||
| - Include `listViews` for common queries | ||
| - Add `validationRules` for business logic | ||
|
|
||
| 4. **Relationships:** |
Copilot
AI
Jan 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both "Object Properties" (line 194) and "Relationships" (line 200) are numbered as sections "3." and "4." respectively, but they should be "4." and "5." to maintain correct sequential numbering given the duplicate "2." earlier in the document.
| 3. **Object Properties:** | |
| - Always include `name`, `label`, `icon`, and `description` | |
| - Define `fields` object with all field metadata | |
| - Include `listViews` for common queries | |
| - Add `validationRules` for business logic | |
| 4. **Relationships:** | |
| 4. **Object Properties:** | |
| - Always include `name`, `label`, `icon`, and `description` | |
| - Define `fields` object with all field metadata | |
| - Include `listViews` for common queries | |
| - Add `validationRules` for business logic | |
| 5. **Relationships:** |
Description
Protocol audit revealed multiple naming convention violations in object metadata. Fixed field type casing (
autonumbervsautoNumber) and corrected all object machine names to use lowercase/snake_case as required by @objectstack/spec v0.6.1 protocol. Added validation tooling to prevent future violations. Updated agent documentation to reflect correct naming conventions.Type of Change
Related Issues
N/A - Internal protocol compliance audit
Changes Made
Code Fixes:
packages/finance/src/contract.object.ts: Changedtype: 'autonumber'→type: 'autoNumber'(camelCase required by spec)nameproperty from PascalCase to lowercase/snake_case:Account→accountActivity→activityContact→contactLead→leadOpportunity→opportunityContract→contractQuote→quoteCase→caseValidation Infrastructure:
scripts/validate-protocol.js: Automated validator for object names (lowercase/snake_case), field names (PascalCase), field types, and object structureDocumentation:
PROTOCOL_COMPLIANCE.md: Protocol requirements reference with corrected naming conventions, field type catalog, best practicesREADME.md: Added compliance status reference.github/agents/metadata-developer.md: Updated with correct naming conventions (object names: snake_case, field names: PascalCase), corrected Product example, and clarified best practices sectionValidation Results:
Testing
npm test)npm run lint)npm run build)Validation script executed:
node scripts/validate-protocol.js # ✅ ALL OBJECTS COMPLIANT WITH @objectstack/spec v0.6.1Screenshots
N/A - Metadata changes only
Checklist
Additional Notes
Naming Convention Rules (per @objectstack/spec v0.6.1):
snake_case- e.g.,name: 'account',name: 'project_task'PascalCase- e.g.,FirstName,AccountId,AnnualRevenuecamelCase- e.g.,autoNumbernotautonumbercamelCase- e.g.,trackHistory,apiEnabledCommon Mistakes Fixed:
name: 'Account'→ ✅name: 'account'type: 'autonumber'→ ✅type: 'autoNumber'Q&A from Review:
FirstName,AccountId,AnnualRevenue). All 248 fields in the codebase already follow this convention correctly.Run validation before metadata commits:
node scripts/validate-protocol.jsOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.