-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
We should add support for deserlization callbacks, something like
interface Deserializable {
beforeDeserialize(event);
afterDeserialize(event);
}
class Foo implements Deserializable {
attr1: string;
@DeserializeAs(Bar)
attr2: Bar;
beforeDeserialize(event) {
event.json.attr1 = event.json.attr1 + '-modified';
}
afterDeserialize(event) {
event.target.attr2.setSomething(event.json.something);
}
}We should also support function in place of class inside @DeserializeAs decorator.
const myFunc = (json) => {
return json.someAttr + ' - ' + json.someOtherAttr;
}
class Foo {
attr1: string;
@DeserializeAs(myFunc)
attr2: Bar;
}All the proposed signature are fakes
Reactions are currently unavailable