You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
annotations should be in serialisation, they would be added on top of instance_vars responsible for serialisation/deserialisation. There are two case scenarios
This module currently relies on implementing an intermediary Assigner class, and then re-assigning the individual props to the original class. This is slightly slower than deserialising directly into the original class. We can implement this first, and then apply the annotations on top of the instance_vars. Afterwards, we need to add @[JSON::Field(ignore: true)] for all irrelevant instance_vars. We would also need to declare json_deserialise keys as instance_vars instead of instance_vars_column which are the standard instance_vars name currently.
This is highly complicated, preferably implement (a) first, and then (b) since (a) is easier.
Step 2. Currently Clear has a built-in #to_jsonmethod, therefore there will be no effect of annotations on #to_json (only #from_json). To fix this, after implementing step 1, if we want to use the #to_json from the JSON::Serializable module in STDLIB in order to allow the annotations passed in to have effect on #to_json, we need to override this built-in #to_json method with the STDLIB method.
The text was updated successfully, but these errors were encountered:
Step 1. Update
macro column
to accept annotations arg, similar to this PRannotations
should be in serialisation, they would be added on top of instance_vars responsible for serialisation/deserialisation. There are two case scenariosScenario (a) Keep using Clear::Model::JSONDeserialize
Add the
annotations
on top of assigner's instance_varScenario (b) Reimplement Clear::Model::JSONDeserialize
This module currently relies on implementing an intermediary Assigner class, and then re-assigning the individual props to the original class. This is slightly slower than deserialising directly into the original class. We can implement this first, and then apply the annotations on top of the instance_vars. Afterwards, we need to add @[JSON::Field(ignore: true)] for all irrelevant instance_vars. We would also need to declare json_deserialise keys as instance_vars instead of instance_vars_column which are the standard instance_vars name currently.
This is highly complicated, preferably implement (a) first, and then (b) since (a) is easier.
Step 2. Currently Clear has a built-in
#to_json
method, therefore there will be no effect of annotations on#to_json
(only#from_json
). To fix this, after implementing step 1, if we want to use the#to_json
from the JSON::Serializable module in STDLIB in order to allow the annotations passed in to have effect on#to_json
, we need to override this built-in#to_json
method with the STDLIB method.The text was updated successfully, but these errors were encountered: