slack-rs / slack-rs-api

Rust interface for the Slack Web API
Apache License 2.0
109 stars 66 forks source link

channels::info sometimes returns malformed response #79

Closed clux closed 4 years ago

clux commented 4 years ago

Can happen when the latest message has a ts formatted as a string:

          "ts": "1570109136.344300",

but types.rs encodes it as:

    pub ts: Option<f32>,

leading to: JSON error - MalformedResponse(Error("invalid type: string \"1570109136.344300\", expected f32", line: 1, column: 2342))

dten commented 4 years ago

Do you know what type that was on? They vary if they're string or they're floats. I wonder if they're just wrong here in some places or slack are changing things

dten commented 4 years ago

Oh sorry you say that's channel info.

clux commented 4 years ago

Yeah, the ts type seems to vary, which is the strange thing. Maybe it's a slack api bug?

Ultimately, have been building from a fork where the latest message on channel info has been commented out. Not sure how to deal with that type of inconsistency using serde.

dten commented 4 years ago

There's a PR about trying to fix these time stamps. I think it's just a mistake on slacks part that is now hard to change

DanielJoyce commented 4 years ago

JS has limited float precious so perhaps these comeback as strings sometime to preserve precision for other languages

dten commented 4 years ago

this is fixed by the new Timestamp type https://github.com/slack-rs/slack-rs-api/releases/tag/v0.23.0