-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: json schema serializes field metadata #3379
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3379 +/- ##
==========================================
+ Coverage 78.45% 78.49% +0.04%
==========================================
Files 250 250
Lines 90189 90243 +54
Branches 90189 90243 +54
==========================================
+ Hits 70758 70838 +80
+ Misses 16525 16503 -22
+ Partials 2906 2902 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor suggestions but seems ok. I don't really know what we use the JSON serialization for so I'm not sure I can consider all downstream implications.
@@ -172,6 +172,9 @@ pub struct JsonField { | |||
#[serde(rename = "type")] | |||
type_: JsonDataType, | |||
nullable: bool, | |||
|
|||
#[serde(skip_serializing_if = "Option::is_none")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not super important but would it be possible to do skip_serializing_if = "HashMap::is_empty"
and then skip the option? I'm not sure if that is more or less clear.]
Hmm...maybe this won't work on deserialization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking we'd keep this as Option::is_none
as it maintains consistency with how we're currently handling this for schema metadata
Co-authored-by: Weston Pace <[email protected]>
Thanks @westonpace -- fwiw at least once use case we have for Json schema serialization is that lancedb cloud uses it (specifically in the response to calling |
fixes: #3378