chore(codegen): daily schema refresh (2026-07-29) - #106
Draft
timgl wants to merge 1 commit into
Draft
Conversation
Regenerate src/generated/api.d.ts from the live PostHog OpenAPI schema and
absorb schema drift across managed resources.
- endpoints resource moved /api/environments/{id}/endpoints/ -> /api/projects/{id}/endpoints/
(operationIds environments_endpoints_* -> endpoints_*); update filter + client paths
- dashboards PATCH body schema renamed PatchedDashboard -> PatchedPatchedDashboardOpenApi
- experiments write schemas renamed Experiment/PatchedExperiment -> ExperimentWrite/PatchedExperimentWrite
and list response PaginatedExperimentList -> PaginatedExperimentBasicList
Generated-By: PostHog Code
Task-Id: feb08c8e-e3d5-41bd-82fb-51c2088d3c7d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Automated daily OpenAPI schema refresh. Keeps the typed client (
src/generated/api.d.ts) in sync with the live PostHog API and absorbs upstream schema drift before it breaks downstream consumers.Spec diff size
src/generated/api.d.ts: +3600 / −1551 lines (filtered spec; trimmed to the allowlisted operations inopenapi-filter.yaml). The regenerated types were driven entirely bypnpm codegen— no hand edits.New operationIds added to the filter
The
endpointsresource moved in the live spec, from/api/environments/{environment_id}/endpoints/to/api/projects/{project_id}/endpoints/, and its operationIds were renamedenvironments_endpoints_*→endpoints_*. Added toopenapi-filter.yaml:endpoints_listendpoints_createendpoints_retrieveendpoints_updateendpoints_partial_updateendpoints_destroyNo brand-new resource families were added. The vast majority of live-spec operationIds not in the filter are unmanaged product/admin/debug endpoints outside this project's IaC surface (dashboards, insights, feature flags, actions, cohorts, endpoints, event definitions, property groups, event schemas, experiments + holdouts/saved-metrics, environments). The daily refresh intentionally does not auto-expand the managed surface to new families or auxiliary sub-endpoints (e.g.
*_activity_retrieve,*_bulk_update_tags_create,dashboards_collaborators_*) — those are left out as not worth managing here.Resources touched
Schema-name drift patched in the affected Zod/type projections (minimal edits, no refactors):
src/resources/endpoint/client.ts) — repointed all CRUD paths to/api/projects/{project_id}/endpoints/and the path paramenvironment_id→project_id. TheEndpointResponse/PaginatedEndpointResponseListschemas still exist upstream; they had only been pruned as orphans once the old operationIds vanished.src/resources/dashboard/client.ts) — PATCH body schemaPatchedDashboard→PatchedPatchedDashboardOpenApi.src/resources/experiment/client.ts) — write bodyExperiment→ExperimentWrite, PATCH bodyPatchedExperiment→PatchedExperimentWrite, list responsePaginatedExperimentList→PaginatedExperimentBasicList.pnpm typecheckandpnpm test(291 tests) pass.Unresolved drift / needs a human
environments_endpoints_*disappeared from the live spec (moved, not deleted). Per refresh policy we do not auto-remove disappeared operationIds — they are kept inopenapi-filter.yaml(now matching nothing, with an explanatory comment) and flagged here for a human to delete.pnpm lintandpnpm format:checkalready fail onmainacross many files, includingdashboard/client.tsandexperiment/client.ts. Left untouched to keep this diff minimal; worth a separate cleanup pass.TaskRun
Task-Id:
feb08c8e-e3d5-41bd-82fb-51c2088d3c7dCreated with PostHog Code