fix(shemars): use JSON Schema 2020-12 as Default Dialect#549
fix(shemars): use JSON Schema 2020-12 as Default Dialect#549jokemanfire merged 1 commit intomodelcontextprotocol:mainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR updates the JSON Schema generation to use the 2020-12 dialect instead of draft-07, aligning with recent updates to the Model Context Protocol specification (referenced in PR #655).
Key Changes:
- Updated schema generation from
draft07()todraft2020_12()with removal of theAddNullabletransform (now handled automatically) - Updated schemars dev-dependency to version 1.1.0 to support the new draft
- Refactored test to verify complete schema output instead of just checking enum count
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/rmcp/src/handler/server/common.rs | Updated schema generation to use draft2020_12 and removed AddNullable transform |
| crates/rmcp/tests/test_complex_schema.rs | Enhanced test with complete schema validation matching 2020-12 format ($defs instead of definitions) |
| crates/rmcp/Cargo.toml | Updated schemars dev-dependency to version 1.1.0 |
| README.md | Added documentation about JSON Schema 2020-12 requirement |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - [serde required](https://github.com/serde-rs/serde) | ||
|
|
||
| Json Schema generation(Must follow the 2020-12 version): | ||
| - [shemars required](https://github.com/GREsau/schemars) |
There was a problem hiding this comment.
Typo in "shemars" - should be "schemars".
| - [shemars required](https://github.com/GREsau/schemars) | |
| - [schemars required](https://github.com/GREsau/schemars) |
| [dev-dependencies] | ||
| tokio = { version = "1", features = ["full"] } | ||
| schemars = { version = "1.0", features = ["chrono04"] } | ||
| schemars = { version = "1.1.0", features = ["chrono04"] } |
There was a problem hiding this comment.
The dev-dependency for schemars is being updated to version 1.1.0, but the main dependency at line 32 remains at version 1.0. This creates a version mismatch that could lead to compilation issues or unexpected behavior. Since draft2020_12() requires schemars 1.1.0+, the main dependency should also be updated to match.
Consider updating the main dependency to:
schemars = { version = "1.1.0", optional = true, features = ["chrono04"] }There was a problem hiding this comment.
@jokemanfire Looks like something to look at if we need the bump across the board?
There was a problem hiding this comment.
Trace it in #182 , there should still be some work to be done here, and we may introduce some broken change.
|
Optional data I need to confirm |
…tprotocol#549) TODO: Not fully compatible with 2020-12 yet.
The spec has update.
Motivation and Context
How Has This Been Tested?
Breaking Changes
Types of changes
Checklist
Additional context