Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions content/docs/getting-started/core-concepts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ When a business requirement changes, you must update code in **three or four pla

ObjectStack centralizes the "Intent" into a **single Protocol Definition**:

<Tabs items={['Array Format', 'Map Format']}>
<Tab value="Array Format">
```typescript
// ONE definition — everything else derives from it
import { defineStack } from '@objectstack/spec';
Expand All @@ -42,6 +44,29 @@ export default defineStack({
}],
});
```
</Tab>
<Tab value="Map Format">
```typescript
// Map keys become the `name` field automatically
import { defineStack } from '@objectstack/spec';

export default defineStack({
objects: {
user: {
label: 'User',
fields: {
phone: { label: 'Phone Number', type: 'phone', required: true },
},
},
},
});
```
</Tab>
</Tabs>

<Callout type="info">
**Array or Map?** `defineStack()` accepts both formats for all named metadata collections (`objects`, `apps`, `flows`, etc.). Map keys are injected as the `name` field — pick whichever style you prefer.
</Callout>
Comment on lines +67 to +69

Copilot AI Feb 15, 2026

Copy link

Choose a reason for hiding this comment

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

This callout states that map/array formats apply to "all named metadata collections (objects, apps, flows, etc.)", which is correct. However, it's important to clarify that the fields property within objects ONLY accepts map format (Record), never array format. The existing "Array Format" tab above (lines 41-42) incorrectly shows fields as an array, which contradicts the ObjectSchema definition where fields is defined as z.record(z.string().regex(...), FieldSchema). This should be corrected to avoid misleading developers into thinking fields can be either format.

Copilot uses AI. Check for mistakes.

From this single definition, ObjectStack automatically:

Expand Down
1 change: 1 addition & 0 deletions content/docs/guides/cheatsheets/backward-compatibility.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ObjectStack follows [Semantic Versioning 2.0.0](https://semver.org/) (`MAJOR.MIN
- **Zod schemas** are part of the public API surface. Adding optional properties is a MINOR change; removing or renaming properties is a MAJOR change.
- **TypeScript types** inferred from Zod (`z.infer<typeof Schema>`) follow the same guarantees as their source schemas.
- **Helper functions** (e.g., `defineStack`, `defineStudioPlugin`) maintain their call signatures within a MAJOR version.
- **Input formats** — `defineStack()` accepts both array and map (Record) format for all named metadata collections. Both formats are guaranteed stable within a MAJOR version.
- **Enum values** are append-only within a MAJOR version. Existing values are never removed or renamed in MINOR/PATCH releases.
- **Default values** in schemas are not changed in MINOR/PATCH releases unless fixing a documented bug.

Expand Down
2 changes: 1 addition & 1 deletion content/docs/guides/cheatsheets/protocol-diagram.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ flowchart LR

| Stage | Description |
|:---|:---|
| `defineStack()` | Developer declares objects, fields, views in `objectstack.config.ts` |
| `defineStack()` | Developer declares objects, fields, views in `objectstack.config.ts` (array or map format) |
| Manifest | Compiled configuration package with all metadata |
| Schema Registry | In-memory registry of all object and field definitions |
| JSON Schema | Generated JSON Schema files for IDE validation |
Expand Down
58 changes: 58 additions & 0 deletions content/docs/guides/common-patterns.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ This guide covers the most common patterns you will use when building applicatio

Define a basic object with common fields for create, read, update, and delete operations.

<Tabs items={['Array Format', 'Map Format']}>
<Tab value="Array Format">
```typescript
import { defineStack } from '@objectstack/spec';

Expand All @@ -42,6 +44,34 @@ export default defineStack({
]
});
```
</Tab>
<Tab value="Map Format">
```typescript
import { defineStack } from '@objectstack/spec';

export default defineStack({
objects: {
project: {
label: 'Project',
fields: {
title: { label: 'Title', type: 'text', required: true, maxLength: 200 },
description: { label: 'Description', type: 'textarea' },
status: { label: 'Status', type: 'select', options: [
{ label: 'Planning', value: 'planning', default: true },
{ label: 'Active', value: 'active' },
{ label: 'Complete', value: 'complete' },
{ label: 'Archived', value: 'archived' }
]},
owner: { label: 'Owner', type: 'lookup', reference: 'user' },
due_date: { label: 'Due Date', type: 'date' },
budget: { label: 'Budget', type: 'currency', currencyConfig: { precision: 2, defaultCurrency: 'USD' } },
},
Comment on lines +56 to +68

Copilot AI Feb 15, 2026

Copy link

Choose a reason for hiding this comment

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

The Map Format tab correctly shows fields as a Record/map (lines 56-68). However, the Array Format tab above (lines 30-42, not in the changed region) incorrectly shows fields as an array, which is invalid according to ObjectSchema where fields is defined as z.record(z.string().regex(...), FieldSchema). This creates confusion by implying fields can be either format. The Array Format example should be corrected to also use map syntax for fields - only the top-level objects should differ between the two tabs.

Copilot uses AI. Check for mistakes.
},
},
});
```
</Tab>
</Tabs>

---

Expand Down Expand Up @@ -403,6 +433,8 @@ Restrict field visibility and editability based on user profiles.

Combine these patterns into a complete `defineStack()` configuration:

<Tabs items={['Array Format', 'Map Format']}>
<Tab value="Array Format">
```typescript
import { defineStack } from '@objectstack/spec';

Expand All @@ -429,6 +461,32 @@ export default defineStack({
]
});
```
</Tab>
<Tab value="Map Format">
```typescript
import { defineStack } from '@objectstack/spec';

export default defineStack({
objects: {
// Pattern 1: CRUD objects
project: { label: 'Project', fields: {/* ... */} },
// Pattern 2: Master-detail
task: { label: 'Task', fields: {/* ... */} },
Comment on lines +472 to +474

Copilot AI Feb 15, 2026

Copy link

Choose a reason for hiding this comment

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

Good - the Map Format tab correctly shows fields: {/* ... */} (map syntax) as placeholders on lines 472 and 474. However, the Array Format tab above (lines 444, 446) shows fields: [/* ... */] which implies fields can be an array. This is incorrect - according to ObjectSchema, fields must always be a map/Record. The Array Format examples should also use fields: {/* ... */} placeholders.

Copilot uses AI. Check for mistakes.
},
apps: {
// Pattern 5: Navigation
},
flows: {
// Pattern 6: Automations
// Pattern 7: Approval workflows
},
agents: {
// Pattern 8: AI agents
},
});
```
</Tab>
</Tabs>

<Callout type="tip">
**Next Steps:**
Expand Down
2 changes: 1 addition & 1 deletion content/docs/guides/data-flow.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ sequenceDiagram

| Stage | What Happens |
|:---|:---|
| `defineStack()` | Developer declares objects, fields, views, flows in TypeScript |
| `defineStack()` | Developer declares objects, fields, views, flows in TypeScript (array or map format) |
| Compile | CLI validates all definitions against Zod schemas |
| Manifest | Compiled metadata package containing all configuration |
| Kernel Boot | Kernel loads the manifest and initializes the plugin graph |
Expand Down
9 changes: 8 additions & 1 deletion content/docs/guides/troubleshooting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,20 @@ Common mistakes:

**Fix:**
```typescript
// Ensure the object is included in the stack
// Ensure the object is included in the stack (array format)
export default defineStack({
objects: [
{ name: 'project_task', /* ... */ }
]
});

// Or use map format (key becomes the name)
export default defineStack({
objects: {
project_task: { /* ... */ }
}
});

// Use the exact same name when querying
client.records.find('project_task', { /* query */ });
```
Expand Down