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 ce5ba87
Browse filesBrowse the repository at this point in the historyBrowse files
docs: the REST Automation guide and the references, in lockstep with the Python pack
The documentation site gains docs/guides/rest-automation.md - the narrative of rest.yaml in
the pack: turning it on, the file as the router, the function behind an entry with the
AsyncHttpRequest accessors and the reply rules, what the edge does, the authentication
function and the session map, streaming entries, the bounded upload, the static-content
block, the default entries and the precedence, what a pack refuses and defers, the shipped
examples and how to test an entry. The HTTP Surface Reference gains the entries' behaviour,
the Configuration Reference the seven keys, the AI Agent Guide a pre-write checklist with a
minimal entry and function and a DO/DON'T row, the index and llms.txt their entries, the nav
the page, the configuration guide's static-content note the rest.yaml block. The twin of the
Python pack's guide of the same day, section for section, in the Node idiom; every claim
checked against the sources. CHANGELOG and the memory follow.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|`show.application.properties`| opt-in list of configuration keys shown by `/env`| (empty) |
34
34
|`mandatory.health.dependencies`| routes of health check functions that decide `/health`| (empty) |
35
35
|`optional.health.dependencies`| health check routes reported but never affecting status | (empty) |
36
+
|`rest.automation`| REST automation on: the entries of `rest.yaml` served in front of the functions ([guide](rest-automation.md)) |`false`|
37
+
|`yaml.rest.automation`| the one location of `rest.yaml`: `classpath:` the resources folder, `file:` an absolute path, a relative path under the application file's folder |`classpath:/rest.yaml`|
38
+
|`rest.upload.max.bytes`| the bound on the files of one upload entry, together (413 beyond it) |`16777216`|
39
+
|`http.trace.id.header`| the trace-id header a traced entry reads when no W3C `traceparent` arrives (`trace.id.header` overrides it per entry) |`X-Trace-Id`|
40
+
|`http.correlation.id.header`| the business correlation-id header, always ensured and echoed (`correlation.id.header` per entry) |`X-Correlation-Id`|
41
+
|`http.traceparent.header`| a custom name for the W3C `traceparent` header, read only when the standard one is absent (`traceparent.header` per entry) |`traceparent`|
42
+
|`event.stream.keep.alive`| the keep-alive comment interval of a Server-Sent Events reply (`/api/event` and streaming entries); `0` disables |`30s`|
36
43
|`static.html.folder`| the folder of static web content the host serves for the paths nothing else claims — relative to the application file's folder ([guide](config-logging-actuators.md#static-content-the-engines-public-folder)) |`resources/public`|
37
44
|`otel.forwarding`| the OpenTelemetry forwarder's master switch ([guide](config-logging-actuators.md#distributed-tracing-the-opentelemetry-forwarder-opt-in)) |`false`|
38
45
|`otel.exporter.otlp.endpoint`| the OTLP/HTTP traces URL including the signal path |`http://localhost:4318/v1/traces`|
With `rest.automation: true` ([guide](rest-automation.md)) the entries of `rest.yaml` are served
53
+
first, in the engines' grammar; `POST /api/event` and the actuators are the default entries.
54
+
55
+
| Aspect | Behavior |
56
+
|--------|----------|
57
+
| Matching | the engines' precedence — the most specific route wins, `{param}` and a trailing `*`; a known path under another method → 405 `Method not allowed`; an unknown path → 404 `Resource not found`; `OPTIONS` → 204 with the entry's CORS `options` lines, 405 without a CORS block |
58
+
| Request to the function | the whole request as the `AsyncHttpRequest` map — method, url, headers (lowercased, after the request transform), path and query parameters (a form's fields among them), the body parsed by its content type (JSON → map or list, text types → text, else bytes), cookies, the `session` map an authentication function left; `x-ttl` carries the entry's timeout in ms |
59
+
| Reply | a returned value is the body; a returned `EventEnvelope` sets the status and headers (`set-cookie` values split on `\|`); the content type is the function's or negotiated from `Accept` (`text/html` wraps a map in the HTML shell; no `Accept` → no content type); a map or list is pretty-printed JSON with `null` entries omitted |
60
+
| Errors | the engines' body below with `content-type: application/json`: an `AppException` from the function or the authentication function (anything but `true` from the latter → 401 `Unauthorized`); 408 `Timeout for N ms` at the entry's timeout (1 s–5 min, 30 s default; an inbound `x-ttl` wins); 503 `Service X not reachable` for an unregistered function; 413 `Upload exceeds N bytes`|
61
+
| Correlation and tracing |`X-Correlation-Id` (or `http.correlation.id.header`) always ensured and echoed, delivered as `my_correlation_id`; with `tracing: true` a W3C `traceparent`, else `X-Trace-Id` (`http.trace.id.header`), else a fresh id, and the `http.request` record plus the function's round-trip record |
62
+
|`stream: true`| an interceptor's segments rendered progressively: Server-Sent Events (`event:`/`data:` frames, `event: done` at the end, `event: error` in band, `: ping` keep-alives every `event.stream.keep.alive`) for a `text/event-stream` head or `Accept`, chunked text or JSON lines otherwise; the entry's timeout is the idle allowance, the head's `x-ttl` overrides it; a keep-alive that cannot be written ends the stream |
63
+
|`upload: true`| a `POST` entry's `multipart/form-data` files in the request map (`filename`, `file_type`, `file_length`, `upload`, `size`, bytes in `contents`), the form's text fields as query parameters, no body; all files together within `rest.upload.max.bytes` (16 MiB) |
64
+
| Precedence | a `rest.yaml` entry, then an extension's mounted routes (`Platform.addRoutes`), then the static folder (under the `static-content` block's `no-cache-pages` and `filter`), then the error signature below |
65
+
50
66
## Static content
51
67
52
68
A `GET` or `HEAD` of any other path is answered with the file it names inside `static.html.folder`
@@ -70,4 +86,5 @@ pretty-printed JSON:
70
86
}
71
87
```
72
88
73
-
Handler-level errors never use this shape — they ride the envelope on `/api/event`.
89
+
Handler-level errors never use this shape on `/api/event` — they ride the envelope. Behind a
90
+
`rest.yaml` entry a function's `AppException`*does* render as this shape, as in the engines.
0 commit comments