Skip to content

Generate a typed REST API client from the public OpenAPI spec - #160

Open
Stephen Belanger (Qard) wants to merge 27 commits into
mainfrom
t3/research-openapi-client-generation
Open

Stephen Belanger (Qard) wants to merge 27 commits into
mainfrom
t3/research-openapi-client-generation

Conversation

@Qard

@Qard Stephen Belanger (Qard) commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Adds a typed API client through braintrust_sdk_rust::api, with authentication, organization discovery, queries, logging, signed uploads, and streaming function, eval, and proxy calls. Existing SDK callers are unchanged; their migration is stacked in #161.

Client methods are generated ahead of time with the pinned openapi-to-rust CLI. The crate contains Rust source rather than a schema or build-time generator. A weekly job fetches the published spec and opens or updates one PR when the generated source changes. No custom secrets are needed; allow Actions-created PRs and approve their CI during review.

The earlier Progenitor implementation remains in history for rollback. A wrapper exposes generated methods through Deref while preserving our builder and extensions. A declarative overlay removes redundant nullable intersections. Browser preflights and the catch-all proxy route remain excluded.

Depends on https://github.com/braintrustdata/braintrust/pull/24152 and publication of its OpenAPI spec. The checked-in Rust is generated from that branch's OpenAPI 3.1.1 output, assuming the backend change has landed. The generator configuration continues to use the normal published spec URL.

Validation: backend OpenAPI tests and Rust streaming regressions cover JSON and SSE responses, incremental delivery across HTTP chunks, split UTF-8, event metadata, authentication, and preserved HTTP errors. Workspace tests, strict Clippy, documentation, Rust 1.88 checks, packaging, and workflow lint pass.

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