feat(go): M5.1 — hand-author /api/* wire types + JSON Schemas #16

Merged
kacerr merged 2 commits from feat/go-m5-1-api-structs into main 2026-05-07 19:50:55 +02:00
Owner

Summary

  • New package internal/web/api/ with AdultsResponse, JuniorsResponse, PaymentsResponse, VersionResponse — all fields carry explicit json: tags matching the Python view-model keys
  • Expected{Value int; Unknown bool} with custom MarshalJSON emits integer or "?" for junior single-attendance months
  • RawTransaction covers the full 11-column payments sheet row (for unmatched and raw_payments)
  • schemagen_test.go reflects all four types via github.com/invopop/jsonschema; golden-compares against committed schemas in tests/fixtures/api-schema/
  • The JSONSchema() method for Expected lives in the test file — production binary has zero jsonschema dependency
  • member_data/month_labels/raw_payments are nested objects in the API contract (not pre-serialised JSON strings as in the Jinja templates)
  • Plan file at docs/plans/2026-05-07-1650-go-rewrite-m5-1-api-structs-schemas.md

Test plan

  • go test fuj-management/go/internal/web/api — schema golden test passes
  • go vet ./internal/... ./cmd/... — clean
  • golangci-lint run ./internal/web/... — clean
  • All existing Go tests still pass (go test ./internal/... ./cmd/...)
  • Inspect tests/fixtures/api-schema/juniors.schema.jsonExpected appears as oneOf: [integer, "?"]

🤖 Generated with Claude Code

## Summary - New package `internal/web/api/` with `AdultsResponse`, `JuniorsResponse`, `PaymentsResponse`, `VersionResponse` — all fields carry explicit `json:` tags matching the Python view-model keys - `Expected{Value int; Unknown bool}` with custom `MarshalJSON` emits integer or `"?"` for junior single-attendance months - `RawTransaction` covers the full 11-column payments sheet row (for `unmatched` and `raw_payments`) - `schemagen_test.go` reflects all four types via `github.com/invopop/jsonschema`; golden-compares against committed schemas in `tests/fixtures/api-schema/` - The `JSONSchema()` method for `Expected` lives in the test file — production binary has zero jsonschema dependency - `member_data`/`month_labels`/`raw_payments` are nested objects in the API contract (not pre-serialised JSON strings as in the Jinja templates) - Plan file at `docs/plans/2026-05-07-1650-go-rewrite-m5-1-api-structs-schemas.md` ## Test plan - [x] `go test fuj-management/go/internal/web/api` — schema golden test passes - [x] `go vet ./internal/... ./cmd/...` — clean - [x] `golangci-lint run ./internal/web/...` — clean - [ ] All existing Go tests still pass (`go test ./internal/... ./cmd/...`) - [ ] Inspect `tests/fixtures/api-schema/juniors.schema.json` — `Expected` appears as `oneOf: [integer, "?"]` 🤖 Generated with [Claude Code](https://claude.ai/claude-code)
kacerr added 1 commit 2026-05-07 17:37:14 +02:00
feat(go): M5.1 — hand-author /api/* wire types + JSON Schemas
All checks were successful
Deploy to K8s / deploy (push) Successful in 7s
f253e3fcb1
Add internal/web/api package with Go structs for every /api/X route:
AdultsResponse, JuniorsResponse, PaymentsResponse, VersionResponse.
All fields carry explicit json: tags matching the Python view-model keys.

Key design choices:
- member_data / month_labels / raw_payments are nested objects (not
  the pre-serialised JSON strings used in Jinja templates)
- Expected{Value int; Unknown bool} with custom MarshalJSON emits int
  or the string "?" for junior single-attendance months
- RawTransaction covers the full 11-column payments sheet row

schemagen_test.go reflects all four response types via
github.com/invopop/jsonschema and golden-compares against committed
schemas in tests/fixtures/api-schema/. The JSONSchema() method on
Expected lives in the test file so the prod binary has no jsonschema
dependency.

Closes M5.1 in docs/plans/2026-05-03-2349-go-backend-rewrite-progress.md.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
kacerr added 1 commit 2026-05-07 17:38:02 +02:00
chore: CHANGELOG and progress tracker for M5.1
All checks were successful
Deploy to K8s / deploy (push) Successful in 6s
da5b82fcdb
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
kacerr merged commit be4ecef20f into main 2026-05-07 19:50:55 +02:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kacerr/fuj-management#16