chore(codegen): daily schema refresh (2026-08-02) - #110
Draft
timgl wants to merge 1 commit into
Draft
Conversation
Regenerate src/generated/api.d.ts from the live PostHog OpenAPI spec and
follow the upstream renames through the affected resource clients.
- endpoints: operationIds/paths moved from the deprecated
environments_endpoints_* (/api/environments/{environment_id}/endpoints/)
to endpoints_* (/api/projects/{project_id}/endpoints/). Updated the filter
allowlist and the endpoint client paths accordingly.
- dashboards: partial_update body schema renamed
PatchedDashboard -> PatchedPatchedDashboardOpenApi.
- experiments: create body Experiment -> ExperimentWrite, partial_update body
PatchedExperiment -> PatchedExperimentWrite, list response
PaginatedExperimentList -> PaginatedExperimentBasicList.
Generated-By: PostHog Code
Task-Id: 4cd15248-154c-4308-befd-9f34fa5b4e94
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 spec so the typed client doesn't drift, and follows any upstream operationId/schema renames through the affected resource clients.Spec diff size
src/generated/api.d.ts: 17,571 → 19,908 lines (~726 KB → ~902 KB); +3,969 / −1,632 lines within the file.New operationIds added to the filter
The endpoint resource family was renamed upstream — the deprecated
environments_endpoints_*operations (served at/api/environments/{environment_id}/endpoints/) were removed and replaced byendpoints_*at/api/projects/{project_id}/endpoints/. Swapped the six CRUD operationIds inopenapi-filter.yaml:endpoints_list,endpoints_create,endpoints_retrieve,endpoints_update,endpoints_partial_update,endpoints_destroy(replacing theenvironments_endpoints_*equivalents).No brand-new resource families were added. The live spec contains ~1,724 operationIds outside the allowlist, but they are all product/API surface this IaC tool does not manage (conversations, tasks, logs, vision scanners, warehouse, LLM analytics, admin/debug endpoints, per-resource sub-actions like
*_activity/*_collaborators, and PUT*_updatevariants of families we intentionally manage via PATCH). The allowlist is curated to the CRUD operations the resource clients actually use, so these were intentionally left out.Resources touched
Regenerating surfaced three upstream schema renames that broke
pnpm typecheck; patched the affected client type aliases minimally (no refactors):src/resources/endpoint/client.ts) — repointed all five request paths from/api/environments/{environment_id}/endpoints/…to/api/projects/{project_id}/endpoints/…(and the path paramenvironment_id→project_id). Response/request component names (EndpointResponse,EndpointVersionResponse,PaginatedEndpointResponseList,EndpointRequest) are unchanged.src/resources/dashboard/client.ts) —dashboards_partial_updatebody schemaPatchedDashboard→PatchedPatchedDashboardOpenApi(samerestriction_level/tiles/delete_insightsfields).src/resources/experiment/client.ts) — create bodyExperiment→ExperimentWrite, partial_update bodyPatchedExperiment→PatchedExperimentWrite, list responsePaginatedExperimentList→PaginatedExperimentBasicList. VerifiedExperimentBasicstill carries the fieldsServerExperimentSchemarequires (id,name,feature_flag_key,feature_flag) and the schema is.loose(), so the list parse stays runtime-safe.Verification
pnpm codegen(regenerated, not hand-edited)pnpm typecheck✅pnpm test✅ (291 passed)pnpm lint/pnpm format:checkfail on the repo baseline (68 files, incl. the two client files here — pre-existing before this change, no pre-commit hook enforces it). Not reformatted, to avoid touching unrelated files.Unresolved drift
None. The only managed operationIds missing from the live spec were the six
environments_endpoints_*— resolved via the rename above, not a deletion. No managed operations were dropped upstream, so there is nothing pending human deletion.TaskRun
Cloud run:
4cd15248-154c-4308-befd-9f34fa5b4e94— https://us.posthog.com/project/423401/tasksCreated with PostHog Code