Skip to content

chore(codegen): daily schema refresh (2026-08-04) - #112

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

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

Conversation

@timgl

@timgl timgl commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Daily OpenAPI schema refresh (2026-08-04)

Automated regeneration of src/generated/api.d.ts from the live PostHog OpenAPI
spec, plus the minimal client patches needed to keep the managed resources
compiling against the new schema.

Why: The daily drift check flagged that api.d.ts changed against the live
spec. Left unpatched, three managed resources (endpoint, dashboard, experiment)
fail pnpm typecheck because upstream renamed schemas and relocated a route.

Spec diff size

src/generated/api.d.ts: +3928 / −1572 lines (regenerated, not hand-edited).

Drift resolved

Resource Change upstream Fix
endpoint Route relocated /api/environments/{environment_id}/endpoints//api/projects/{project_id}/endpoints/; operationIds renamed environments_endpoints_*endpoints_* Renamed the six operationIds in openapi-filter.yaml; repointed the five calls in endpoint/client.ts to the project path. endpoints_retrieve now returns EndpointVersionResponse (a superset of EndpointResponse), so toServerEndpoint stays compatible.
dashboard PATCH request body schema renamed PatchedDashboardPatchedPatchedDashboardOpenApi Updated the PatchedDashboardBody type alias.
experiment Write schema ExperimentExperimentWrite, PatchedExperimentPatchedExperimentWrite; list response PaginatedExperimentListPaginatedExperimentBasicList Updated the three type aliases.

New operationIds added to the filter

None as brand-new managed capabilities. The only filter change is the endpoint
rename above (endpoints_list/create/retrieve/update/partial_update/destroy),
which replaces the vanished environments_endpoints_* ids for the same,
already-managed resource.

The drift job's "new operationIds" list is the full set-difference between the
entire live API and our curated allowlist (~thousands of ids: analytics, admin,
per-product, and read-only endpoints). None represent a new CRUD sibling of an
existing managed family, and none are a brand-new resource family worth managing
under this IaC tool, so nothing else was pulled in.

Disappeared operationIds

environments_endpoints_{list,create,retrieve,update,partial_update,destroy} no
longer exist in the live spec. These were not deleted blindly — they are a
rename/relocation of the endpoint resource and were migrated to endpoints_* as
described above. No other managed operationId disappeared.

Unresolved drift

None. pnpm typecheck and pnpm test (291 tests) both pass. The endpoint
resource's description-marker safety invariant is untouched (only route paths
changed).

Notes

  • src/generated/api.d.ts was regenerated via pnpm codegen only — not
    hand-edited (it is .prettierignored by design).
  • Pre-existing repo-wide eslint/prettier warnings are unrelated to this
    change and present on main.

Originating TaskRun: https://us.posthog.com/project/423401/tasks/41e15d0c-07df-4dfd-8fc5-57a2dfacc664


Created with PostHog Code

Regenerate src/generated/api.d.ts from the live PostHog OpenAPI spec and
patch managed resources for drift.

- endpoints resource relocated from /api/environments/{environment_id}/endpoints/
  to /api/projects/{project_id}/endpoints/ (operationIds renamed
  environments_endpoints_* -> endpoints_*); update filter + client paths.
- dashboards PATCH body schema renamed PatchedDashboard ->
  PatchedPatchedDashboardOpenApi.
- experiments write schemas renamed Experiment -> ExperimentWrite,
  PatchedExperiment -> PatchedExperimentWrite, and list response
  PaginatedExperimentList -> PaginatedExperimentBasicList.

Generated-By: PostHog Code
Task-Id: 41e15d0c-07df-4dfd-8fc5-57a2dfacc664
@timgl
timgl requested a review from pl August 4, 2026 08:02
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