You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 41e605e
Browse filesBrowse the repository at this point in the historyBrowse files
feat(runtime): apply the endpoint mapping keys in the execution chain (#5137) (#5167)
`inputMapping` / `outputMapping` were declared by `ApiEndpointSchema` and read
by nothing: an author could write them, publish would accept them, and the
endpoint ran as if they were absent — the "parsed, then nothing happens" middle
state #5040 exists to end, and the ADR-0049 `declared != enforced` shape.
New pure module `packages/runtime/src/api-mapping.ts` is their single reader.
Semantics come from the frozen vocabulary's describe text and nothing else,
taken in its minimal faithful reading:
- `inputMapping` ("Map Request Body to Internal Params") projects the request
BODY by dot path, applied after the policy pass and before delegation, so a
mapping can never buy a caller past `authRequired` / `rateLimit` and
`endpoint-executor.ts` stays a pure delegator. Query params are deliberately
NOT merged in — the vocabulary names the body, and merging would invent an
unstated precedence rule.
- `outputMapping` ("Map Internal Result to Response Body") projects the SUCCESS
payload only, preserving the envelope; an error answer is never remapped, so
a declaration cannot disguise a failure as data.
- A mapping is a projection, not a merge: undeclared fields do not ride along,
which makes the outbound side an allow-list.
- Absent source => unset target; absent (or empty) key => byte-for-byte
passthrough, by reference.
- A declaration this runtime cannot serve is refused with a structured 501
NOT_IMPLEMENTED naming the entry — `transform` (no transformation-function
registry exists), an unusable path (empty, empty segment, prototype key), or
colliding targets. `outputMapping` is judged BEFORE delegation so a broken
projection cannot let a `create` insert its record and then fail to answer.
`api-mapping.ts` joins the error-envelope conformance scan. Zero live behavior
change: a non-empty `apis:` is still rejected at publish until the E7 flip.
Part of #5040 (E5c).
Claude-Session: https://claude.ai/code/session_01EYGdmvWP1ieZSLqvAW6uyd
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments