Skip to content

Conversation

@chriselion
Copy link
Contributor

Summary

Fixes #152

This passes ignore_unknown_fields to _value_from_dict(), and passes that to msg_cls.from_dict().

Note that if you're worried about this being a maintenance problem if more parameters are added to from_dict(), I think I can update it to use https://docs.python.org/3/library/typing.html#typing.Unpack to define the from_dict() args, but that might be overkill for now.

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • This PR fixes an issue: ignore_unknown_fields argument to Message.from_dict() is not propagated #152
  • This PR adds something new (e.g. new method or parameters) - technically it's new parameters, but for internal methods.
    • This change has an associated test.
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

@AdrienVannson
Copy link
Contributor

Thank you for the PR!

I didn't know about Unpack, I agree it's not really needed here but it should be helpful in other parts of the code!

@AdrienVannson AdrienVannson merged commit 0b9cbce into betterproto:main Oct 8, 2025
14 checks passed
@nicolasalt
Copy link

Thanks for the fix! When should we expect a release containing this change? Thanks!

@chriselion
Copy link
Contributor Author

@nicolasalt - I'm not sure what the release schedule/process is.

@AdrienVannson
Copy link
Contributor

I've just released a new version, thank you!

@nicolasalt
Copy link

Thanks a lot, Adrien!

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.

ignore_unknown_fields argument to Message.from_dict() is not propagated

3 participants