Skip to content

Conversation

@GavenKam
Copy link
Contributor

PR Info

Changes

Changed blanket implementation in src/entity/active_value.rs: 110, without which the added test cases cause compilation errors on Derive(DeriveIntoActiveModel).

Copy link
Member

@tyt2y3 tyt2y3 left a comment

Choose a reason for hiding this comment

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

thank you, this seems to be the correct fix. I wonder why it hasn't been an issue in the past?

@tyt2y3 tyt2y3 self-requested a review January 24, 2026 14:05
@GavenKam
Copy link
Contributor Author

@tyt2y3 There was an issue #323 before refactoring IntoActiveValue. The focus of discussion was the behavior of Option<V> -> Option<V> - shall Option<V> in an active model represent optional but not null or required but nullable? There was not a final conclusion.
My change makes Option<V>s under all circumstances, no matter Option<V> -> Option<V> or Option<V> -> V, convert into ActiveValue<V>s. If it is the Option<V> -> Option<V> case, ActiveValue<V> is later converted into ActiveValue<Option<V>> back again through ActiveValue<Option<V>>::From<ActiveValue<V>>. However, both cases are affected by the same implementation now.
In current version, the actual behavior of Option<V> in the Option<V> -> Option<V> case is optional but not null. My change do not affect it so it is not a breaking change, but it may not meet your original intention.

@tyt2y3
Copy link
Member

tyt2y3 commented Jan 24, 2026

@GavenKam thank you for the explanation!

@tyt2y3 tyt2y3 merged commit 69b9b46 into SeaQL:master Jan 24, 2026
5 of 31 checks passed
@github-actions
Copy link

🎉 Released In 2.0.0-rc.29 🎉

Huge thanks for the contribution!
This feature has now been released, so it's a great time to upgrade.
Show some love with a ⭐ on our repo, every star counts!

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.

Fail to derive IntoActiveModel trait for a struct that maps Option<V> to V

2 participants