feat(api): generate REST models from pinned OpenAPI spec - #690
Open
Abhijeet Prasad (AbhiPrasad) wants to merge 1 commit into
Open
feat(api): generate REST models from pinned OpenAPI spec#690Abhijeet Prasad (AbhiPrasad) wants to merge 1 commit into
Abhijeet Prasad (AbhiPrasad) wants to merge 1 commit into
Conversation
Implements step 1 of #683. This does not add public REST methods. It adds two type namespaces: - `braintrust.api._generated.models`: private generated `TypedDict`s and type aliases - `braintrust.api.types`: the public REST type namespace, empty until resource APIs are added The generated module is derived from committed inputs: openapi/spec.json + openapi/config.json | v validation | v datamodel-code-generator + Ruff | v braintrust/api/_generated/models.py `make generate-api-client` runs that pipeline. `make check-api-client-codegen` runs it in a temporary directory and fails if the committed output differs, so CI catches hand edits and stale models. Builds use the committed models and do not run code generation. Spec updates are manual for now: update the pinned upstream commit and spec SHA-256 in `openapi/config.json`, fetch the snapshot, regenerate, and review the spec and model diffs together. Automated update PRs are deferred to step 7.
Andrew Kent (realark)
approved these changes
Aug 14, 2026
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.
AI Summary
Implements step 1 of #683.
This does not add public REST methods. It adds two type namespaces:
braintrust.api._generated.models: private generatedTypedDicts and type aliasesbraintrust.api.types: the public REST type namespace, empty until resource APIs are addedThe generated module is derived from committed inputs:
make generate-api-clientruns that pipeline.make check-api-client-codegenruns it in a temporary directory and fails if the committed output differs, so CI catches hand edits and stale models. Builds use the committed models and do not run code generation.Spec updates are manual for now: update the pinned upstream commit and spec SHA-256 in
openapi/config.json, fetch the snapshot, regenerate, and review the spec and model diffs together. Automated update PRs are deferred to step 7.