Skip to content

chore(codegen): daily schema refresh (2026-08-21) - #128

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

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

Conversation

@timgl

@timgl timgl commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Daily automated OpenAPI schema refresh. Regenerated src/generated/api.d.ts from the live PostHog spec (https://us.posthog.com/api/schema/?format=json, filtered by openapi-filter.yaml) and patched the resource clients affected by upstream schema drift.

Why: keep the typed client in sync with the live PostHog API so the IaC tooling stays correct as the API evolves.

Spec diff size

  • src/generated/api.d.ts: +6,608 / −2,688 lines.
  • Managed path set is unchanged except the endpoints migration below — the rest is field-level schema churn within already-managed resources.

New operationIds added to the filter

The endpoints resource moved from /api/environments/{environment_id}/endpoints/ to /api/projects/{project_id}/endpoints/ and its operationIds were renamed environments_endpoints_*endpoints_*. Added to openapi-filter.yaml (existing managed family, same CRUD surface):

  • endpoints_list
  • endpoints_create
  • endpoints_retrieve
  • endpoints_update
  • endpoints_partial_update
  • endpoints_destroy

Resources touched

  • endpoint — repointed client from /api/environments/{environment_id}/endpoints/ to /api/projects/{project_id}/endpoints/ (path param environment_idproject_id).
  • dashboard — partial_update body schema PatchedDashboardPatchedPatchedDashboardOpenApi.
  • experimentPatchedExperimentPatchedExperimentWrite, PaginatedExperimentListPaginatedExperimentBasicList.

Unresolved drift (needs a human)

  • Disappeared operationIds: environments_endpoints_{list,create,retrieve,update,partial_update,destroy} no longer exist in the live spec (renamed to endpoints_*, see above). Per policy they were not deleted — they're kept in openapi-filter.yaml with a comment so a human can confirm the migration and remove them.
  • Unmanaged new operationIds: the drift detector flags ~1,900 operationIds present in the live spec but absent from the allowlist. These belong to products outside this tool's scope (billing, warehouse, error tracking, tasks, LLM analytics, conversations, etc.) and were intentionally left out — the filter is a deliberate narrow allowlist of IaC-managed definition resources. No brand-new resource family warranted onboarding this cycle.

Validation

  • pnpm typecheck
  • pnpm test ✅ (291 passed)

Pre-existing repo-wide lint/format debt (68 files) was left untouched to keep this diff minimal.

TaskRun: 302d72fa-1719-4af9-b8ae-0f18a3a3632d


Created with PostHog Desktop

Regenerate src/generated/api.d.ts from the live PostHog OpenAPI schema and patch the
resource clients affected by upstream schema drift.

- endpoints resource migrated from /api/environments/{environment_id}/endpoints/ to
  /api/projects/{project_id}/endpoints/ (operationIds renamed environments_endpoints_*
  -> endpoints_*); added the new operationIds to the filter and repointed the endpoint
  client. Stale environments_endpoints_* ids kept in the filter for a human to delete.
- dashboard partial_update body schema renamed PatchedDashboard -> PatchedPatchedDashboardOpenApi.
- experiment schemas renamed PatchedExperiment -> PatchedExperimentWrite and
  PaginatedExperimentList -> PaginatedExperimentBasicList.

typecheck + test (291) green.

Generated-By: PostHog Desktop
Task-Id: 302d72fa-1719-4af9-b8ae-0f18a3a3632d
@timgl
timgl requested a review from pl August 21, 2026 07:24
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