Skip to content

Comments

131: Move wrapping of pydantic exceptions for model validate, setattr, and model_validate_json to the S2MessageComponent mixin instead of wrapping it using the decorator to preserve classmethod on inheritence for model_validate.#132

Merged
lfse-slafleur merged 2 commits intomainfrom
131-allow-messages-to-be-inherited
Jul 25, 2025

Conversation

@lfse-slafleur
Copy link
Member

@lfse-slafleur lfse-slafleur commented Jul 25, 2025

See #131 on the motivation

…, and model_validate_json to the S2MessageComponent mixin instead of wrapping it using the decorator to preserve classmethod on inheritence for model_validate.
@lfse-slafleur lfse-slafleur self-assigned this Jul 25, 2025
@lfse-slafleur lfse-slafleur linked an issue Jul 25, 2025 that may be closed by this pull request
@lfse-slafleur lfse-slafleur marked this pull request as ready for review July 25, 2025 10:20
Copy link
Contributor

@MauriceHendrix MauriceHendrix left a comment

Choose a reason for hiding this comment

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

Assuming it works, having the ability to properly inherit is very useful. I actually hadn't seen the raise ... fom construct before, nice one!

@lfse-slafleur
Copy link
Member Author

Assuming it works, having the ability to properly inherit is very useful. I actually hadn't seen the raise ... fom construct before, nice one!

Thanks! I have tested it locally through pip install -e, but your comment is very valid. I will be adding a test case that tests exactly this behavior!

Just in case you are interested: https://docs.python.org/3/tutorial/errors.html#exception-chaining

@lfse-slafleur lfse-slafleur merged commit 51fa849 into main Jul 25, 2025
19 checks passed
@lfse-slafleur lfse-slafleur deleted the 131-allow-messages-to-be-inherited branch July 25, 2025 12:41
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.

Allow messages to be inherited

2 participants