jan-gerling / FLOCKA

1 stars 1 forks source link

WIP: Marshalling #39

Closed pmisteliac closed 3 years ago

pmisteliac commented 5 years ago

!!!! Doesn't work yet !!!! For some reason it still retruns the string representation. In all the examples it somehow magically transforms it to JSON, but these are all simple and don't use commandHandler like we do.

I'll be gone until Sunday, feel free to fuck with it if you need/want.

PSilvestre commented 5 years ago

Hey I managed to fix it for the createUser. From what I understand, the correct Marshaller is brought in implicitly, if you just specify the type of event that youre getting.

Also, think you should make the structure something like: { "event": "UserCreated", "params": { "userId" : 217836143, //other params here if exist } }

This will later on make it easier to unmarshal

pmisteliac commented 5 years ago

@PSilvestre Wow good catch! Type inference can be tricky :) I implemented the marshalling for all user events. However I did not embed the params in a branch but kept the hierarchy flat instead, as I don't see the advantage in creating a hierarchy and it its harder to marshall/unmarshall that way. However it's not clear to me where they get unmarshalled in our API.

pmisteliac commented 5 years ago

Put into the backlog because it is very late to start changing this.