Skip to content

chore(codegen): daily schema refresh (2026-08-10) - #118

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

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

Conversation

@timgl

@timgl timgl commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Why

Automated daily OpenAPI schema refresh. The live PostHog spec drifted from the
checked-in generated types, so the typed client needed regenerating and the
managed resource clients needed to follow two upstream renames.

Spec diff size

src/generated/api.d.ts: +5103 / −1914 lines (17,571 → 20,760). Regenerated
via pnpm codegen — not hand-edited.

New operationIds added to the filter

The Endpoints resource was renamed/moved upstream, so its allowlisted
operationIds changed (net: still 6 operations, same family):

removed (gone from live spec) added
environments_endpoints_list endpoints_list
environments_endpoints_create endpoints_create
environments_endpoints_retrieve endpoints_retrieve
environments_endpoints_update endpoints_update
environments_endpoints_partial_update endpoints_partial_update
environments_endpoints_destroy endpoints_destroy

Path moved: /api/environments/{environment_id}/endpoints/
/api/projects/{project_id}/endpoints/.

No brand-new resource families were added. openapi-filter.yaml is an
allowlist — the drift detector's long "new operationIds" list is essentially
the entire unmanaged PostHog API surface (thousands of ops that have always
been intentionally excluded), not genuinely new endpoints worth managing.

Resources touched

  • endpoint (src/resources/endpoint/client.ts) — updated the 5 request
    paths and the path param (environment_idproject_id) to match the moved
    route. retrieve now returns EndpointVersionResponse (a superset of
    EndpointResponse), so the projection is unaffected.
  • dashboard (src/resources/dashboard/client.ts) — patched-body type alias
    PatchedDashboardPatchedPatchedDashboardOpenApi (schema rename).
  • experiment (src/resources/experiment/client.ts) — type aliases
    ExperimentExperimentWrite, PatchedExperimentPatchedExperimentWrite,
    PaginatedExperimentListPaginatedExperimentBasicList (schema renames).

All edits are minimal type/path adjustments — no refactors.

Verification

  • pnpm typecheck
  • pnpm test ✅ (291 tests, 35 files)

Pre-existing repo-wide eslint/prettier warnings are untouched and not in any
file changed here (src/generated is in .prettierignore).

Unresolved drift

None. The only managed operations that disappeared from the live spec were the
environments_endpoints_* set, which was a rename (migrated above) rather than a
removal — no operationIds were dropped without a replacement, so nothing needs a
human deletion this run.

TaskRun

Task-Id: 0440c8ea-11da-4df8-9ea2-dc22a99b7864


Created with PostHog Code

Regenerate src/generated/api.d.ts from the live PostHog OpenAPI schema and
migrate the managed clients to follow upstream renames.

- Endpoints resource moved from /api/environments/{environment_id}/endpoints/
  (environments_endpoints_*) to /api/projects/{project_id}/endpoints/
  (endpoints_*). Updated openapi-filter.yaml and endpoint/client.ts paths +
  path params accordingly.
- Renamed upstream schemas: PatchedDashboard -> PatchedPatchedDashboardOpenApi;
  Experiment(write)/PatchedExperiment/PaginatedExperimentList ->
  ExperimentWrite/PatchedExperimentWrite/PaginatedExperimentBasicList.

typecheck + test (291 tests) green.

Generated-By: PostHog Code
Task-Id: 0440c8ea-11da-4df8-9ea2-dc22a99b7864
@timgl
timgl requested a review from pl August 10, 2026 07:37
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