qri-io / qri

you're invited to a data party!
https://qri.io
GNU General Public License v3.0
1.1k stars 66 forks source link

refactor(event): align serialization properties with the rest #1990

Closed Arqu closed 2 years ago

Arqu commented 2 years ago

Event's are breaking out of our default pattern for naming fields when serialized. However due to a lot of these events being user and/or stored elsewhere we need to be able to deserialize either for backwards compatibility.

Fixes https://github.com/qri-io/qri/issues/1989

ramfox commented 2 years ago

There is one other place we should consider changing:

https://github.com/qri-io/qri/blob/e499860785d74ecd30f5b8d675096b6f134fb1a3/lib/websocket/websocket.go#L106-L114

This is how we serialize events over the websockets. I'm proposing we change these to match the way we serialize our other events (namely, change "ts" => "timestamp" & "data" => "payload"), that way all our event serialization uses the same fields. This will force a refactor on frontend (@chriswhong @boandriy), but I think it will be better in the long run.

Arqu commented 2 years ago

Agree with Kasey here, we should continue the same naming conventions to frontend as are on the back end. I'll ping/file and issue on frontend to align this and make sure it lands at the same time.

Arqu commented 2 years ago

I went ahead and did it solo, but unsure if I caught it all or if this is good at all. https://github.com/qri-io/frontend/pull/645