This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch extract_record_schema_in_its_own_module
in repository https://gitbox.apache.org/repos/asf/avro-rs.git

commit 25242a124afbd9ed1f34617d7c5efc8a07db892a
Author: Martin Tzvetanov Grigorov <[email protected]>
AuthorDate: Mon Jan 19 10:30:41 2026 +0200

    chore: Extract RecordSchema into its own module 
(src/schema/record/schema.rs)
---
 avro/src/schema/mod.rs           | 36 ++++------------------------
 avro/src/schema/record/mod.rs    |  4 ++++
 avro/src/schema/record/schema.rs | 51 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 59 insertions(+), 32 deletions(-)

diff --git a/avro/src/schema/mod.rs b/avro/src/schema/mod.rs
index 184e2c9..25319f7 100644
--- a/avro/src/schema/mod.rs
+++ b/avro/src/schema/mod.rs
@@ -41,7 +41,10 @@ use std::{
 use strum_macros::{Display, EnumDiscriminants};
 
 mod record;
-pub use crate::schema::record::{RecordField, RecordFieldBuilder, 
RecordFieldOrder};
+use crate::schema::record::RecordSchemaParseLocation;
+pub use crate::schema::record::{
+    RecordField, RecordFieldBuilder, RecordFieldOrder, RecordSchema, 
RecordSchemaBuilder,
+};
 
 /// Represents an Avro schema fingerprint
 /// More information about Avro schema fingerprints can be found in the
@@ -640,27 +643,6 @@ pub(crate) fn resolve_names_with_schemata(
     Ok(())
 }
 
-/// A description of a Record schema.
-#[derive(bon::Builder, Debug, Clone)]
-pub struct RecordSchema {
-    /// The name of the schema
-    pub name: Name,
-    /// The aliases of the schema
-    #[builder(default)]
-    pub aliases: Aliases,
-    /// The documentation of the schema
-    #[builder(default)]
-    pub doc: Documentation,
-    /// The set of fields of the schema
-    pub fields: Vec<RecordField>,
-    /// The `lookup` table maps field names to their position in the `Vec`
-    /// of `fields`.
-    pub lookup: BTreeMap<String, usize>,
-    /// The custom attributes of the schema
-    #[builder(default = BTreeMap::new())]
-    pub attributes: BTreeMap<String, Value>,
-}
-
 /// A description of an Enum schema.
 #[derive(bon::Builder, Debug, Clone)]
 pub struct EnumSchema {
@@ -915,16 +897,6 @@ fn parse_json_integer_for_decimal(value: 
&serde_json::Number) -> Result<DecimalM
     })
 }
 
-#[derive(Debug, Default)]
-enum RecordSchemaParseLocation {
-    /// When the parse is happening at root level
-    #[default]
-    Root,
-
-    /// When the parse is happening inside a record field
-    FromField,
-}
-
 #[derive(Default)]
 pub(crate) struct Parser {
     input_schemas: HashMap<Name, Value>,
diff --git a/avro/src/schema/record/mod.rs b/avro/src/schema/record/mod.rs
index 9ba59f5..0d1c5a1 100644
--- a/avro/src/schema/record/mod.rs
+++ b/avro/src/schema/record/mod.rs
@@ -17,3 +17,7 @@
 
 mod field;
 pub use field::{RecordField, RecordFieldBuilder, RecordFieldOrder};
+
+mod schema;
+pub(crate) use schema::RecordSchemaParseLocation;
+pub use schema::{RecordSchema, RecordSchemaBuilder};
diff --git a/avro/src/schema/record/schema.rs b/avro/src/schema/record/schema.rs
new file mode 100644
index 0000000..28a30a6
--- /dev/null
+++ b/avro/src/schema/record/schema.rs
@@ -0,0 +1,51 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use crate::schema::{Aliases, Documentation, Name, RecordField};
+use serde_json::Value;
+use std::collections::BTreeMap;
+
+/// A description of a Record schema.
+#[derive(bon::Builder, Debug, Clone)]
+pub struct RecordSchema {
+    /// The name of the schema
+    pub name: Name,
+    /// The aliases of the schema
+    #[builder(default)]
+    pub aliases: Aliases,
+    /// The documentation of the schema
+    #[builder(default)]
+    pub doc: Documentation,
+    /// The set of fields of the schema
+    pub fields: Vec<RecordField>,
+    /// The `lookup` table maps field names to their position in the `Vec`
+    /// of `fields`.
+    pub lookup: BTreeMap<String, usize>,
+    /// The custom attributes of the schema
+    #[builder(default = BTreeMap::new())]
+    pub attributes: BTreeMap<String, Value>,
+}
+
+#[derive(Debug, Default)]
+pub(crate) enum RecordSchemaParseLocation {
+    /// When the parse is happening at root level
+    #[default]
+    Root,
+
+    /// When the parse is happening inside a record field
+    FromField,
+}

Reply via email to