-
Notifications
You must be signed in to change notification settings - Fork 401
Closed
Labels
T-bugBug fixes and error correctionsBug fixes and error corrections
Description
Expected behavior
should run
Additional context
Using tauri app. My app launch untill i add: rmcp = { version = "0.1", features = ["server"] }
to my cargo
Logs
error[E0433]: failed to resolve: could not find `SchemaGenerator` in `schemars`
--> C:\Users\alexispace\.cargo\bin\registry\src\index.crates.io-1949cf8c6b5b557f\rmcp-0.1.5\src\handler\server\tool.rs:17:28
|
17 | let schema = schemars::SchemaGenerator::default().into_root_schema_for::<T>();
| ^^^^^^^^^^^^^^^ could not find `SchemaGenerator` in `schemars`
|
help: consider importing one of these structs
|
1 + use crate::schemars::r#gen::SchemaGenerator;
|
1 + use schemars::r#gen::SchemaGenerator;
|
help: if you import `SchemaGenerator`, refer to it directly
|
17 - let schema = schemars::SchemaGenerator::default().into_root_schema_for::<T>();
17 + let schema = SchemaGenerator::default().into_root_schema_for::<T>();
I changed this:
/// A shortcut for generating a JSON schema for a type.
pub fn schema_for_type<T: JsonSchema>() -> JsonObject {
let schema = schemars::SchemaGenerator::default().into_root_schema_for::<T>();
let object = serde_json::to_value(schema).expect("failed to serialize schema");
match object {
serde_json::Value::Object(object) => object,
_ => panic!("unexpected schema value"),
}
}
to this:
use crate::schemars::r#gen::SchemaGenerator;
/// A shortcut for generating a JSON schema for a type.
pub fn schema_for_type<T: JsonSchema>() -> JsonObject {
let schema = SchemaGenerator::default().into_root_schema_for::<T>();
let object = serde_json::to_value(schema).expect("failed to serialize schema");
match object {
serde_json::Value::Object(object) => object,
_ => panic!("unexpected schema value"),
}
}
and it compiled
Metadata
Metadata
Assignees
Labels
T-bugBug fixes and error correctionsBug fixes and error corrections