Skip to content

Conversation

@eamartin
Copy link

@eamartin eamartin commented Jan 7, 2025

When forbid_unknown_fields is True, then errors are raised for unknown
fields on all Structs, dataclasses, and TypedDicts.

When forbid_unknown_fields is False, then errors for unknown fields
are only raised on Structs defined with forbid_unknown_fields=True.

When forbid_unknown_fields is True, then errors are raised for unknown fields on all Structs, dataclasses, and TypedDicts. When forbid_unknown_fields is False, then errors for unknown fields are only raised on Structs defined with forbid_unknown_fields=True.
@dhirschfeld
Copy link

This would be very useful!

I'm just now running into a situation where I want to ignore unknown fields when calling msgspec.convert to create a Struct which has been defined with forbid_unknown_fields=True.

@return42
Copy link

return42 commented Oct 4, 2025

@jcrist do you see a chance, we get this useful feature merged into one of the next releases?

update: sorry for the noise / to late I have seen, we already have forbid_unknown_fields=True in the msgspec.Struct.

@eamartin eamartin mentioned this pull request Oct 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants