chore(codegen): daily schema refresh (2026-07-25) - #101
Draft
timgl wants to merge 1 commit into
Draft
Conversation
Regenerate src/generated/api.d.ts from the live PostHog OpenAPI schema and
patch managed resources for upstream schema drift.
- Endpoints resource renamed upstream: the deprecated
/api/environments/{environment_id}/endpoints/ path (environments_endpoints_*)
was removed from the live spec; the canonical family is now the
project-scoped /api/projects/{project_id}/endpoints/ (endpoints_*). Added the
new operationIds to openapi-filter.yaml and repointed the endpoint client.
The old environments_endpoints_* entries are kept (harmless, unmatched) and
flagged for a human to delete.
- Renamed request/response component schemas patched in clients:
PatchedExperiment -> PatchedExperimentWrite, Experiment (create body) ->
ExperimentWrite, PaginatedExperimentList -> PaginatedExperimentBasicList,
PatchedDashboard -> PatchedPatchedDashboardOpenApi.
typecheck + all 291 tests pass.
Generated-By: PostHog Code
Task-Id: bc69de41-333f-486a-a8cc-7462609ec0db
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
src/generated/api.d.tsin sync with the live PostHog API schema (filtered byopenapi-filter.yaml) and patches managed resources when upstream schema shapes drift, so the typed client keeps compiling.Spec diff size
src/generated/api.d.ts: +3540 / −1521 lines (regenerated viapnpm codegen; not hand-edited).New operationIds added to the filter
The endpoints resource was renamed upstream. The previously-
@deprecatedpath/api/environments/{environment_id}/endpoints/(operationIdsenvironments_endpoints_*) has been removed from the live spec, replaced by the project-scoped/api/projects/{project_id}/endpoints/(operationIdsendpoints_*). Since this is the same managed resource family, the new CRUD operationIds were added toopenapi-filter.yaml:endpoints_listendpoints_createendpoints_retrieveendpoints_updateendpoints_partial_updateendpoints_destroyNo other new operationIds were added. The drift detector lists ~the entire PostHog API surface because
openapi-filter.yamlis an intentional minimal allowlist (inverseOperationIds), not a mirror — every non-allowlisted operation shows up as "new". The remaining unlisted operationIds are out of scope for this IaC tool (other products, sub-resources, admin/internal endpoints) and were deliberately left out.Resources touched
src/resources/endpoint/client.ts) — repointed all 5 CRUD calls from/api/environments/{environment_id}/endpoints/to/api/projects/{project_id}/endpoints/(path paramenvironment_id→project_id).src/resources/experiment/client.ts) — renamed component schema aliases:Experiment(create body) →ExperimentWrite,PatchedExperiment→PatchedExperimentWrite,PaginatedExperimentList→PaginatedExperimentBasicList.src/resources/dashboard/client.ts) — renamedPatchedDashboard→PatchedPatchedDashboardOpenApi(patch body). Note the upstream double-Patchedname is verbatim from the generated schema.pnpm typecheckpasses and all 291 tests pass. (Pre-existinglint/format:checkfailures onmainare unrelated and untouched.)Unresolved drift for a human
The old
environments_endpoints_*operationIds have disappeared from the live spec (renamed, see above). Per the refresh policy, disappeared operationIds are not removed automatically — they're kept inopenapi-filter.yaml(harmless: openapi-format simply doesn't match them) with a comment flagging them. A human should delete the sixenvironments_endpoints_*entries once the endpoints migration is confirmed stable.TaskRun
Task-Id:
bc69de41-333f-486a-a8cc-7462609ec0dbCreated with PostHog Code