Skip to content

Commit 8012d0c

Browse files
committed
docs(objectql): query-syntax §9 states the all-unknown projection refusal, not the retired every-column fallback
An unknown plain column is dropped only while one requested column is known; a projection whose every entry is unknown is refused by find() / findOne() with 400 VALIDATION_ERROR, the fields: [] refusal; expand sub-reads always name id; the REST ingress answers 400 INVALID_FIELD. Claude-Session: https://claude.ai/code/session_01QSeKYp3oFeDem8Tbh8pzWA Co-authored-by: Claude <noreply@anthropic.com>
1 parent 72b08ee commit 8012d0c

1 file changed

Lines changed: 20 additions & 10 deletions

File tree

‎content/docs/protocol/objectql/query-syntax.mdx‎

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,26 +1484,36 @@ const sorted = monthlyRevenue.sort((a, b) =>
14841484

14851485
## 9. Error Handling
14861486

1487-
### Unknown Fields Are Tolerated
1487+
### Unknown Projection Fields
14881488

1489-
Unknown field **names** are not rejected by `engine.find()` — a projected field that
1490-
doesn't exist on the object is **silently dropped** (matching OData / `SELECT *`
1491-
tolerance), so a stale field reference never fails the whole query:
1489+
On a registered object, `engine.find()` and `findOne()` drop an unknown plain column from
1490+
`fields` **only while at least one requested column is known**: the unknown name is
1491+
silently omitted from each row, so a stale field reference in a mixed projection does
1492+
not fail the whole query. `id`, `created_at` and `updated_at` always count as known.
14921493

14931494
```typescript
14941495
const rows = await engine.find('customer', {
14951496
fields: ['name', 'nonexistent'], // `nonexistent` is not on the schema
14961497
});
14971498
// Returns each row with `name`; `nonexistent` is omitted — no error thrown.
1499+
1500+
await engine.find('customer', { fields: ['nonexistent'] });
1501+
// Throws 400 VALIDATION_ERROR: no requested column is a field of 'customer'.
14981502
```
14991503

1504+
A projection whose **every** entry is unknown is refused: `find()` / `findOne()` throw
1505+
`400 VALIDATION_ERROR` naming the requested columns, before any driver is asked. It is
1506+
the same refusal `fields: []` gets, because a projection the tolerance empties is an
1507+
empty projection, and an empty projection is never read as every column.
1508+
15001509
<Callout type="info">
1501-
This tolerance does **not** extend to the REST/protocol ingress: a `select` / `fields`
1502-
naming a column the object does not have is `400 INVALID_FIELD` there, because dropping
1503-
it silently answered a *narrower* projection with a *wider* one — a projection left with
1504-
no known field falls all the way back to every field. The engine's tolerance guards
1505-
internal callers (hooks, flows, expand sub-reads, registry-less hosts) that never pass
1506-
through that ingress.
1510+
`expand` sub-reads are unaffected: the engine always adds `id` to a sub-read's
1511+
projection (and strips it from the expanded record when you did not ask for it), so a
1512+
sub-read never reaches the all-unknown refusal.
1513+
1514+
The REST/protocol ingress tolerates no unknown name at all: a `select` / `fields`
1515+
naming any column the object does not have, alone or next to known ones, is
1516+
`400 INVALID_FIELD` there.
15071517
</Callout>
15081518

15091519
### Security Violations

0 commit comments

Comments
 (0)