Skip to content

fix(sdk): regenerate OpenAPI types for the /v1/ready endpoint - #384

Merged
Depo-dev merged 3 commits into
devfrom
fix/openapi-types-drift
Jul 31, 2026
Merged

fix(sdk): regenerate OpenAPI types for the /v1/ready endpoint#384
Depo-dev merged 3 commits into
devfrom
fix/openapi-types-drift

Conversation

@Depo-dev

Copy link
Copy Markdown
Collaborator

The OpenAPI Spec job is failing on dev at Check for uncommitted changes.

#374 documented GET /v1/ready in api/openapi.yaml — the readiness endpoint from the liveness/readiness split (#243) — but did not regenerate sdk/typescript/src/api-types.gen.ts. Regenerating produces a 176-line diff, so the committed types no longer match the spec they are generated from. That check exists precisely to catch this.

Regenerated. The only route added is /v1/ready. tsc --noEmit is clean and all 49 TypeScript SDK tests pass against the new types.

Not fixed here

Two other checks are red on dev, and both are genuine security findings rather than merge fallout — they need dependency work and their own triage, so they are out of scope for a codegen refresh:

  • Dependency auditgovulncheck reports a google.golang.org/grpc advisory reachable from gen/trident_grpc.pb.go via StreamEvents/Recv. Needs a grpc bump and a regenerated stub.
  • SBOM + scan (go-api) — trivy CVEs in the go-api image.

Both belong with the existing audit backlog in #373.

Depo-dev added 3 commits July 31, 2026 19:38
The OpenAPI Spec job fails on dev at "Check for uncommitted changes":
regenerating sdk/typescript/src/api-types.gen.ts from api/openapi.yaml
produces a 176-line diff.

#374 documented GET /v1/ready in the spec — the readiness endpoint from the
liveness/readiness split (#243) — but did not regenerate the SDK types, so
the committed output no longer matches the spec it is generated from. That
check exists precisely to catch this.

Regenerated. The only route added is /v1/ready. tsc --noEmit is clean and all
49 TypeScript SDK tests pass against the new types.
Correcting my previous commit, which fixed a quarter of the problem.

The OpenAPI Spec job does not run openapi-typescript directly any more — #353
replaced it with `python3 scripts/generate_sdk_models.py`, which regenerates
four files and diffs all of them:

    sdk/typescript/src/api-types.gen.ts
    sdk/go/openapi/models_gen.go
    sdk/python/src/trident_indexer/openapi_models_gen.py
    sdk/rust/src/openapi_models_gen.rs

I regenerated only the TypeScript one, so the job stayed red. Running the
real generator produces 958 lines across all four.

The trigger is #374's liveness/readiness split (#243): `HealthResponse` in the
spec became `LivenessResponse` plus `ReadyResponse`/`ReadyChecks`, and
`/v1/ready` was documented as a new path.

That rename also broke the Python package: `src/trident_indexer/__init__.py`
re-exported `HealthResponse`, which the generator no longer emits, so
`mypy --strict` failed with attr-defined and every pytest collection errored.
Updated the re-export and `__all__` to the three new names.

Verified per SDK: cargo clippy -p trident-sdk -D warnings; go build and go vet
in sdk/go; tsc --noEmit and 49 tests in sdk/typescript; mypy --strict and 38
tests in sdk/python.
The OpenAPI Spec job kept failing on a one-line diff after regeneration:

    -use serde::{Deserialize, Serialize};
    +use serde::{Serialize, Deserialize};

Two CI jobs were asserting opposite content for the same file. quicktype
emits `{Serialize, Deserialize}`; `cargo fmt --all` reorders it
alphabetically, and openapi_models_gen.rs is reachable from lib.rs so it is
not skipped. Whichever job ran last left the other red — the Rust job on a
formatting diff, or this check on the reordered import.

Fixed in the generator rather than around it: generate_rust now runs rustfmt
over its output, so the committed file is simultaneously what quicktype
produces and what cargo fmt wants. Anyone regenerating gets the same bytes.

I first tried `ignore` in rustfmt.toml — that option is nightly-only and CI
is on stable, so it did nothing but emit warnings. Removed.

Verified: regenerating twice produces byte-identical output, cargo fmt
--check is clean, and cargo clippy -p trident-sdk -D warnings passes.
@Depo-dev
Depo-dev merged commit 8fb139c into dev Jul 31, 2026
16 of 20 checks passed
@Depo-dev
Depo-dev deleted the fix/openapi-types-drift branch July 31, 2026 19:22
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