martin-g commented on code in PR #477:
URL: https://github.com/apache/avro-rs/pull/477#discussion_r2835167073
##########
avro/src/serde/derive.rs:
##########
@@ -609,6 +678,10 @@ where
) -> Option<Vec<RecordField>> {
None
}
+
+ fn field_default() -> Option<serde_json::Value> {
+ Some(serde_json::Value::Null)
Review Comment:
This should be enough for #434 !
But I still think we should return `None` by default for anything else,
instead of `Some(JsonValue::from(Default::default()))`.
Imagine the developer uses `#[serde(skip_serializing_if=123)]` (or any other
custom value). Then they should face an error that a default should be
specified. Currently we would default to 0 (for a numeric type) while the user
will actually need `123`. So, the user will realize the problem sooner or later
and (s)he will still need to provide `#[avro(default = "123")]` anyway.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]