Skip to content

fix(management): getCampaign returns Campaign directly, not wrapped#242

Merged
jeroenrinzema merged 1 commit into
feat/console-openapi-migrationfrom
fix/getcampaign-spec-response
Jun 17, 2026
Merged

fix(management): getCampaign returns Campaign directly, not wrapped#242
jeroenrinzema merged 1 commit into
feat/console-openapi-migrationfrom
fix/getcampaign-spec-response

Conversation

@jeroenrinzema

Copy link
Copy Markdown
Contributor

Summary

Corrects an OpenAPI spec inaccuracy: getCampaign was declared to return { data: Campaign }, but the handler returns the Campaign directly.

// internal/http/controllers/v1/management/campaigns.go (GetCampaign)
json.Write(w, http.StatusOK, campaign.OAPI())   // direct, not wrapped

Every other single-resource GET (getJourney, getProject, getUser, getList) already returns its schema directly — getCampaign's data wrapper was the lone outlier, so the generated clients described a response shape the backend never sends.

Changes

  • resources.yml: getCampaign 200 response → $ref: Campaign (direct).
  • Regenerated resources_gen.go (Go) and management.generated.ts (TS) with the pinned oapi-codegen v2.7.0 + openapi-typescript.

Verification

  • go build ./... and go vet ./internal/http/controllers/v1/management/...: clean.
  • tsc --noEmit in console: 0 errors.
  • No Go code consumed the old GetCampaignResponse.JSON200.Data shape.

Follow-up to the console OpenAPI migration (#241), which currently reads this response per the backend behaviour with a documented cast; that cast can be removed once this lands.

The getCampaign OpenAPI response was declared as { data: Campaign }, but the
handler (campaigns.go GetCampaign) returns the Campaign directly via
json.Write(w, ..., campaign.OAPI()) — matching every other single-resource GET
(getJourney/getProject/getUser/getList). The wrapper was an outlier that made
the generated clients describe a response shape the backend never sends.

Corrects the spec and regenerates the Go (resources_gen.go) and TypeScript
(management.generated.ts) bindings. No Go code consumed the old wrapped shape.
@jeroenrinzema jeroenrinzema changed the base branch from main to feat/console-openapi-migration June 17, 2026 12:22
@jeroenrinzema jeroenrinzema force-pushed the feat/console-openapi-migration branch from c4a44f7 to 6f5c784 Compare June 17, 2026 12:24
@jeroenrinzema jeroenrinzema force-pushed the fix/getcampaign-spec-response branch from a7b9451 to feac4d8 Compare June 17, 2026 12:24
@jeroenrinzema jeroenrinzema merged commit ecc51a1 into feat/console-openapi-migration Jun 17, 2026
6 checks passed
@jeroenrinzema jeroenrinzema deleted the fix/getcampaign-spec-response branch June 17, 2026 12:45
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant