You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by mg...@apache.org on 2025/11/13 20:24:02 UTC
(avro-rs) 02/05: fix: Allow `resolve_names_with_schemata` to take more kinds of input
This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/avro-rs.git
commit 61a1a46a2de13496d172f705289792551b8ddb9f
Author: Kriskras99 <gi...@kriskras99.nl>
AuthorDate: Wed Nov 12 13:42:16 2025 +0100
fix: Allow `resolve_names_with_schemata` to take more kinds of input
---
avro/src/reader.rs | 6 +++++-
avro/src/schema.rs | 4 ++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/avro/src/reader.rs b/avro/src/reader.rs
index ec7412c..0bacfd8 100644
--- a/avro/src/reader.rs
+++ b/avro/src/reader.rs
@@ -232,7 +232,11 @@ impl<'r, R: Read> Block<'r, R> {
.map(|(name, schema)| (name.clone(), (*schema).clone()))
.collect();
self.writer_schema = Schema::parse_with_names(&json, names)?;
- resolve_names_with_schemata(&self.schemata, &mut self.names_refs, &None)?;
+ resolve_names_with_schemata(
+ self.schemata.iter().copied(),
+ &mut self.names_refs,
+ &None,
+ )?;
} else {
self.writer_schema = Schema::parse(&json)?;
resolve_names(&self.writer_schema, &mut self.names_refs, &None)?;
diff --git a/avro/src/schema.rs b/avro/src/schema.rs
index 5c2996a..8260cc2 100644
--- a/avro/src/schema.rs
+++ b/avro/src/schema.rs
@@ -612,12 +612,12 @@ pub(crate) fn resolve_names(
}
pub(crate) fn resolve_names_with_schemata(
- schemata: &Vec<&Schema>,
+ schemata: impl IntoIterator<Item = impl Borrow<Schema>>,
names: &mut Names,
enclosing_namespace: &Namespace,
) -> AvroResult<()> {
for schema in schemata {
- resolve_names(schema, names, enclosing_namespace)?;
+ resolve_names(schema.borrow(), names, enclosing_namespace)?;
}
Ok(())
}