Skip to content

Commit 6775e8a

Browse files
mpolson64facebook-github-bot
authored andcommitted
Add comment to explain why we dont call object_from_json from decoder when issubclass(_class, SerializationMixin)
Summary: As titled Reviewed By: bernardbeckerman Differential Revision: D56356035 fbshipit-source-id: ee1f75671ab358854e67f7910480a9441f7fedfc
1 parent 46464a5 commit 6775e8a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ax/storage/json_store/decoder.py

+5
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,11 @@ def object_from_json(
270270
)
271271
elif isclass(_class) and issubclass(_class, SerializationMixin):
272272
return _class(
273+
# Note: we do not recursively call object_from_json here again as
274+
# that would invalidate design principles behind deserialize_init_args.
275+
# Any Ax class that needs serialization and who's init args include
276+
# another Ax class that needs serialization should implement its own
277+
# _to_json and _from_json methods and register them appropriately.
273278
**_class.deserialize_init_args(
274279
args=object_json,
275280
decoder_registry=decoder_registry,

0 commit comments

Comments
 (0)