Skip to content

Commit f344d14

Browse files
committed
chore(deps): update schemars requirement from 0.8 to 0.9
1 parent abf7c7a commit f344d14

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

crates/rmcp/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ paste = { version = "1", optional = true }
2828
oauth2 = { version = "5.0", optional = true }
2929

3030
# for auto generate schema
31-
schemars = { version = "0.8", optional = true, features = ["chrono"] }
31+
schemars = { version = "0.9", optional = true }
3232

3333
# for image encoding
3434
base64 = { version = "0.22", optional = true }
@@ -134,7 +134,7 @@ schemars = ["dep:schemars"]
134134

135135
[dev-dependencies]
136136
tokio = { version = "1", features = ["full"] }
137-
schemars = { version = "0.8" }
137+
schemars = { version = "0.9" }
138138

139139
anyhow = "1.0"
140140
tracing-subscriber = { version = "0.3", features = [

crates/rmcp/src/handler/server/tool.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::{
33
};
44

55
use futures::future::BoxFuture;
6-
use schemars::JsonSchema;
6+
use schemars::{JsonSchema, transform::AddNullable};
77
use serde::{Deserialize, Serialize, de::DeserializeOwned};
88
use tokio_util::sync::CancellationToken;
99

@@ -14,12 +14,11 @@ use crate::{
1414
};
1515
/// A shortcut for generating a JSON schema for a type.
1616
pub fn schema_for_type<T: JsonSchema>() -> JsonObject {
17-
let mut settings = schemars::r#gen::SchemaSettings::default();
18-
settings.option_nullable = true;
19-
settings.option_add_null_type = false;
20-
settings.definitions_path = "#/components/schemas/".to_owned();
17+
let mut settings = schemars::generate::SchemaSettings::default();
18+
19+
settings.definitions_path = Cow::Borrowed("#/components/schemas/");
2120
settings.meta_schema = None;
22-
settings.visitors = Vec::default();
21+
settings.transforms = vec![Box::new(AddNullable::default())];
2322
settings.inline_subschemas = false;
2423
let generator = settings.into_generator();
2524
let schema = generator.into_root_schema_for::<T>();
@@ -180,11 +179,11 @@ pub struct Parameter<K: ConstString, V>(pub K, pub V);
180179
pub struct Parameters<P>(pub P);
181180

182181
impl<P: JsonSchema> JsonSchema for Parameters<P> {
183-
fn schema_name() -> String {
182+
fn schema_name() -> Cow<'static, str> {
184183
P::schema_name()
185184
}
186185

187-
fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
186+
fn json_schema(generator: &mut schemars::SchemaGenerator) -> schemars::Schema {
188187
P::json_schema(generator)
189188
}
190189
}

examples/servers/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ tracing-subscriber = { version = "0.3", features = [
3333
futures = "0.3"
3434
rand = { version = "0.9", features = ["std"] }
3535
axum = { version = "0.8", features = ["macros"] }
36-
schemars = { version = "0.8", optional = true }
36+
schemars = { version = "0.9", optional = true }
3737
reqwest = { version = "0.12", features = ["json"] }
3838
chrono = "0.4"
3939
uuid = { version = "1.6", features = ["v4", "serde"] }

examples/transport/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ tracing-subscriber = { version = "0.3", features = [
3636
] }
3737
futures = "0.3"
3838
rand = { version = "0.9" }
39-
schemars = { version = "0.8", optional = true }
39+
schemars = { version = "0.9", optional = true }
4040
hyper = { version = "1", features = ["client", "server", "http1"] }
4141
hyper-util = { version = "0.1", features = ["tokio"] }
4242
tokio-tungstenite = "0.26.2"

0 commit comments

Comments
 (0)