Skip to content

Commit 95899ac

Browse files
philipithomasInventrohyder
authored andcommitted
[ENH] Add OpenAPI spec to Rust server (chroma-core#3815)
## Description of changes - Improvements & Bug fixes - Updates `axum` to `0.8` - New functionality - Adds `/openapi.json` route that renders an OpenAPI spec - Adds `/docs/` route that renders Swagger - Adds code generation of OpenAPI spec with [`utoipa`](https://github.com/juhaku/utoipa) - Standardizes path params to be `tenant` (*not tenant_id*) and `database` (*not database_name*) Here's a video demo of how it works: https://github.com/user-attachments/assets/e66d9fc0-8b8b-408f-8b3a-2e975646edf3 Notes: * The routes and basic functionality mirror current Python functionality (see: https://api.trychroma.com:8000/docs) * OpenAPI spec is substantially improved, including: typed errors, typed responses, security headers
1 parent 33fc578 commit 95899ac

File tree

11 files changed

+859
-227
lines changed

11 files changed

+859
-227
lines changed

Cargo.lock

Lines changed: 201 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ members = ["rust/benchmark", "rust/blockstore", "rust/cache", "rust/chroma", "ru
66
[workspace.dependencies]
77
arrow = "52.2.0"
88
async-trait = "0.1"
9-
axum = { version = "0.7", features = ["macros"] }
9+
axum = { version = "0.8", features = ["macros"] }
1010
chrono = { version = "0.4", features = ["serde"] }
1111
clap = { version = "4", features = ["derive"] }
1212
criterion = { version = "0.5", features = ["async_tokio"] }
@@ -38,6 +38,7 @@ tracing-bunyan-formatter = "0.3"
3838
tracing-opentelemetry = "0.28.0"
3939
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
4040
uuid = { version = "1.11.0", features = ["v4", "fast-rng", "macro-diagnostics", "serde"] }
41+
utoipa = { version = "5.0.0", features = ["macros", "axum_extras", "debug", "uuid"] }
4142
sqlx = { version = "0.8.3", features = ["runtime-tokio", "sqlite"] }
4243
sha2 = "0.10.8"
4344
md5 = "0.7.0"

rust/frontend/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,6 @@ chroma-system = { workspace = true }
4242
chroma-tracing = { workspace = true }
4343
chroma-types = { workspace = true }
4444
chroma-sqlite = { workspace = true }
45+
utoipa = { workspace = true }
46+
utoipa-axum = { version = "0.2.0", features = ["debug"] }
47+
utoipa-swagger-ui = { version = "9", features = ["axum"] }

0 commit comments

Comments
 (0)