flxo commented on code in PR #439:
URL: https://github.com/apache/avro-rs/pull/439#discussion_r2727656045
##########
avro/src/writer.rs:
##########
@@ -643,7 +643,18 @@ where
self.header_written = true;
}
- bytes_written += write_avro_datum_ref(&self.schema, data, writer)?;
+ // Use the resolved schema names from the inner
GenericSingleObjectWriter
+ // to properly resolve Schema::Ref during serialization
+ let names_ref = self
+ .inner
+ .resolved
+ .get_names()
+ .iter()
Review Comment:
I we need a `NamesRef` and `get_names` return `Names`:
`ResolvedOwnedSchema::get_names()` returns
[Names](https://github.com/apache/avro-rs/blob/6218cd723a02e947c5d799065506a026c92388b5/avro/src/schema/name.rs#L50)
which is the "owned" version `pub type Names = HashMap<Name, Schema>;`.
[SchemaAwareSerializer::new](https://github.com/apache/avro-rs/blob/6218cd723a02e947c5d799065506a026c92388b5/avro/src/serde/ser_schema.rs#L618)
takes a `NamesRef` which is `pub type NamesRef<'a> = HashMap<Name, &'a
Schema>;`.
I haven't found a way to avoid the nasty map duplication. I decided to keep
it in here - it's a onetime thing.
--
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]