Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 1 commit into from

Conversation

Arqu
Copy link
Contributor

@Arqu Arqu commented Dec 7, 2021

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 #1989

@Arqu Arqu requested review from dustmop and ramfox December 7, 2021 11:48
@Arqu Arqu self-assigned this Dec 7, 2021
@Arqu Arqu added this to In progress in Sprints via automation Dec 7, 2021
@Arqu Arqu moved this from In progress to Needs Review in Sprints Dec 7, 2021
@ramfox
Copy link
Member

ramfox commented Dec 10, 2021

There is one other place we should consider changing:

func (h *connections) messageHandler(_ context.Context, e event.Event) error {
ctx := context.Background()
evt := map[string]interface{}{
"type": string(e.Type),
"ts": e.Timestamp,
"sessionID": e.SessionID,
"data": e.Payload,
}

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
Copy link
Contributor Author

Arqu commented Dec 14, 2021

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
Copy link
Contributor Author

Arqu commented Dec 14, 2021

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

@Arqu Arqu closed this Apr 29, 2022
Sprints automation moved this from Needs Review to Done Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

calls to /auto/runinfo are returning Timestamp and Type keys
2 participants