Skip to content

feat: Add support for rename of enum variants in AvroSchema macro - #205

Merged
martin-g merged 3 commits into
apache:mainfrom
Vaalla42:feat/support_rename_on_enums
Jun 6, 2025
Merged

martin-g merged 3 commits into
apache:mainfrom
Vaalla42:feat/support_rename_on_enums

Conversation

@Vaalla42

@Vaalla42 Vaalla42 commented Jun 6, 2025

Copy link
Copy Markdown
Contributor

Improve the AvroSchema macro to support #[avro(rename = "new_name")] for enum variants.

Example:

enum A {
    #[avro(rename = "A3")]
    Item1,
}

will generate

Enum(EnumSchema { name: Name { name: "A", namespace: None }, aliases: None, doc: None, symbols: ["A3"], default: None, attributes: {} })

Comment thread avro_derive/src/lib.rs Outdated
for variant in &e.variants {
let field_attrs = VariantOptions::from_attributes(&variant.attrs[..])
.map_err(darling_to_syn)
.unwrap();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use ? instead ?

@martin-g
martin-g merged commit ede27ee into apache:main Jun 6, 2025
@martin-g

martin-g commented Jun 6, 2025

Copy link
Copy Markdown
Member

Thank you, @Vaalla42 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants