You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "bryanburgers (via GitHub)" <gi...@apache.org> on 2025/07/23 12:16:07 UTC

[PR] avro_derive: Allow providing a name other than the ident [avro-rs]

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

   (no comment)


-- 
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: dev-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] avro_derive: Allow providing a name other than the ident [avro-rs]

Posted by "martin-g (via GitHub)" <gi...@apache.org>.
martin-g commented on code in PR #239:
URL: https://github.com/apache/avro-rs/pull/239#discussion_r2225461057


##########
avro_derive/tests/derive.rs:
##########
@@ -621,6 +656,55 @@ mod test_derive {
         serde_assert(enum_included);
     }
 
+    #[test]
+    fn test_enum_named() {

Review Comment:
   ```suggestion
       fn avro_rs_239_test_enum_named() {
   ```



##########
avro_derive/tests/derive.rs:
##########
@@ -209,6 +209,41 @@ mod test_derive {
         }
     }
 
+    #[test]
+    fn test_named_record() {

Review Comment:
   ```suggestion
       fn avro_rs_239_test_named_record() {
   ```



-- 
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: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: avro_derive: Allow providing a name other than the ident [avro-rs]

Posted by "martin-g (via GitHub)" <gi...@apache.org>.
martin-g commented on PR #239:
URL: https://github.com/apache/avro-rs/pull/239#issuecomment-3108046015

   Thank you for the contribution, @bryanburgers !


-- 
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: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] avro_derive: Allow providing a name other than the ident [avro-rs]

Posted by "bryanburgers (via GitHub)" <gi...@apache.org>.
bryanburgers commented on code in PR #239:
URL: https://github.com/apache/avro-rs/pull/239#discussion_r2225445281


##########
avro_derive/tests/derive.rs:
##########
@@ -209,6 +209,41 @@ mod test_derive {
         }
     }
 
+    #[test]
+    fn test_named_record() {
+        #[derive(Debug, Serialize, Deserialize, AvroSchema, Clone, PartialEq, Eq)]
+        #[avro(name = "Other", namespace = "com.testing.namespace")]
+        struct TestNamedRecord {
+            a: i32,
+            b: String,
+        }
+
+        let schema = r#"
+        {
+            "type":"record",
+            "name":"com.testing.namespace.Other",
+            "fields":[
+                {
+                    "name":"a",
+                    "type":"int"
+                },
+                {
+                    "name":"b",
+                    "type":"string"
+                }
+            ]
+        }
+        "#;
+        let schema = Schema::parse_str(schema).unwrap();
+        assert_eq!(schema, TestNamedRecord::get_schema());
+        if let Schema::Record(RecordSchema { name, .. }) = TestNamedRecord::get_schema() {
+            assert_eq!("Other".to_owned(), name.name);
+            assert_eq!("com.testing.namespace".to_owned(), name.namespace.unwrap())

Review Comment:
   Oh absolutely! Updated.



-- 
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: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: avro_derive: Allow providing a name other than the ident [avro-rs]

Posted by "martin-g (via GitHub)" <gi...@apache.org>.
martin-g merged PR #239:
URL: https://github.com/apache/avro-rs/pull/239


-- 
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: dev-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: avro_derive: Allow providing a name other than the ident [avro-rs]

Posted by "bryanburgers (via GitHub)" <gi...@apache.org>.
bryanburgers commented on PR #239:
URL: https://github.com/apache/avro-rs/pull/239#issuecomment-3107935261

   Thanks for looking at this so quickly!
   
   Let me know if you’d like me to rebase into a single commit when you’re done reviewing.


-- 
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: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] avro_derive: Allow providing a name other than the ident [avro-rs]

Posted by "Kriskras99 (via GitHub)" <gi...@apache.org>.
Kriskras99 commented on code in PR #239:
URL: https://github.com/apache/avro-rs/pull/239#discussion_r2225430398


##########
avro_derive/tests/derive.rs:
##########
@@ -209,6 +209,41 @@ mod test_derive {
         }
     }
 
+    #[test]
+    fn test_named_record() {
+        #[derive(Debug, Serialize, Deserialize, AvroSchema, Clone, PartialEq, Eq)]
+        #[avro(name = "Other", namespace = "com.testing.namespace")]
+        struct TestNamedRecord {
+            a: i32,
+            b: String,
+        }
+
+        let schema = r#"
+        {
+            "type":"record",
+            "name":"com.testing.namespace.Other",
+            "fields":[
+                {
+                    "name":"a",
+                    "type":"int"
+                },
+                {
+                    "name":"b",
+                    "type":"string"
+                }
+            ]
+        }
+        "#;
+        let schema = Schema::parse_str(schema).unwrap();
+        assert_eq!(schema, TestNamedRecord::get_schema());
+        if let Schema::Record(RecordSchema { name, .. }) = TestNamedRecord::get_schema() {
+            assert_eq!("Other".to_owned(), name.name);
+            assert_eq!("com.testing.namespace".to_owned(), name.namespace.unwrap())

Review Comment:
   ```suggestion
               assert_eq!("Other", name.name.as_str());
               assert_eq!("com.testing.namespace", name.namespace.unwrap().as_str())
   ```
   This is slightly nicer in my opinion



-- 
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: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: avro_derive: Allow providing a name other than the ident [avro-rs]

Posted by "martin-g (via GitHub)" <gi...@apache.org>.
martin-g commented on PR #239:
URL: https://github.com/apache/avro-rs/pull/239#issuecomment-3107944030

   > Let me know if you’d like me to rebase into a single commit when you’re done reviewing.
   
   No need!
   I'll squash it with the merge!


-- 
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: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org