Skip to content

chore(codegen): daily schema refresh (2026-08-09) - #117

Draft
timgl wants to merge 1 commit into
mainfrom
posthog-code/schema-refresh-2026-08-09
Draft

chore(codegen): daily schema refresh (2026-08-09)#117
timgl wants to merge 1 commit into
mainfrom
posthog-code/schema-refresh-2026-08-09

Conversation

@timgl

@timgl timgl commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Why

Daily automated OpenAPI schema refresh. The live PostHog spec drifted, so the vendored types in src/generated/api.d.ts were regenerated and the small number of managed resources affected by server-side renames were patched to keep the typed client compiling.

Spec diff size

  • src/generated/api.d.ts: +5,102 / −1,913 lines (17,571 → 20,760 lines). Most of this is churn inside request/response component schemas that were pulled in by the regenerate, not new managed operations.
  • openapi-filter.yaml: endpoints family entries updated (see below).

New operationIds added to the filter

The filter is a curated allowlist — only operations we manage as IaC resources are kept; the live spec's ~1,600 other operationIds are intentionally out of scope. This run added:

  • endpoints_list, endpoints_create, endpoints_retrieve, endpoints_update, endpoints_partial_update, endpoints_destroy

These belong to the existing managed endpoints family, which the server moved from /api/environments/{environment_id}/endpoints/ to /api/projects/{project_id}/endpoints/. No brand-new resource families were onboarded this run — the remaining new operationIds in the drift report are product/admin/debug endpoints outside the IaC-managed surface.

Resources touched

  • src/resources/endpoint/client.ts — updated the 5 request paths and path params (environment_idproject_id) to the new /api/projects/{project_id}/endpoints/ routes.
  • src/resources/dashboard/client.ts — schema rename: PatchedDashboardPatchedPatchedDashboardOpenApi.
  • src/resources/experiment/client.ts — schema renames: PatchedExperimentPatchedExperimentWrite, PaginatedExperimentListPaginatedExperimentBasicList.

pnpm typecheck and pnpm test (291 tests) both pass.

Unresolved drift — needs a human decision

  • environments_endpoints_* (6 ops) disappeared from the live spec, replaced by the endpoints_* ids above. Treated as a rename and coverage restored, but per policy the old ids were not deleted — they're retained in openapi-filter.yaml (harmless; openapi-format ignores unknown ids) with a comment flagging them. Please confirm the rename is intentional and delete the stale ids.
  • The endpoint retrieve response schema changed from EndpointResponse to EndpointVersionResponse in the live spec. It remains structurally compatible with our projection (toServerEndpoint) and typechecks, but worth a glance.

Notes

  • src/generated/api.d.ts was only regenerated via pnpm codegen, never hand-edited.
  • Pre-existing repo-wide lint/format warnings (68 files) were left untouched — unrelated to this change.

TaskRun: https://us.posthog.com/project/423401/tasks/6124d9ce-afe9-47c5-bc21-0e82abc1d6ff


Created with PostHog Code

Regenerate src/generated/api.d.ts from the live PostHog OpenAPI schema.

- Endpoints family moved server-side to /api/projects/{project_id}/endpoints/;
  add endpoints_* operationIds to the filter and update the endpoint client
  paths/params. Old environments_endpoints_* ids retained (flagged for human
  deletion).
- Follow schema component renames in dashboard/experiment clients
  (PatchedPatchedDashboardOpenApi, PatchedExperimentWrite,
  PaginatedExperimentBasicList).

typecheck and test (291 tests) pass.

Generated-By: PostHog Code
Task-Id: 6124d9ce-afe9-47c5-bc21-0e82abc1d6ff
@timgl
timgl requested a review from pl August 9, 2026 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant