Skip to content

chore(codegen): daily schema refresh (2026-08-03) - #111

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

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

Conversation

@timgl

@timgl timgl commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Why

Automated daily OpenAPI schema refresh. PostHog's live API spec drifted from the
committed types, so src/generated/api.d.ts needed regenerating and a few
managed-resource clients needed realigning with renamed schemas/paths.

Spec diff size

  • src/generated/api.d.ts: +3958 / −1621 lines (regenerated via pnpm codegen, never hand-edited).
  • Live spec now exposes 1790 operationIds; the filter allowlists 77.

New operationIds added to the filter

The endpoints API was renamed upstream — environments_endpoints_*
disappeared and reappeared as endpoints_* at a new project-scoped path
(/api/projects/{project_id}/endpoints/{name}/). Swapped the six operationIds
in openapi-filter.yaml:

endpoints_list  endpoints_create  endpoints_retrieve
endpoints_update  endpoints_partial_update  endpoints_destroy

Resources touched

  • endpoint — client repointed to the new /api/projects/{project_id}/endpoints/ route and project_id path param.
  • dashboard — PATCH body schema PatchedDashboardPatchedPatchedDashboardOpenApi.
  • experiment — write schemas Experiment / PatchedExperiment / PaginatedExperimentListExperimentWrite / PatchedExperimentWrite / PaginatedExperimentBasicList.

Edits are minimal type-alias/path updates — no refactors. pnpm typecheck and
pnpm test (291 tests) pass.

Unresolved / not actioned drift

  • environments_endpoints_* removed upstream — resolved here via the rename above (no orphaned filter entries remain). Flagging per policy: no managed operationIds were deleted, only renamed.

  • ~1719 live operationIds are outside the filter and were intentionally left out. They fall into three buckets, none in scope for this IaC tool:

    1. Full-PUT _update verbs on managed families (e.g. cohorts_update, event_definitions_update, experiments_update) — these resources are deliberately driven via PATCH/partial_update; unchanged long-standing design choice, not new drift.
    2. Auxiliary action endpoints on managed families (e.g. dashboards_collaborators_*, insights_sharing_*, feature_flags_activity_*, *_bulk_update_tags_create) — not core CRUD.
    3. Brand-new product families (accounts, conversations, tasks, signals, llm_analytics, error_tracking, warehouse, etc.) — internal/product surfaces this tool does not manage.

    No brand-new resource family met the bar for adding via add-resource.

TaskRun

PostHog Code TaskRun b291a215-b762-4dd2-8443-0da70472b635https://us.posthog.com/project/423401/tasks


Created with PostHog Code

Regenerate src/generated/api.d.ts from the live PostHog OpenAPI spec and
realign managed resource clients with renamed component schemas.

- Endpoints API renamed environments_endpoints_* -> endpoints_* (path moved
  from /api/environments/{environment_id}/endpoints/ to
  /api/projects/{project_id}/endpoints/); updated openapi-filter.yaml and the
  endpoint client accordingly.
- Dashboard PATCH body schema PatchedDashboard -> PatchedPatchedDashboardOpenApi.
- Experiment write schemas Experiment/PatchedExperiment/PaginatedExperimentList
  -> ExperimentWrite/PatchedExperimentWrite/PaginatedExperimentBasicList.

pnpm typecheck and pnpm test pass (291 tests).

Generated-By: PostHog Code
Task-Id: b291a215-b762-4dd2-8443-0da70472b635
@timgl
timgl requested a review from pl August 3, 2026 08:16
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