Skip to content

Commit

Permalink
model_dump with mode=json
Browse files Browse the repository at this point in the history
  • Loading branch information
zworkb committed Sep 27, 2023
1 parent 843888c commit 19ea000
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/edutap/wallet_google/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,7 @@ def save_link(
# otherwise it must be a registered model
model = lookup_model_by_plural_name(name)
obj = _validate_data(model, obj)
#the following is a workaround for the fact that the model_dump method
#does not serialize enums, but model_dump_json does
obj_json_str = obj.model_dump_json(exclude_none=True)
obj_json = json.loads(obj_json_str)
obj_json = obj.model_dump(exclude_none=True, mode="json")
payload[name].append(obj_json)
claims = {
"iat": "",
Expand Down

0 comments on commit 19ea000

Please sign in to comment.