jecsand838 commented on code in PR #8492:
URL: https://github.com/apache/arrow-rs/pull/8492#discussion_r2389954153
##########
arrow-avro/src/schema.rs:
##########
@@ -208,70 +201,81 @@ pub enum ComplexType<'a> {
///
/// <https://avro.apache.org/docs/1.11.1/specification/#schema-record>
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
-pub struct Record<'a> {
+pub(crate) struct Record<'a> {
/// Name of the record
#[serde(borrow)]
- pub name: &'a str,
+ pub(crate) name: &'a str,
/// Optional namespace for the record, provides a way to organize names
#[serde(borrow, default)]
- pub namespace: Option<&'a str>,
+ pub(crate) namespace: Option<&'a str>,
/// Optional documentation string for the record
#[serde(borrow, default)]
- pub doc: Option<&'a str>,
+ pub(crate) doc: Option<Cow<'a, str>>,
/// Alternative names for this record
#[serde(borrow, default)]
- pub aliases: Vec<&'a str>,
+ pub(crate) aliases: Vec<&'a str>,
/// The fields contained in this record
#[serde(borrow)]
- pub fields: Vec<Field<'a>>,
+ pub(crate) fields: Vec<Field<'a>>,
/// Additional attributes for this record
#[serde(flatten)]
- pub attributes: Attributes<'a>,
+ pub(crate) attributes: Attributes<'a>,
+}
+
+fn deserialize_default<'de, D>(deserializer: D) -> Result<Option<Value>,
D::Error>
+where
+ D: serde::Deserializer<'de>,
+{
+ Value::deserialize(deserializer).map(Some)
Review Comment:
This and the change on line 245, ` #[serde(deserialize_with =
"deserialize_default", default)]`, are fixes for **Bug 5: "null" (string) vs.
null (JSON) defaults**
--
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]