Record that API inputs go in the JSON body
The owner decided that across the whole API an input goes in the request's JSON body, never in a query parameter. The path holds only a resource's ID, or a fixed word that names the route, as last, failed and uncertain do for the reprint routes, and a GET takes no inputs beyond its path. design.md records the decision beside the error shape and lists what breaks it today, for a later change to fix: the module routes' copies and printer query parameters and the invalid_query code that refuses them, the printers plan's ?printer=, and the filters and paging the job-store plan's phase 2 puts in the job list's query. CLAUDE.md's route rule says the same, on the owner's word. The code, the printers plan, api.md and swagger.json are unchanged here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cee528aa83
commit
2e291817d3
2 files changed
+16
-1
No files matched your search
@@ -151,7 +151,10 @@ main. A change is done when the gate passes and the docs under `docs/` (or
|
|||||||
entry in the table in `server/routes.go`, never a direct
|
entry in the table in `server/routes.go`, never a direct
|
||||||
`app.Get`/`Post`; it also needs its case in `TestRoutesConform`, which
|
`app.Get`/`Post`; it also needs its case in `TestRoutesConform`, which
|
||||||
fails for a route without one, and `TestRegisteredRoutesAreTheTable`
|
fails for a route without one, and `TestRegisteredRoutesAreTheTable`
|
||||||
fails for a route registered outside the table.
|
fails for a route registered outside the table. API inputs go in the
|
||||||
|
JSON body, never in query parameters: the path holds only a
|
||||||
|
resource's ID or a fixed word naming the route, and a `GET` takes no
|
||||||
|
inputs beyond its path (design.md, "Inputs go in the JSON body").
|
||||||
- An enum value or a limit goes into the field's `jsonschema` tag. The
|
- An enum value or a limit goes into the field's `jsonschema` tag. The
|
||||||
tests in `receipt/schema_test.go`, `printqueue/schema_test.go` and
|
tests in `receipt/schema_test.go`, `printqueue/schema_test.go` and
|
||||||
`server/schema_test.go` hold the tags to validation, to the Go constants
|
`server/schema_test.go` hold the tags to validation, to the Go constants
|
||||||
|
|||||||
@@ -498,6 +498,18 @@ client ─HTTPS─▶ Caddy ─▶ server ── validate ──▶ printqueue (
|
|||||||
`error` is for people. A refusal is answered and never logged as a failure.
|
`error` is for people. A refusal is answered and never logged as a failure.
|
||||||
An unexpected error or panic is logged once and reported to Sentry once,
|
An unexpected error or panic is logged once and reported to Sentry once,
|
||||||
without the body or the `Authorization` header.
|
without the body or the `Authorization` header.
|
||||||
|
- **Inputs go in the JSON body (owner, 2026-12-01).** An API input goes in
|
||||||
|
the request's JSON body, never in a query parameter. The path holds only
|
||||||
|
a resource's ID, or a fixed word that names the route, as `last`,
|
||||||
|
`failed` and `uncertain` do in `/jobs/.../reprint`. A `GET` takes no
|
||||||
|
inputs beyond its path. Some of the API breaks the rule today, and a
|
||||||
|
later change makes it follow:
|
||||||
|
- the module routes' `copies` and `printer` query parameters, and the
|
||||||
|
`invalid_query` error code that refuses them;
|
||||||
|
- the `?printer=` that docs/plans/printers.md puts on `/print`,
|
||||||
|
`/preview` and the module routes;
|
||||||
|
- the filters and paging that docs/plans/job-store.md's phase 2 puts in
|
||||||
|
the query of `GET /api/v1/jobs` (its decision 16).
|
||||||
- **The OpenAPI document is generated (owner, 2026-11-30).** One route
|
- **The OpenAPI document is generated (owner, 2026-11-30).** One route
|
||||||
table drives both the server's routes and `docs/swagger.json`, so the
|
table drives both the server's routes and `docs/swagger.json`, so the
|
||||||
document cannot describe a route the server lacks. Schemas come from the
|
document cannot describe a route the server lacks. Schemas come from the
|
||||||
|
|||||||
Reference in new issue
Block a user