Skip to content

Commit 0c97527

Browse files
authored
Merge pull request #18 from objectql/copilot/update-documentation-for-data-specs
Simplify metadata specification using filename-based identification
2 parents 1a3bff0 + 0f63234 commit 0c97527

309 files changed

Lines changed: 1232 additions & 2749 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ It is **not** an ORM, but a high-level data protocol designed for AI agents, low
4141
* Template messages with internationalization support.
4242

4343

44+
* **📝 Clean, Minimal Syntax:**
45+
* **Filename-based identification** - No redundant `name` properties needed
46+
* Object name automatically inferred from `project.object.yml``project`
47+
* 10-15% less boilerplate compared to traditional metadata formats
48+
* Crystal-clear file organization and conventions
49+
50+
4451
* **⚡ Modern & Lightweight:**
4552
* Written in 100% **TypeScript**.
4653
* **Zero heavy legacy dependencies.** No runtime environment requirements beyond Node.js.
@@ -289,7 +296,9 @@ ObjectQL includes a comprehensive **visual reporting system** similar to Salesfo
289296

290297
**Example Report Definition:**
291298
```yaml
292-
name: tasks_by_project
299+
# File: tasks_by_project.report.yml
300+
# Report name is inferred from filename!
301+
293302
label: Tasks by Project and Priority
294303
type: summary
295304
object: tasks

docs/guide/data-modeling.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ Data modeling in ObjectQL is **Metadata-First**. You define your application's s
44

55
## 1. The Object Definition
66

7-
Each file represents one business entity. By convention, name the file `[object_name].object.yml`.
7+
**ObjectQL uses filename-based identification.** The object name is automatically inferred from the filename (without the `.object.yml` extension), eliminating redundancy.
8+
9+
**File naming:** `<object_name>.object.yml`
810

911
```yaml
10-
# objects/product.object.yml
11-
name: product
12+
# File: product.object.yml
13+
# Object name "product" is automatically inferred from filename!
14+
1215
label: Product
1316
description: "Catalog items for sale"
1417
icon: standard:product
@@ -32,6 +35,8 @@ fields:
3235
- clothing
3336
```
3437
38+
**Note:** The redundant `name: product` property is no longer needed - it's automatically inferred from the filename!
39+
3540
## 2. Fields & Relationships
3641

3742
ObjectQL supports rich field types that automate UI rendering and validation.

docs/guide/getting-started.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@ Let's build a simple **To-Do List** backend.
2626

2727
In ObjectQL, everything is an "Object" (like a Table or Collection).
2828

29+
**ObjectQL uses filename-based identification** - the object name is automatically inferred from the filename, making your metadata files cleaner.
30+
2931
```yaml
30-
# todo.object.yml
31-
name: todo
32+
# File: todo.object.yml
33+
# Object name "todo" is automatically inferred from filename!
34+
3235
label: To-Do Item
3336
fields:
3437
title:
@@ -39,6 +42,8 @@ fields:
3942
default: false
4043
```
4144
45+
**Note:** You no longer need to specify `name: todo` - it's inferred from the filename `todo.object.yml`!
46+
4247
### 2. Configure the Engine
4348

4449
Updated in v0.2: You can now use a simple connection string.

docs/guide/metadata-organization.md

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,41 @@ Each module should have a README explaining:
107107

108108
## Object Naming Conventions
109109

110-
### Prefixing Strategy
110+
### File-Based Naming
111+
112+
**ObjectQL uses filename-based identification.** The object name is automatically inferred from the filename (without the `.object.yml` extension), eliminating redundancy.
111113

112-
For large projects with multiple modules, use prefixes to avoid name collisions:
114+
**Examples:**
115+
- `crm_account.object.yml` → Object name: `crm_account`
116+
- `finance_invoice.object.yml` → Object name: `finance_invoice`
117+
- `project_task.object.yml` → Object name: `project_task`
118+
119+
Inside the file, you **no longer need** to specify `name: crm_account` - it's inferred from the filename!
113120

114121
```yaml
115-
# ✅ Good: Clear module ownership
116-
name: crm_account
117-
name: finance_invoice
118-
name: project_task
122+
# File: crm_account.object.yml
123+
# Object name "crm_account" is automatically inferred!
124+
125+
label: CRM Account
126+
fields:
127+
company_name:
128+
type: text
129+
required: true
130+
```
131+
132+
### Prefixing Strategy
133+
134+
For large projects with multiple modules, use prefixes in your **filenames** to avoid name collisions:
135+
136+
```
137+
# ✅ Good: Clear module ownership via filenames
138+
crm/objects/crm_account.object.yml → Object: crm_account
139+
finance/objects/finance_invoice.object.yml → Object: finance_invoice
140+
project/objects/project_task.object.yml → Object: project_task
119141

120142
# ❌ Avoid: Risk of collision
121-
name: account # Which account? CRM or Finance?
122-
name: task # Project task or general task?
143+
crm/objects/account.object.yml → Object: account (ambiguous)
144+
finance/objects/account.object.yml → Object: account (collision!)
123145
```
124146
125147
**When to prefix:**
@@ -128,7 +150,7 @@ name: task # Project task or general task?
128150
- ✅ When similar concepts exist across domains
129151
130152
**When NOT to prefix:**
131-
- ❌ Core shared objects (`user`, `organization`)
153+
- ❌ Core shared objects (`user.object.yml`, `organization.object.yml`)
132154
- ❌ Small applications (< 30 objects)
133155
- ❌ When it reduces clarity
134156

@@ -198,19 +220,23 @@ fields:
198220

199221
## Extension Pattern
200222

201-
Use extensions to customize objects without modifying source:
223+
Use extensions to customize objects without modifying source files.
202224

203225
**Original** (`core/objects/user.object.yml`):
204226
```yaml
205-
name: user
227+
# File: user.object.yml
228+
# Object name "user" is inferred from filename
229+
206230
fields:
207231
name: { type: text }
208232
email: { type: text }
209233
```
210234
211235
**Extension** (`extensions/user.extension.object.yml`):
212236
```yaml
213-
name: user # Same name triggers merge
237+
# File: user.extension.object.yml
238+
# Extends the "user" object (matches by filename base)
239+
214240
fields:
215241
employee_id: { type: text }
216242
email: { required: true, unique: true }

docs/spec/action.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,17 @@ Input parameters (`params`) are defined using the same `FieldConfig` schema as o
1919

2020
## 2. Configuration (YAML)
2121

22-
Actions are declared in `*.object.yml` or JSON.
22+
Actions are declared in your object definition file (`<object_name>.object.yml`).
2323

2424
```yaml
25+
# File: order.object.yml
26+
# Object name is inferred from filename!
27+
28+
label: Order
29+
fields:
30+
# ... field definitions
31+
32+
# Custom Actions
2533
actions:
2634
# 1. A Record Action (Button on a row)
2735
approve_order:
@@ -48,10 +56,18 @@ actions:
4856
4957
## 3. Implementation (TypeScript)
5058
51-
Implement the logic in a companion `*.action.ts` file.
59+
Implement the logic in a companion `<object_name>.action.ts` file.
60+
61+
**File Naming Convention:** `<object_name>.action.ts`
62+
63+
The filename (without `.action.ts`) must match your object name to enable automatic binding.
64+
65+
**Examples:**
66+
- `order.action.ts` → Actions for `order` object
67+
- `project.action.ts` → Actions for `project` object
5268

5369
```typescript
54-
// src/objects/order.action.ts
70+
// File: order.action.ts
5571
import { ActionDefinition } from '@objectql/types';
5672
import { Order } from './types';
5773

0 commit comments

Comments
 (0)