Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions openapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
`spec.json` is a committed snapshot of the public specification from
[`braintrustdata/braintrust-openapi`](https://github.com/braintrustdata/braintrust-openapi).
`config.json` pins the full upstream commit, snapshot SHA-256, generator tools, generator flags, and
explicit endpoint exclusions. The generator scripts live in `py/scripts/`. Builds and package installation use the committed generated source and never fetch or run
code generation.
selected endpoint tags. The generator scripts live in `py/scripts/`. Builds and package installation
use the committed generated source and never fetch or run code generation.

From `py/`, validate and regenerate the private models offline with:

Expand All @@ -13,7 +13,15 @@ make generate-api-client
make check-api-client-codegen
```

The check regenerates into a temporary directory and does not modify the worktree.
The check regenerates into a temporary directory and does not modify the worktree. Endpoint bindings
are rolled out explicitly through `endpoint_generator.generated_tags`. The current rollout supports
exactly one selected OpenAPI tag and emits its operation registry and resource class together in
`projects.py`, with reachable types in `models/projects.py`; unreachable models are omitted. Add
explicit cross-resource model partitioning before selecting a second tag. Public resource method and
inline response type names are derived mechanically from each `operationId`, and generated methods
forward request fields and parameters without implicit defaults. Writes that are safe to retry are
listed declaratively in `endpoint_generator.idempotent_writes`; reads and all other writes use
mechanical retry defaults.

To fetch the configured upstream commit explicitly:

Expand All @@ -29,5 +37,5 @@ BRAINTRUST_OPENAPI_ROOT=../../braintrust-openapi make fetch-openapi-spec
```

To update the snapshot, first update the commit and SHA-256 in `config.json`, then fetch, regenerate,
and review both the upstream spec diff and generated model diff. Fix specification defects upstream
rather than adding Python-side normalization beyond CORS `OPTIONS` removal and configured exclusions.
and review both the upstream spec diff and generated model diff. Only operations selected through
`endpoint_generator.generated_tags` and their reachable schemas are validated and generated.
24 changes: 8 additions & 16 deletions openapi/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,20 @@
"--use-generic-container-types",
"--use-field-description",
"--strict-nullable",
"--parent-scoped-naming",
"--naming-strategy=primary-first",
"--no-use-closed-typed-dict",
"--disable-future-imports",
"--formatters=ruff-format"
]
},
"endpoint_generator": {
"schema_version": 1,
"skip_tags": {
"Proxy": {
"reason": "Proxy endpoints stream provider-specific payloads and remain on the specialized proxy path.",
"operation_ids": [
"proxychatCompletions",
"proxycompletions",
"proxyauto",
"proxyembeddings",
"proxycredentials",
"proxy{path+}"
]
}
},
"generated_tags": [
"Projects"
],
"idempotent_writes": [
"postProject"
],
"supported_success_statuses": [
"200",
"201",
Expand All @@ -52,8 +45,7 @@
"application/json"
],
"supported_response_media_types": [
"application/json",
"text/plain"
"application/json"
]
}
}
Loading