Skip to content

Commit

Permalink
Add comment to explain why we dont call object_from_json from decoder…
Browse files Browse the repository at this point in the history
… when issubclass(_class, SerializationMixin)

Summary: As titled

Reviewed By: bernardbeckerman

Differential Revision: D56356035

fbshipit-source-id: ee1f75671ab358854e67f7910480a9441f7fedfc
  • Loading branch information
mpolson64 authored and facebook-github-bot committed Aug 5, 2024
1 parent 46464a5 commit 6775e8a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ax/storage/json_store/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,11 @@ def object_from_json(
)
elif isclass(_class) and issubclass(_class, SerializationMixin):
return _class(
# Note: we do not recursively call object_from_json here again as
# that would invalidate design principles behind deserialize_init_args.
# Any Ax class that needs serialization and who's init args include
# another Ax class that needs serialization should implement its own
# _to_json and _from_json methods and register them appropriately.
**_class.deserialize_init_args(
args=object_json,
decoder_registry=decoder_registry,
Expand Down

0 comments on commit 6775e8a

Please sign in to comment.