mashumaro
mashumaro copied to clipboard
Forbid extra option and bubbling up the inner-most exception
Hi,
This does two things:
- Mostly implements #136 (see below)
- Adds a new config option
forbid_extra_keys
, that, well, checks for extra keys during deserialization and fails with a new exception.
Caveats:
- The codecs code is pretty dense, I've tried to understand it without the comments, but do not feel confident enough to apply any changes there => the new features may or may not work for codecs
- I dropped the ball on implementing the full path for sequences. I do not think that their going to be any noticeable performance penalty to track current sequence index, but to implement it, the whole
unpack_collection
must change from an expression generator to a full sub-builder. That's a bit too much for my time constraints;-)
I'd love this to be merged though. I think it adds quite a lot of value already.
Let me know what you think!