docs(saved-filters,dashboard,system,series): Beam WO3 batch 5 — 15 endpoints + dedupe

Beam drafted 15 frontmatter'd docs (saved-filters CRUD, dashboard
sections/preferences/restore, system config/settings, series list + books);
Claude verified shapes against handlers and pinned the registry:
- saved-filters: SavedFilterResponse pinned by type (RFC3339 timestamps here,
  unlike most of the API); create/update share CreateSavedFilterRequest
  (resource_type oneof media-items|collections|devices)
- dashboard: preferences GET pin {hidden_collections, collection_order,
  items_per_section}; PUT returns full UserDashboardPreferences row; sections
  wrapper {sections}
- system: GET+PUT /api/system/config are admin-defined key/value maps — new
  AnyJSONObject sentinel (gate shape-checks without key comparison; request
  side too). UpdateSystemConfiguration returns {status, message} — verified,
  not guessed. GET /api/system/settings returns []SettingEntry.
- series: {series[{name, library_id, book_count, total_in_series,
  cover_paths, last_entry_at}], total, limit, offset}; books by
  ?name=&library_id= with family-lens 403

Dedupe: deleted dashboard.md, system/config.md, system/settings.md — each
covered the same endpoints as Beam's per-endpoint files (content merged by
the gate-verified shapes; old prose recoverable from git).

Beam clarifications confirmed: scanner routes are WO5 (docs exist);
progress/books-match are WO5.
This commit is contained in:
John O'Keefe committed 2026-10-24 15:29:24 -04:00
1 parent 7471ca99e8
commit fa00d6d3cb
20 files changed
+714 -416

No files matched your search

+19
View File
@@ -221,6 +221,15 @@ func validateRequestExample(t *testing.T, doc *APIDoc, schema Schema) {
return
}
// AnyJSONObject request: arbitrary keys (config maps). Shape-check only.
if _, ok := schema.Request.(AnyJSONObject); ok {
var m map[string]json.RawMessage
if err := json.Unmarshal(doc.ExampleRequest, &m); err != nil {
t.Errorf("%s: example-request must be a JSON object", doc.RelPath)
}
return
}
// Typo guard: field names must exist on the bind struct.
dec := json.NewDecoder(bytes.NewReader(doc.ExampleRequest))
dec.DisallowUnknownFields()
@@ -257,6 +266,16 @@ func validateResponseExample(t *testing.T, doc *APIDoc, schema Schema) {
return
}
// AnyJSONObject: response is an object with arbitrary/dynamic keys
// (e.g. map[string]string config). Only shape-check, never key-check.
if _, ok := schema.Response.(AnyJSONObject); ok {
var m map[string]json.RawMessage
if err := json.Unmarshal(doc.ExampleResponse, &m); err != nil {
t.Errorf("%s: example-response must be a JSON object", doc.RelPath)
}
return
}
want, isSlice := responseTopLevelKeys(t, schema.Response)
var got map[string]bool
+70
View File
@@ -34,6 +34,10 @@ type Schema struct {
Response any
}
// AnyJSONObject marks responses whose keys are dynamic (admin-defined config
// maps etc.): the gate then only verifies the example is a JSON object.
type AnyJSONObject struct{}
// Schemas is keyed by "METHOD path" in Echo syntax. Sample values inside
// RawMessage pins use empty strings / zero values — only the KEY SET is
// checked, never the values.
@@ -254,4 +258,70 @@ var Schemas = map[string]Schema{
"GET /api/jobs/:jobId": {
Response: services.JobResult{},
},
// --- WO3 tail batch: saved-filters, dashboard, system, series ---
"GET /api/saved-filters": {
Response: []handlers.SavedFilterResponse{},
},
"GET /api/saved-filters/:id": {
Response: handlers.SavedFilterResponse{},
},
"POST /api/saved-filters": {
Request: handlers.CreateSavedFilterRequest{},
Response: handlers.SavedFilterResponse{},
},
"PUT /api/saved-filters/:id": {
Request: handlers.CreateSavedFilterRequest{}, // same struct reused for update
Response: handlers.SavedFilterResponse{},
},
"DELETE /api/saved-filters/:id": {},
"GET /api/dashboard/sections": {
Response: json.RawMessage(`{"sections": []}`),
},
"GET /api/dashboard/preferences": {
Response: json.RawMessage(`{
"hidden_collections": [], "collection_order": [],
"items_per_section": 0
}`),
},
"PUT /api/dashboard/preferences": {
Request: json.RawMessage(`{
"library_id": null, "hidden_collections": [],
"collection_order": [], "items_per_section": 0
}`),
Response: database.UserDashboardPreferences{},
},
"POST /api/dashboard/restore-system-collection": {
Request: json.RawMessage(`{"collection_name": "", "reset_type": ""}`),
Response: json.RawMessage(`{"message": ""}`),
},
"GET /api/system/config": {
// Admin-defined key/value map — arbitrary keys.
Response: AnyJSONObject{},
},
"PUT /api/system/config": {
Request: AnyJSONObject{}, // map[string]string of key -> new value
Response: json.RawMessage(`{"status": "", "message": ""}`),
},
"GET /api/system/settings": {
Response: []database.SettingEntry{},
},
"PUT /api/system/settings": {
Request: handlers.UpdateSettingRequest{},
Response: handlers.UpdateSettingResponse{},
},
"GET /api/series": {
Response: json.RawMessage(`{
"series": [{
"name": "", "library_id": "", "book_count": 0,
"total_in_series": 0, "cover_paths": [], "last_entry_at": ""
}],
"total": 0, "limit": 0, "offset": 0
}`),
},
"GET /api/series/books": {
Response: json.RawMessage(`{
"name": "", "library_id": "", "books": [], "total": 0
}`),
},
}