Commit 7c8d32a
committed
fix(rest): register static data-action routes before greedy :object/:id
The REST router (RouteManager → IHttpServer/Express adapter) matches
first-registered-wins with no specificity sorting. registerDataActionEndpoints
(which holds GET /data/:object/export) ran AFTER registerCrudEndpoints (which
holds the greedy GET /data/:object/:id), so a request to
`GET /data/<object>/export` was captured by `:object/:id` — "export" treated as
a record id — returning 404 RECORD_NOT_FOUND instead of streaming the export.
Reorder so the static-literal action routes register before the greedy
:object/:id matcher, mirroring the existing /meta/:type/:name/references-before
-/meta/:type/:name convention. The reorder is safe in both directions:
registerDataActionEndpoints has no greedy 2-segment :object/:id routes, and the
only per-method collision in the data namespace is GET export vs GET :id.
Add a regression test asserting the export route's registration index precedes
the get-by-id route's.1 parent 4845c12 commit 7c8d32a
2 files changed
Lines changed: 36 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1552 | 1552 | | |
1553 | 1553 | | |
1554 | 1554 | | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
1555 | 1568 | | |
1556 | 1569 | | |
1557 | 1570 | | |
1558 | | - | |
1559 | 1571 | | |
1560 | 1572 | | |
1561 | 1573 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
904 | 904 | | |
905 | 905 | | |
906 | 906 | | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
907 | 930 | | |
908 | 931 | | |
909 | 932 | | |
| |||
0 commit comments