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


The following commit(s) were added to refs/heads/main by this push:
     new 70867f1  doc: Document that the fields' order is important for "the 
serde way" (#242)
70867f1 is described below

commit 70867f19d0df3605f921c7f2cd95ef7902cf7891
Author: Martin Grigorov <[email protected]>
AuthorDate: Fri Jul 25 11:07:40 2025 +0300

    doc: Document that the fields' order is important for "the serde way" (#242)
    
    https://github.com/apache/avro-rs/pull/227#issuecomment-3116660601
    
    Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
---
 avro/README.md  | 8 +++++++-
 avro/src/lib.rs | 8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/avro/README.md b/avro/README.md
index 0b2325b..96417b1 100644
--- a/avro/README.md
+++ b/avro/README.md
@@ -268,12 +268,18 @@ writer.append_ser(test).unwrap();
 let encoded = writer.into_inner();
 ```
 
+#### Importance of the fields' order
+
+*Important*: The order of the fields in the struct must match the order of the 
fields in the Avro schema!
+
+#### Simple types
+
 The vast majority of the times, schemas tend to define a record as a top-level 
container
 encapsulating all the values to convert as fields and providing documentation 
for them, but in
 case we want to directly define an Avro value, any type implementing 
`Serialize` should work.
 
 ```rust
-let mut value = "foo".to_string();
+let value = "foo".to_string();
 ```
 
 ### Using codecs to compress data
diff --git a/avro/src/lib.rs b/avro/src/lib.rs
index 225cbc1..6836b73 100644
--- a/avro/src/lib.rs
+++ b/avro/src/lib.rs
@@ -283,12 +283,18 @@
 //! let encoded = writer.into_inner();
 //! ```
 //!
+//! ### Importance of the fields' order
+//!
+//! *Important*: The order of the fields in the struct must match the order of 
the fields in the Avro schema!
+//!
+//! ### Simple types
+//!
 //! The vast majority of the times, schemas tend to define a record as a 
top-level container
 //! encapsulating all the values to convert as fields and providing 
documentation for them, but in
 //! case we want to directly define an Avro value, any type implementing 
`Serialize` should work.
 //!
 //! ```
-//! let mut value = "foo".to_string();
+//! let value = "foo".to_string();
 //! ```
 //!
 //! ## Using codecs to compress data

Reply via email to