Add .load_to_dict method to base schema
Following up on this suggestion made in a comment on #169 (see also #210), this provides a new schema method, .load_to_mapping, that essentially does a raw marshmallow.Schema.load without converting any of the deserialized values (either top-level or nested) to dataclasses. The main point of this is to allow for deserializing partial data (with partial=True).
This PR is provided for discussion, as to:
- whether it's worthwhile
- whether there's a better name for the new method
- whether there's a better way to implement the new method
- ...
I'm ok with that ! Maybe load_to_dict is clearer than load_to_mapping ? Doesn't it always return a dict ?
I'm ok with that ! Maybe
load_to_dictis clearer thanload_to_mapping? Doesn't it always return a dict ?
Yes, that's probably better.
After some digging through the marshmallow source code it appears to always return dict (or OrderedDict) (or a list of those if many is set). I will rename it.