Skip to content

fix: change NumberSchema numeric fields from i64 to f64 - #113

Merged
hashemix merged 1 commit into
mainfrom
fix/number-schema-f64-type
Jun 21, 2026
Merged

fix: change NumberSchema numeric fields from i64 to f64#113
hashemix merged 1 commit into
mainfrom
fix/number-schema-f64-type

Conversation

@hashemix

Copy link
Copy Markdown
Member

📌 Summary

Change NumberSchema numeric fields (default, maximum, minimum) from i64 to f64 to correctly represent JSON number values, which can include floating-point numbers.

🔍 Related Issues

The NumberSchema struct (and the corresponding schema_utils deserialization logic) used i64 for default, maximum, and minimum fields. Per the JSON Schema specification, the number type includes floating-point values, so these fields should be f64, not i64. Using i64 would cause silent truncation or deserialization failures when non-integer values are encountered.

✨ Changes Made

  • Changed NumberSchema.{default, maximum, minimum} from Option<i64> to Option<f64> in src/generated_schema/2025_11_25/mcp_schema.rs
  • Changed NumberSchema.{default, maximum, minimum} from Option<i64> to Option<f64> in src/generated_schema/draft/mcp_schema.rs
  • Updated schema utility parsing from as_i64() to as_f64() in both src/generated_schema/2025_11_25/schema_utils.rs and src/generated_schema/draft/schema_utils.rs

💡 Additional Notes

  • Potentially breaking: any code that destructures or constructs NumberSchema with integer literals will need type annotations or .into() conversions.

@hashemix
hashemix merged commit 9459ed8 into main Jun 21, 2026
2 checks passed
@hashemix hashemix mentioned this pull request Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant