chore(managementapi): repository resource serializer

What

Phase 1 Step 3 of the S17 REST management API: the repository resource serializer shared by the read (Step 8) and write (Steps 9-10) responses.

  • Repository: the JSON resource. Field names, order, and json tags match the OpenAPI Repository schema (api/openapi/v1.yaml) and the spec's Repository resource section.
  • repositoryFromModel: maps a model.Repositories parent row to the resource. The format/kind/visibility int16 enums map to their lowercase wire strings via lookup tables keyed by the datastore constants; the four nullable columns become null-bearing pointers (a present key with JSON null, never dropped); the counters pass through; created_at and last_updated_at render as RFC 3339 normalized to UTC.
  • settings is omitted when empty, so it is absent on every Phase 1 hosted response (the polymorphic envelope's shape stays open for later kinds).

No endpoint is wired yet; the serializer is consumed by the handler steps.

Review

  • /review-branch (APPROVE): corrected the enum-map comment (a map lookup returns "" silently for an unmapped key, not the "out-of-range bug" the comment claimed) and added TestEnumMaps_Complete to lock the maps to the enum set; added TestRepositoryFromModel_TimestampsNonUTC (baseRow used only UTC instants, so the .UTC() normalization was never exercised); documented that the seconds precision is deliberate; removed a stale "Step 3 skeleton" comment.

Spec coverage

Spec: S17 REST management API. This step owns the serialization half of the Repository resource; endpoint behavior, validation, and status codes are owned by later steps.

Acceptance criteria

# Criterion This step
AC-6 All three formats serialize TestRepositoryFromModel_Format (container/maven/npm)
AC-7 Detail emits no settings key TestRepositoryFromModel_SettingsOmitted
AC-10 visibility/description carried to JSON TestRepositoryFromModel_Visibility, _NonNullColumns
AC-1..5, 8, 9, 11..13 OpenAPI + endpoint/datastore behavior Owned by Steps 1 (!637), 5-10

Related to #171 (closed) and #172 (closed)

Merge request reports

Loading
Loading