Skip to content

Commit 3c6ebb4

Browse files
committed
feat(model): add json schema generation support for all model types
This commit adds JSON Schema support for all model types by implementing `schemars::JsonSchema` trait. The feature is gated behind the new `schemars` feature flag. This enables automatic schema generation for API documentation and validation purposes. Added tests to verify schema generation for client and server JSON-RPC messages.
1 parent 5d92061 commit 3c6ebb4

File tree

13 files changed

+3033
-1
lines changed

13 files changed

+3033
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ See [examples](examples/README.md)
192192
- `client`: use client side sdk
193193
- `server`: use server side sdk
194194
- `macros`: macros default
195+
- `schemars`: implement `JsonSchema` for all model structs
195196

196197
### Transports
197198

crates/rmcp/Cargo.toml

Lines changed: 2 additions & 1 deletion
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 }
31+
schemars = { version = "0.8", optional = true, features = ["chrono"] }
3232

3333
# for image encoding
3434
base64 = { version = "0.21", optional = true }
@@ -89,6 +89,7 @@ tower = ["dep:tower-service"]
8989
__auth = ["dep:oauth2", "dep:reqwest", "dep:url"]
9090
auth = ["__auth", "reqwest?/rustls-tls"]
9191
auth-tls-no-provider = ["auth", "reqwest?/rustls-tls-no-provider"]
92+
schemars = ["dep:schemars"]
9293

9394
[dev-dependencies]
9495
tokio = { version = "1", features = ["full"] }

0 commit comments

Comments
 (0)