Skip to content

Commit

Permalink
Call object_from_json from decoder when issubclass(_class, Serializat…
Browse files Browse the repository at this point in the history
…ionMixin)

Summary: As titled. This solves a relatively common problem (which may crop up again in some recently planning changes) in which the init args of some serializable Ax object is itself a serializable Ax object

Differential Revision: D56356035
  • Loading branch information
mpolson64 authored and facebook-github-bot committed Apr 25, 2024
1 parent 859055c commit f3f8025
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ax/storage/json_store/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,14 @@ def object_from_json(
elif isclass(_class) and issubclass(_class, SerializationMixin):
return _class(
**_class.deserialize_init_args(
args=object_json,
args={
key: object_from_json(
object_json=value,
decoder_registry=decoder_registry,
class_decoder_registry=class_decoder_registry,
)
for key, value in object_json.items()
},
decoder_registry=decoder_registry,
class_decoder_registry=class_decoder_registry,
)
Expand Down

0 comments on commit f3f8025

Please sign in to comment.