-
Notifications
You must be signed in to change notification settings - Fork 44
Closed
Description
Avro 1.12.0 specifies that UUID logical types annotates to either String or Fixed 16.
The example below serialized the UUID to a String and not a Fixed 16
#[derive(Debug, Serialize, Deserialize)]
struct Comment {
id: Uuid,
}
impl AvroSchema for Comment {
fn get_schema() -> Schema {
Schema::parse_str(
r#"{
"type" : "record",
"name" : "Comment",
"fields" : [ {
"name" : "id",
"type" : {
"type" : "fixed",
"size" : 16,
"logicalType" : "uuid",
"name": "FixedUUID" // if we remove the name attribute schema parsing fail. The name attribute is not in avro 1.12.0 specification
}
} ]
}"#,
)
.expect("Invalid Comment Avro schema")
}
}
let payload = Comment {
id: "de2df598-9948-4988-b00a-a41c0e287398".parse().unwrap(),
};
let mut buffer = Vec::new();
SpecificSingleObjectWriter::<Comment>::with_capacity(10)
.unwrap()
.write_ref(&payload, &mut buffer)
.unwrap();Do you plan to support it in the near future?
Metadata
Metadata
Assignees
Labels
No labels