Skip to content

chore(codegen): daily schema refresh (2026-08-29) - #136

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

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

Conversation

@timgl

@timgl timgl commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Why

Automated daily OpenAPI schema refresh. Regenerates the typed client
(src/generated/api.d.ts) from the live PostHog spec and reconciles resource
drift so the SDK keeps compiling against the current API.

Spec diff size

  • src/generated/api.d.ts: 17,571 → 21,716 lines (+6,198 / −2,053). The bulk
    is upstream schema growth (new fields) on already-managed operations.
  • openapi-filter.yaml: 6 operationIds migrated (see below).

New operationIds added to the filter

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

These are not a new family — they are the renamed successors of the endpoints
resource (see drift below).

Resources touched

  • endpoint — path migration /api/environments/{environment_id}/endpoints/
    /api/projects/{project_id}/endpoints/ and path param environment_id
    project_id in client.ts.
  • dashboard — PATCH body schema PatchedDashboardPatchedPatchedDashboardOpenApi.
  • experiment — PATCH body PatchedExperimentPatchedExperimentWrite;
    list response PaginatedExperimentListPaginatedExperimentBasicList.
  • generatedsrc/generated/api.d.ts regenerated (not hand-edited).

Drift resolved

  • Endpoints resource relocated + renamed. Upstream, the endpoints resource
    moved off the environments router onto the projects router; operationIds
    environments_endpoints_* disappeared and reappeared as endpoints_* at
    /api/projects/{project_id}/endpoints/. Treated as a rename (no coverage lost):
    filter and client migrated 1:1. No other managed operationId disappeared.
  • Schema renames for dashboard/experiment PATCH bodies and the experiment
    list envelope, patched in the affected client Zod/type projections above.

Unresolved drift / intentionally left out

  • The live spec exposes a large set of new operationIds outside the managed
    families (accounts, alerts, annotations, batch_exports, warehouse, tasks, etc.).
    These are internal/admin/product surfaces, not part of the IaC resource model,
    so they are intentionally not added to the filter. Adopting any as a new
    managed resource family is a product decision left for a human.
  • No brand-new managed resource families were added in this refresh.

Verification

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

Pre-existing repo-wide lint/format nonconformance (unrelated files) was left
untouched to keep this diff scoped.


Created with PostHog Desktop

Regenerate src/generated/api.d.ts from the live PostHog OpenAPI spec and follow
resource drift.

- Endpoints resource moved from /api/environments/{environment_id}/endpoints/ to
  /api/projects/{project_id}/endpoints/ (operationIds environments_endpoints_* ->
  endpoints_*). Migrated openapi-filter.yaml and endpoint client paths/params.
- PatchedDashboard -> PatchedPatchedDashboardOpenApi (dashboard PATCH body).
- PatchedExperiment -> PatchedExperimentWrite; PaginatedExperimentList ->
  PaginatedExperimentBasicList (experiment client).

typecheck + all 291 unit tests pass.

Generated-By: PostHog Desktop
Task-Id: 8e5009a3-8660-4f4c-8d16-12e4c321b746
@timgl
timgl requested a review from pl August 29, 2026 07:10
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