Kriskras99 commented on code in PR #569:
URL: https://github.com/apache/avro-rs/pull/569#discussion_r3494544564


##########
avro_derive/src/attributes/mod.rs:
##########
@@ -24,14 +24,117 @@ use syn::{AttrStyle, Attribute, Expr, Ident, Path, 
spanned::Spanned};
 mod avro;
 mod serde;
 
+/// What `Schema` representation to generate for a type.
+#[derive(Debug, PartialEq)]
+pub enum Repr {
+    /// Generate a `Schema::Enum` for a `enum`.
+    ///
+    /// Only works for unit variants.
+    Enum,
+    /// Generate a `Schema::Union` for a `enum`.
+    ///
+    /// There can only be one unit variant and every newtype/struct/tuple 
variant must be unique.
+    BareUnion { untagged: bool },
+    /// Generate a `Schema::Union` with a `Schema::Record`  for a `enum`.
+    ///
+    /// This works for every enum as the records will have unique names for 
every variant.
+    UnionOfRecords,
+    /// Generate a `Schema::Record` with a tag and content field for a `enum`.
+    ///
+    /// Requires `#[serde(tag = "...", content = "...")]`.
+    RecordTagContent { tag: String, content: String },
+    /// Generate a `Schema::Record` with a tag field and flattened variant 
fields for a `enum`.
+    ///
+    /// Requires `#[serde(tag = "...")]`
+    RecordInternallyTagged { tag: String },
+}
+
+impl Repr {
+    fn from_avro_and_serde(
+        avro: Option<avro::Repr>,
+        tag: Option<String>,
+        content: Option<String>,
+        untagged: bool,
+        span: Span,
+    ) -> Result<Option<Self>, syn::Error> {
+        match avro {
+            Some(avro::Repr::Enum) => {
+                if tag.is_some() || content.is_some() || untagged {

Review Comment:
   If the list were longer I'd agree, but with only 3 attributes (of which 
untagged conflicts with tag/content) I don't think it's an issue here.



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

Reply via email to