Kriskras99 commented on code in PR #397:
URL: https://github.com/apache/avro-rs/pull/397#discussion_r2687432841
##########
avro_derive/src/attributes/avro.rs:
##########
@@ -137,6 +154,16 @@ pub struct FieldAttributes {
/// [`serde::FieldAttributes::flatten`]:
crate::attributes::serde::FieldAttributes::flatten
#[darling(default)]
pub flatten: bool,
+ /// How to get the schema for this field.
+ ///
+ /// By default uses `<T as AvroSchemaComponent>::get_schema_in_ctxt`.
+ ///
+ /// When it's provided without an argument (`#[avro(with)]`), it will use
the function `get_schema_in_ctxt` defined
+ /// in the same module as the `#[serde(with = "..")]` attribute.
Review Comment:
So what do you think? `with`'s primary usecase in Serde is being able to use
foreign types that don't implement `Serialize`/`Deserialize`.
By having `#[avro(with)]` without an argument use the module that is
provided in `#[serde(with = "..")]`, users can also provide
`get_schema_in_ctxt` without having to repeat the module declaration (and
without us having to support providing a module xor a function as an argument).
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]