Skip to content

Conversation

@Kriskras99
Copy link
Contributor

This commit changes the attribute parsing in #[derive(AvroSchema)] to also use the Serde attributes. It will use the Serde attributes and check that they match the Avro attributes if provided. It will also check that known incompatible Serde attributes result in a compile error instead of a runtime panic.

Testing for the compile errors is done using trybuild. These tests run only on nightly as the output can vary between compiler versions (otherwise MSRV and latest stable could have different outputs and break the entire CI).

For some reason Github closed #373, not sure why. This is the exact same commit.

@Kriskras99 Kriskras99 force-pushed the feat/use_serde_attributes2 branch from 762c230 to 4efa998 Compare December 28, 2025 14:35
This commit changes the attribute parsing in `#[derive(AvroSchema)]` to also use the Serde attributes.
It will use the Serde attributes and check that they match the Avro attributes if provided. It will
also check that known incompatible Serde attributes result in a compile error instead of a runtime panic.

Testing for the compile errors is done using `trybuild`. These tests run only on nightly as the output
can vary between compiler versions (otherwise MSRV and latest stable could have different outputs and break the entire CI).
@Kriskras99 Kriskras99 force-pushed the feat/use_serde_attributes2 branch from 4efa998 to 392ae2c Compare December 28, 2025 14:40
@martin-g
Copy link
Member

A PR has been opened at Derling repo with an example how to parse serde:
https://github.com/TedDriggs/darling/pull/412/changes#diff-9df22bcc91f2a6d5114da4fff9f20353fb0171013e7a7fa385cea38e6130f691

We may borrow something useful from it.

@Kriskras99 Kriskras99 requested a review from martin-g January 5, 2026 10:55
@Kriskras99
Copy link
Contributor Author

I've fixed all the feedback. I've also deprecated #[avro(name = "..")] in favor of #[serde(rename = "..")] and added deprecation warnings on nightly.

@Kriskras99 Kriskras99 force-pushed the feat/use_serde_attributes2 branch from 8bf46c4 to 1d802e5 Compare January 5, 2026 13:51
Copy link
Member

@martin-g martin-g left a comment

Choose a reason for hiding this comment

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

Awesome!

@martin-g martin-g added this to the 0.22.0 milestone Jan 5, 2026
@Kriskras99 Kriskras99 merged commit e6ec382 into main Jan 5, 2026
22 checks passed
@Kriskras99 Kriskras99 deleted the feat/use_serde_attributes2 branch January 5, 2026 13:58
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