Repository navigation
Generate a typed REST API client from the public OpenAPI spec - #160
Open
Stephen Belanger (Qard) wants to merge 27 commits into
Open
Stephen Belanger (Qard) wants to merge 27 commits into
Stephen Belanger (Qard) wants to merge 27 commits into
Conversation
Stephen Belanger (Qard)
requested review from
Abhijeet Prasad (AbhiPrasad) and
Andrew Kent (realark)
October 30, 2026 14:39
Stephen Belanger (Qard)
marked this pull request as ready for review
October 30, 2026 14:40
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.
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.