You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by GitBox <gi...@apache.org> on 2022/11/10 16:34:09 UTC

[GitHub] [avro] spiegela opened a new pull request, #1950: AVRO-3664: [rust] Add Rust Avro Value conversion derive implementations

spiegela opened a new pull request, #1950:
URL: https://github.com/apache/avro/pull/1950

   ## What is the purpose of the change
   
   This change improves Avro rust library usability, adding type conversions directly to/from a user struct or enum into a `apache_avro::types::Value`. Specifically it adds the following elements:
   * `AvroValue` trait to add `TryFrom<Value> for ...` and `From<X> for Value`
   * A derive macro for `AvroValue` supporting both basic and complex field schemas
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   - Added unit tests to check derive macro compilation in `rust/avro/derive` crate
   
   ## Documentation
   
   - Does this pull request introduce a new feature? **yes**
   - If yes, how is the feature documented? Doc comments added to `rust/avro/derive` crate
   


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


[GitHub] [avro] martin-g closed pull request #1950: AVRO-3664: [rust] Add Rust Avro Value conversion derive implementations

Posted by GitBox <gi...@apache.org>.
martin-g closed pull request #1950: AVRO-3664: [rust] Add Rust Avro Value conversion derive implementations
URL: https://github.com/apache/avro/pull/1950


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


[GitHub] [avro] spiegela commented on pull request #1950: AVRO-3664: [rust] Add Rust Avro Value conversion derive implementations

Posted by GitBox <gi...@apache.org>.
spiegela commented on PR #1950:
URL: https://github.com/apache/avro/pull/1950#issuecomment-1311001767

   > I wonder whether all this is worth it. There is a lot of new complex code (proc macros!) for something that one could easily get with `apache_avro::to_value(x)` and `apache_avro::from_value(value)`.
   
   Yeah, I tested it out a bunch, and I think you're correct. I was in the weeds, of my project and didn't look up at the docs. I just got it into my head that everything had to implement those conversion traits.


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


[GitHub] [avro] martin-g commented on a diff in pull request #1950: AVRO-3664: [rust] Add Rust Avro Value conversion derive implementations

Posted by GitBox <gi...@apache.org>.
martin-g commented on code in PR #1950:
URL: https://github.com/apache/avro/pull/1950#discussion_r1019539110


##########
lang/rust/avro/src/error.rs:
##########
@@ -238,6 +244,9 @@ pub enum Error {
     #[error("JSON value {0} claims to be i64 but cannot be converted")]
     GetI64FromJson(serde_json::Number),
 
+    #[error("Failed to convert from type to apache_avro::types::Value")]

Review Comment:
   The type (`0`) should be printed with the message



##########
lang/rust/avro_derive/src/lib.rs:
##########
@@ -139,9 +226,9 @@ fn get_data_struct_schema_def(
                     Some(default_value) => {
                         let _: serde_json::Value = serde_json::from_str(&default_value[..])
                             .map_err(|e| {
-                                vec![Error::new(
+                                vec![syn::Error::new(
                                     field.ident.span(),
-                                    format!("Invalid avro default json: \n{}", e),
+                                    format!("Invalid avro default json: \n{e}"),

Review Comment:
   The minimum supported version (1.54) does not support this syntax.



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


[GitHub] [avro] martin-g commented on pull request #1950: AVRO-3664: [rust] Add Rust Avro Value conversion derive implementations

Posted by GitBox <gi...@apache.org>.
martin-g commented on PR #1950:
URL: https://github.com/apache/avro/pull/1950#issuecomment-1311326364

   I am glad you agree!
   I am going to close the PR and the JIRA ticket but still I want to thank you for the time you spend on apache_avro!


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