-
Notifications
You must be signed in to change notification settings - Fork 74
Open
Description
👋 Just dropping by to let you know that marshmallow v3 is released.
Upgrading will provide a few benefits for this project:
- You can get rid of places where
load_fromanddump_tomatch, since they've been merged into a single parameter,data_key.
DLWorkspace/src/ClusterManager/job.py
Line 152 in bb8ee5b
| dump_to="jobId", load_from="jobId", |
You could even do automatic camel-casing using this snippet: https://marshmallow.readthedocs.io/en/latest/examples.html#inflection-camel-casing-keys
- You can use the improved
fields.Dictto validate the type of keys and values: https://marshmallow.readthedocs.io/en/stable/api_reference.html#marshmallow.fields.Dict - Performance is significantly improved compared to v2
After skimming the codebase, it looks like the migration will be straightforward.
- Replace usages of
load_fromanddump_towithdata_key. - Update call sites of
JobSchema.load[s]to expect the deserialized data as the return value instead of a tuple. Instead of getting the errors from a tuple, handleValidationErrors.
from marshmallow import ValidationError
try:
job_object = JobSchema.load(job)
except ValidationError as error:
errors = error.messagesMetadata
Metadata
Assignees
Labels
No labels