Skip to content

fix: Don't allow serializing bytes as a Uuid::String - #441

Merged
martin-g merged 2 commits into
mainfrom
fix/uuid_bytes_vs_string
Jan 27, 2026
Merged

martin-g merged 2 commits into
mainfrom
fix/uuid_bytes_vs_string

Conversation

@Kriskras99

@Kriskras99 Kriskras99 commented Jan 26, 2026 •

Copy link
Copy Markdown
Contributor

Closes #440

This would silently write unexpected values


assert_eq!(
String::from_utf8_lossy(&buffer),
"�\u{1}'G�8�[\u{4}�H550e8400-e29b-41d4-a716-446655440000"

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.

nit: maybe assert .contains(uuid_str) ?!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The annoying thing about assert!(.contains()) is that you don't see whats wrong if the test does fail

Comment thread avro/tests/serde_human_readable_true.rs Resolved
Comment thread avro/src/serde/ser_schema.rs Resolved
@Kriskras99

Copy link
Copy Markdown
Contributor Author

@martin-g I've improved the error messages, what do you think?

@Kriskras99
Kriskras99 requested a review from martin-g January 26, 2026 21:32
@martin-g
martin-g merged commit 5e23188 into main Jan 27, 2026
@martin-g martin-g added this to the 0.22.0 milestone Jan 27, 2026
@Kriskras99
Kriskras99 deleted the fix/uuid_bytes_vs_string branch January 27, 2026 06:34
@Kriskras99 Kriskras99 mentioned this pull request Jun 28, 2026
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.

Schema type for Uuid type is overridden by set_serde_human_readable() parameter on serialization

2 participants