Skip to content

Commit 222a7e5

Browse files
committed
chore(changeset): add changeset for rest export route fix
1 parent 7c8d32a commit 222a7e5

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
"@objectstack/rest": patch
3+
---
4+
5+
fix(rest): register static data-action routes before the greedy `:object/:id` matcher
6+
7+
The REST router matches first-registered-wins with no specificity sorting, but
8+
`registerDataActionEndpoints` (which holds `GET /data/:object/export`) ran AFTER
9+
`registerCrudEndpoints` (which holds the greedy `GET /data/:object/:id`). A
10+
request to `GET /data/<object>/export` was therefore captured by `:object/:id`
11+
`"export"` treated as a record id — returning `404 RECORD_NOT_FOUND` instead of
12+
streaming the export. The data-action registration now runs first, mirroring the
13+
existing `/meta/:type/:name/references`-before-`/meta/:type/:name` convention.
14+
Reordering is safe both ways: `registerDataActionEndpoints` contains no greedy
15+
2-segment `:object/:id` routes, so it cannot shadow any CRUD literal. A
16+
regression test asserts the export route registers ahead of the get-by-id route.

0 commit comments

Comments
 (0)