Documentation
¶
Overview ¶
Command patchgen rewrites the oapi-codegen output so that every `time.Time` field becomes a `freelotime.Time` field.
Why this exists: Freelo's API emits timestamps without a timezone suffix ("2026-04-24T11:12:38"), which Go's time package can't unmarshal as time.RFC3339. The default generated typed client therefore fails on every endpoint that returns a date — including listing projects, tasks, comments, etc. freelotime.Time accepts both RFC3339-with-zone and the no-zone form (interpreted as Europe/Prague), so swapping the type makes the typed *WithResponse methods work out of the box.
We do this as a post-generation patch (rather than a spec preprocessor or oapi-codegen import-mapping) because:
- The spec stays byte-identical to what Freelo publishes — `make gen` tracks the upstream document with no Go-specific extensions baked in.
- oapi-codegen v2 doesn't reliably honor x-go-type on primitive `format: date-time` schemas (it does for named schemas).
- A regex substitution over the generated file is simple, transparent, and easy to audit on every regen.
Run via `make gen`. Idempotent — running it twice on the same input is a no-op.