Skip to content

Commit 28985f5

Browse files
Copilothotlong
andcommitted
Add changeset for breaking change: strict validation by default
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 40d29da commit 28985f5

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
"@objectstack/spec": major
3+
---
4+
5+
**Breaking Change: Strict Validation Enabled by Default**
6+
7+
`defineStack()` now validates configurations by default to enforce naming conventions and catch errors early.
8+
9+
**What Changed:**
10+
- `defineStack()` now defaults to `strict: true` (was `strict: false`)
11+
- Field names are now validated to ensure snake_case format
12+
- Object names, field types, and all schema definitions are validated
13+
14+
**Migration Guide:**
15+
16+
If you have existing code that violates naming conventions:
17+
18+
```typescript
19+
// Before (would silently accept invalid names):
20+
defineStack({
21+
manifest: {...},
22+
objects: [{
23+
name: 'my_object',
24+
fields: {
25+
firstName: { type: 'text' } // ❌ Invalid: camelCase
26+
}
27+
}]
28+
});
29+
30+
// After (will throw validation error):
31+
// Error: Field names must be lowercase snake_case
32+
33+
// Fix: Use snake_case
34+
defineStack({
35+
manifest: {...},
36+
objects: [{
37+
name: 'my_object',
38+
fields: {
39+
first_name: { type: 'text' } // ✅ Valid: snake_case
40+
}
41+
}]
42+
});
43+
```
44+
45+
**Temporary Workaround:**
46+
47+
If you need to temporarily disable validation while fixing your code:
48+
49+
```typescript
50+
defineStack(config, { strict: false }); // Bypass validation
51+
```
52+
53+
**Why This Change:**
54+
55+
1. **Catches Errors Early**: Invalid field names caught during development, not runtime
56+
2. **Enforces Conventions**: Ensures consistent snake_case naming across all projects
57+
3. **Prevents AI Hallucinations**: AI-generated objects must follow proper conventions
58+
4. **Database Compatibility**: snake_case prevents case-sensitivity issues in queries
59+
60+
**Impact:**
61+
62+
- Projects with properly named fields (snake_case): ✅ No changes needed
63+
- Projects with camelCase/PascalCase fields: ⚠️ Must update field names or use `strict: false`

0 commit comments

Comments
 (0)