Skip to content

Commit c483a00

Browse files
committed
test(runtime): the dispatcher's POST body fields: [] is refused at the schema
The canonical `fields` of a POST /data/:object/query body, top level and on an `expand` entry, is now the QueryAST's own projection, which takes the shared array arm, so the dispatcher answers `400 VALIDATION_FAILED` at `query.fields` (as its `$select` alias does) instead of the normalizer's `VALIDATION_ERROR`. The row moves to the schema table, with the blank member and the `expand` entry beside it, as the REST door's pin does. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfMG4xAptDoRoz9kyT
1 parent a1b4b04 commit c483a00

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎packages/runtime/src/domains/data-empty-projection-count.test.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ describe('[#26644] the dispatcher /data doors — an empty projection and an unr
112112
['GET list ?$select=, (the card)', 'GET', '/data/inquiry', { $select: ',' }, undefined, '$select', 'names no field'],
113113
['GET list ?select= (the card)', 'GET', '/data/inquiry', { select: '' }, undefined, 'select', 'names no field'],
114114
['GET list ?$count=maybe (the card)', 'GET', '/data/inquiry', { $top: '2', $count: 'maybe' }, undefined, '$count', 'must be true or false'],
115-
['POST query {"fields":[]}', 'POST', '/data/inquiry/query', {}, { fields: [] }, 'fields', 'names no field'],
116115
['GET by id ?select=', 'GET', '/data/inquiry/r1', { select: '' }, undefined, 'select', 'names no field'],
117116
['GET by id ?select=,', 'GET', '/data/inquiry/r1', { select: ',' }, undefined, 'select', 'names no field'],
118117
])('%s: 400 VALIDATION_ERROR naming the spelling — no read', async (_name, method, path, query, body, param, sentence) => {
@@ -131,12 +130,18 @@ describe('[#26644] the dispatcher /data doors — an empty projection and an unr
131130
// naming no field is refused where every other malformed body is: at the
132131
// schema, `400 VALIDATION_FAILED` naming `query.<key>`, and the member for
133132
// a blank name (the #25269 precedent for the page window). Still a 400,
134-
// still before any read.
133+
// still before any read. [#27166] The canonical `fields` (top level and
134+
// on an `expand` entry) is the QueryAST's own projection, which now takes
135+
// the same array arm, so a body naming no field there is refused at the
136+
// schema too, as its `$select` alias is.
135137
it.each<[string, Record<string, unknown>, string]>([
136138
['{"select":""}', { select: '' }, 'query.select'],
137139
['{"$select":","}', { $select: ',' }, 'query.$select'],
138140
['{"select":[]}', { select: [] }, 'query.select'],
139141
['{"select":["name",""]} (the blank member)', { select: ['name', ''] }, 'query.select.1'],
142+
['{"fields":[]}', { fields: [] }, 'query.fields'],
143+
['{"fields":["name",""]} (the blank member)', { fields: ['name', ''] }, 'query.fields.1'],
144+
['{"expand":{"owner":{"fields":[]}}}', { expand: { owner: { object: 'sys_user', fields: [] } } }, 'query.expand.owner.fields'],
140145
])('POST query %s: 400 VALIDATION_FAILED naming the body key at the schema — no read', async (_name, body, field) => {
141146
const before = reads.n;
142147

0 commit comments

Comments
 (0)