Docs: every v2 route documents its body, answer and parameters (1.52.1)
Most routes answered by a v1 handler showed an empty body and
`data: unknown` in /docs/v2. Each now documents what its handler reads
and answers, and every path and query parameter is described.
- `documented: { body?, response? }` on v1Route/defineRoute, with shared
shapes in src/v2/docs.ts. Documentation only: not enforced, so nothing
that works can start failing; outside production a body or answer that
doesn't fit is logged ("doesn't match its documented schema").
- QUERY_HELP / PATH_HELP describe common parameters; empty bodies say
"No body needed".
- Declared the funnel's eventIds and webhook deliveries' status/before.
- tests/v2Docs.test.ts keeps the document complete; frontend types
regenerated, three call sites' types tightened (no payload change).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -101,7 +101,8 @@ export function BreachesPanel({ token }: { token: string }) {
|
||||
setBusy(true);
|
||||
setError(null);
|
||||
try {
|
||||
if (id === "new") await apiV2Data("post", "/privacy/breaches", { authToken: token, body });
|
||||
// A new breach always comes from the full form (save below), so the required fields are there.
|
||||
if (id === "new") await apiV2Data("post", "/privacy/breaches", { authToken: token, body: body as { title: string; description: string; dataAffected: string; discoveredAt: string } });
|
||||
else await apiV2Data("put", "/privacy/breaches/{id}", { params: { id: id }, authToken: token, body });
|
||||
setEditing(null);
|
||||
await load();
|
||||
|
||||
Reference in New Issue
Block a user