Skip to content

feat: Full enum support - #569

Merged
Kriskras99 merged 6 commits into
mainfrom
feat/all_the_enums
Jul 13, 2026
Merged

Kriskras99 merged 6 commits into
mainfrom
feat/all_the_enums

Conversation

@Kriskras99

@Kriskras99 Kriskras99 commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor

No description provided.

@Kriskras99
Kriskras99 marked this pull request as draft June 27, 2026 21:18
@Kriskras99
Kriskras99 force-pushed the feat/all_the_enums branch from 1f70e24 to 739b977 Compare June 27, 2026 21:22
@Kriskras99
Kriskras99 marked this pull request as ready for review June 28, 2026 12:21
@Kriskras99

Copy link
Copy Markdown
Contributor Author

Tests have now been added, so should be ready for review.

There will almost certainly be edgecases that neither of us think of, but we can fix that in a later release.

@Kriskras99 Kriskras99 mentioned this pull request Jun 28, 2026
Comment thread avro_derive/src/attributes/mod.rs Resolved
Comment thread avro_derive/src/enums/bare_union.rs Resolved
Comment thread avro_derive/tests/derive.rs Resolved
Comment thread avro_derive/src/enums/bare_union.rs Resolved
Comment thread avro_derive/src/enums/plain.rs Resolved
Comment thread avro_derive/tests/expanded/mod.rs Resolved
@martin-g martin-g added this to the 0.22.0 milestone Jul 10, 2026
Comment thread avro/src/schema/record/schema.rs Resolved
Comment thread avro_derive/src/enums/mod.rs Resolved
Comment thread avro_derive/src/enums/mod.rs Resolved
Comment thread avro_derive/src/enums/mod.rs Resolved
Comment thread avro_derive/src/enums/mod.rs Resolved
Comment thread avro_derive/src/enums/mod.rs Resolved
Comment thread avro_derive/src/attributes/mod.rs Resolved
Comment thread avro_derive/tests/enum.rs Outdated
"type": "record",
"name": "Alt",
"fields": [],
"org.apache.avro.rust.tuple": true

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.

Why is Alt {} marked as a tuple here ?

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.

It's actually not in the generated schema, this is leftover from when it was Alt(). The test still passes because Schema == Schema does not check attributes. This is not the first time this has bitten us, we should think about changing the behaviour of PartialEq to check for absolute equality and have Schema::specification_eq and Schema::fast_specification_eq functions for the user to do specification related comparisons.

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.

By setting schema_equality.rs:256 false to true I've caught 9 other tests where this happens. I've fixed them all, but cases like these will likely come back in the future when we add more tests.

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.

Maybe we could put a #[cfg(test)] on schema_equality.rs:256 to set the boolean to true for tests.

@Kriskras99
Kriskras99 merged commit 6cfbeec into main Jul 13, 2026
16 checks passed
@Kriskras99
Kriskras99 deleted the feat/all_the_enums branch July 13, 2026 20:59
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