Skip to content

Conversation

@Kriskras99
Copy link
Contributor

In Avro 1.12 official support for the fixed type was added for the logical type uuid. avro-rs had a different interpretation of that and would rewrite it to a bytes type.

To remain compatible with the legacy implementation, avro-rs now supports string, fixed, and bytes. bytes does not match spec, but does allow users to read already encoded data.

This is a severe breaking change, although only for people who only use avro-rs (the legacy encoding did not, and still does not work with other languages).

I've also reworked Schema::Decimal to use a similar setup as Schema::Uuid which saves a Box and does not make the type bigger.

@Kriskras99
Copy link
Contributor Author

I think this is ready to merge now

@martin-g martin-g changed the title Support fixed as type for uuid feat: Support fixed as type for uuid Dec 8, 2025
@Kriskras99
Copy link
Contributor Author

I've rebased this PR on main

@Kriskras99
Copy link
Contributor Author

Merge conflict resolved.
@martin-g is there anything that still needs to be resolved before we can merge this PR and #342?

@Kriskras99 Kriskras99 force-pushed the uuid branch 2 times, most recently from bbd66d7 to 86b4128 Compare December 18, 2025 14:24
@Kriskras99
Copy link
Contributor Author

All feedback has been resolved @martin-g

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds official support for the fixed type as an underlying type for the uuid logical type, aligning with Avro 1.12 specification. The changes maintain backward compatibility with the legacy bytes encoding used in versions 0.21.0 and earlier.

Key changes:

  • Introduces UuidSchema enum to support string, fixed, and legacy bytes variants for UUID
  • Refactors Schema::Decimal to use InnerDecimalSchema enum instead of Box<Schema>, reducing memory overhead
  • Updates encoding, decoding, validation, and compatibility logic across all UUID variants

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
avro/src/schema.rs Adds UuidSchema and InnerDecimalSchema enums; updates schema parsing, serialization, and name resolution
avro/src/encode.rs Updates encoding logic for all UUID variants and decimal with new inner schema
avro/src/decode.rs Updates decoding logic for all UUID variants and decimal with new inner schema
avro/src/types.rs Updates value validation and resolution for UUID and decimal variants
avro/src/schema_equality.rs Adds equality comparison for UUID and decimal variant combinations
avro/src/schema_compatibility.rs Implements compatibility checks for UUID variants in reader/writer schemas
avro/src/serde/ser_schema.rs Updates schema-aware serialization for UUID and decimal variants
avro/tests/serde_human_readable_true.rs Renames test and updates from fixed to string UUID type
avro/tests/serde_human_readable_false.rs Updates comment and assertion for fixed UUID encoding
avro/src/writer.rs Updates decimal test cases to use new InnerDecimalSchema

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Kriskras99
Copy link
Contributor Author

All feedback has been resolved @martin-g (including copilot feedback)

@Kriskras99 Kriskras99 merged commit 0d7f8d7 into main Dec 22, 2025
20 checks passed
@Kriskras99 Kriskras99 deleted the uuid branch December 22, 2025 14:40
@Kriskras99
Copy link
Contributor Author

Thank you for all the work in reviewing this!

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