From 75fdbe4c47380c7bbbeb47eff4f0836e15f954da Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Sep 2026 19:08:19 +0000 Subject: [PATCH 1/2] build(deps): bump schemars from 0.8.22 to 1.2.2 Bumps [schemars](https://github.com/GREsau/schemars) from 0.8.22 to 1.2.2. - [Release notes](https://github.com/GREsau/schemars/releases) - [Changelog](https://github.com/GREsau/schemars/blob/master/CHANGELOG.md) - [Commits](https://github.com/GREsau/schemars/compare/v0.8.22...v1.2.2) --- updated-dependencies: - dependency-name: schemars dependency-version: 1.2.2 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- Cargo.lock | 37 +++++++++++++++++++++++++++++-------- Cargo.toml | 2 +- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7afdcff1..e200b44f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5643,6 +5643,26 @@ dependencies = [ "thiserror 2.0.20", ] +[[package]] +name = "ref-cast" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e440fb4e4b4147295338efb76001ab9e4efc0e5839df2c47fc5ac2381d365c3" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecd8964f8453721699a1ed72037b0db49ce2f5a5138486ee89bed6f67cdf3a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.4", +] + [[package]] name = "regalloc2" version = "0.15.2" @@ -5917,11 +5937,12 @@ dependencies = [ [[package]] name = "schemars" -version = "0.8.22" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615" +checksum = "687274d293b6cdc6e73e0fee520bf2049650090d7164f87672d212a3c530cf4a" dependencies = [ "dyn-clone", + "ref-cast", "schemars_derive", "serde", "serde_json", @@ -5929,14 +5950,14 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.22" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32e265784ad618884abaea0600a9adf15393368d840e0222d101a072f3f7534d" +checksum = "d98c67716b46af2f0b8cf752abc930f6f9aecfbf671ecfb531db8a31dbe4e2ba" dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.119", + "syn 3.0.4", ] [[package]] @@ -6087,13 +6108,13 @@ dependencies = [ [[package]] name = "serde_derive_internals" -version = "0.29.1" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" +checksum = "f852137cce035d6a4df67ccce505ff6b3e9fd3a10e3e52b24dc71e650bb1a9bd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.119", + "syn 3.0.4", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index d908723e..3b0d2834 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -288,7 +288,7 @@ starlark = "0.13" # CLI - MCP rmcp = { version = "0.13", default-features = false } -schemars = "0.8" +schemars = "1.2" # CLI - Utilities time = { version = "0.3", features = ["formatting", "parsing", "local-offset", "macros"] } From 30b28f4e588b556e48e1f0571322e22b525ccb1a Mon Sep 17 00:00:00 2001 From: DroidAgent <154886644+echobt@users.noreply.github.com> Date: Wed, 16 Sep 2026 13:37:29 +0000 Subject: [PATCH 2/2] fix(deps): migrate schemars 0.8 to 1.2 API The 1.2 bump changes two things the workspace relied on: - `JsonSchema::schema_name` returns `Cow<'static, str>`, and the `r#gen` / `schema` modules are gone. `ConversationId`'s manual impl now returns a borrowed name and builds its schema with the `json_schema!` macro, which is the 1.x replacement for `SchemaObject { instance_type, format, .. }`. - `schema_for!` emits nested schemas under `$defs` (JSON Schema 2020-12, the dialect OpenAPI 3.1 uses) instead of draft 7's `definitions`. The app-server's OpenAPI builder unwraps both keys and rewrites either `$ref` prefix into `#/components/schemas/`, so `ToolCallResponse` and the other nested models stay in the document. The checked-in contract is regenerated (numeric `minimum` values lose their `.0`, `required` ordering follows the structs) and the `app-server.md` note names the version that generates it. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> --- docs/reference/app-server.md | 2 +- docs/reference/app-server.openapi.json | 44 +++++++++++----------- src/cortex-app-server/src/api/schema.rs | 11 +++++- src/cortex-protocol/src/conversation_id.rs | 16 ++++---- 4 files changed, 39 insertions(+), 34 deletions(-) diff --git a/docs/reference/app-server.md b/docs/reference/app-server.md index 0e1a2543..7b8460d5 100644 --- a/docs/reference/app-server.md +++ b/docs/reference/app-server.md @@ -30,7 +30,7 @@ the exact trusted browser origins in configuration. ## Contract [OpenAPI 3.1 JSON](app-server.openapi.json) is generated from the handler models -with schemars 0.8.22 and served at authenticated `GET /api/v1/openapi.json`. +with schemars 1.2 and served at authenticated `GET /api/v1/openapi.json`. The supported contract covers: | Method | Path (under `/api/v1`) | Meaning | diff --git a/docs/reference/app-server.openapi.json b/docs/reference/app-server.openapi.json index adc7e1d9..67a2e3d9 100644 --- a/docs/reference/app-server.openapi.json +++ b/docs/reference/app-server.openapi.json @@ -33,7 +33,7 @@ }, "uptime_seconds": { "format": "uint64", - "minimum": 0.0, + "minimum": 0, "type": "integer" }, "version": { @@ -42,8 +42,8 @@ }, "required": [ "status", - "uptime_seconds", - "version" + "version", + "uptime_seconds" ], "title": "HealthResponse", "type": "object" @@ -62,7 +62,7 @@ }, "tokens": { "format": "uint32", - "minimum": 0.0, + "minimum": 0, "type": "integer" }, "tool_calls": { @@ -76,9 +76,9 @@ } }, "required": [ - "content", "id", "role", + "content", "tokens" ], "title": "MessageResponse", @@ -90,47 +90,47 @@ "active_sessions": { "description": "Active sessions.", "format": "uint", - "minimum": 0.0, + "minimum": 0, "type": "integer" }, "errors": { "description": "Errors.", "format": "uint64", - "minimum": 0.0, + "minimum": 0, "type": "integer" }, "rate_limit_hits": { "description": "Rate limit hits.", "format": "uint64", - "minimum": 0.0, + "minimum": 0, "type": "integer" }, "sessions_created": { "description": "Sessions created.", "format": "uint64", - "minimum": 0.0, + "minimum": 0, "type": "integer" }, "total_requests": { "description": "Total requests.", "format": "uint64", - "minimum": 0.0, + "minimum": 0, "type": "integer" }, "uptime_seconds": { "description": "Server uptime in seconds.", "format": "uint64", - "minimum": 0.0, + "minimum": 0, "type": "integer" } }, "required": [ + "uptime_seconds", "active_sessions", - "errors", + "total_requests", "rate_limit_hits", "sessions_created", - "total_requests", - "uptime_seconds" + "errors" ], "title": "MetricsSnapshot", "type": "object" @@ -163,7 +163,7 @@ }, "message_count": { "format": "uint", - "minimum": 0.0, + "minimum": 0, "type": "integer" }, "model": { @@ -174,15 +174,15 @@ }, "total_tokens": { "format": "uint64", - "minimum": 0.0, + "minimum": 0, "type": "integer" } }, "required": [ "id", - "message_count", "model", "status", + "message_count", "total_tokens" ], "title": "SessionListItem", @@ -196,7 +196,7 @@ }, "message_count": { "format": "uint", - "minimum": 0.0, + "minimum": 0, "type": "integer" }, "metadata": true, @@ -214,15 +214,15 @@ }, "total_tokens": { "format": "uint64", - "minimum": 0.0, + "minimum": 0, "type": "integer" } }, "required": [ "id", - "message_count", "model", "status", + "message_count", "total_tokens" ], "title": "SessionResponse", @@ -246,9 +246,9 @@ } }, "required": [ - "arguments", "id", - "name" + "name", + "arguments" ], "type": "object" } diff --git a/src/cortex-app-server/src/api/schema.rs b/src/cortex-app-server/src/api/schema.rs index 9a518f1e..4d6868bd 100644 --- a/src/cortex-app-server/src/api/schema.rs +++ b/src/cortex-app-server/src/api/schema.rs @@ -9,12 +9,19 @@ fn add(schemas: &mut Map, name: &str) { let schema = schemars::schema_for!(T); let encoded = serde_json::to_string(&schema) .expect("Serializable schema") + .replace("#/$defs/", "#/components/schemas/") .replace("#/definitions/", "#/components/schemas/"); let mut value: Value = serde_json::from_str(&encoded).expect("Generated schema JSON"); let object = value.as_object_mut().expect("Schema object"); object.remove("$schema"); - if let Some(Value::Object(definitions)) = object.remove("definitions") { - schemas.extend(definitions); + // schemars 1.x emits nested schemas under `$defs` (JSON Schema 2020-12, + // the dialect OpenAPI 3.1 uses); 0.8 emitted `definitions` (draft 7). + // Both are unwrapped into the document's `components.schemas` map, which + // the `$ref` rewrite above points at. + for key in ["$defs", "definitions"] { + if let Some(Value::Object(nested)) = object.remove(key) { + schemas.extend(nested); + } } schemas.insert(name.to_string(), value); } diff --git a/src/cortex-protocol/src/conversation_id.rs b/src/cortex-protocol/src/conversation_id.rs index c8d72bb7..9de9cbae 100644 --- a/src/cortex-protocol/src/conversation_id.rs +++ b/src/cortex-protocol/src/conversation_id.rs @@ -1,11 +1,10 @@ //! Conversation identifier type. +use std::borrow::Cow; use std::fmt; use std::str::FromStr; -use schemars::JsonSchema; -use schemars::r#gen::SchemaGenerator; -use schemars::schema::{InstanceType, Schema, SchemaObject}; +use schemars::{JsonSchema, Schema, SchemaGenerator, json_schema}; use serde::{Deserialize, Serialize}; use uuid::Uuid; @@ -15,15 +14,14 @@ use uuid::Uuid; pub struct ConversationId(Uuid); impl JsonSchema for ConversationId { - fn schema_name() -> String { - "ConversationId".to_string() + fn schema_name() -> Cow<'static, str> { + Cow::Borrowed("ConversationId") } fn json_schema(_gen: &mut SchemaGenerator) -> Schema { - Schema::Object(SchemaObject { - instance_type: Some(InstanceType::String.into()), - format: Some("uuid".to_string()), - ..Default::default() + json_schema!({ + "type": "string", + "format": "uuid", }) } }