flxo opened a new pull request, #439:
URL: https://github.com/apache/avro-rs/pull/439

   ## Summary
   
   Fixes a bug in `SpecificSingleObjectWriter::write_ref()` where `Schema::Ref` 
types failed to resolve during serialization of recursive schemas.
   
   ## Problem
   
   The `write_ref()` method was calling `write_avro_datum_ref()` which created 
a serializer with an empty names map. This caused `Schema::Ref` types to fail 
resolution during serialization, preventing recursive schemas from being 
properly serialized.
   
   ## Solution
   
   Modified `SpecificSingleObjectWriter::write_ref()` to:
   - Use the resolved schema names from the inner `GenericSingleObjectWriter`'s 
`ResolvedOwnedSchema`
   - Pass these names to the serializer, enabling proper `Schema::Ref` 
resolution
   
   Also updated `write_avro_datum_ref()` to create a `ResolvedSchema` from the 
input schema and use its names map instead of an empty map.
   
   ## Test Plan
   
   Added `test_specific_single_object_writer_with_schema_ref()` which:
   - Defines a recursive `Node` schema with a self-referencing field
   - Creates a nested node structure (parent with child)
   - Verifies the writer successfully serializes the recursive structure
   - Validates the serialized output contains both "parent" and "child" values
   
   ## Open questions:
   
   - [ ] This change makes `write_avro_datum_ref` use 
`SchemAwareWriteSerializer` which is probably more expensive than a plain 
`write_avro_datum_ref`. Shall this be part of the MR?
   


-- 
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]

Reply via email to