Open rubdos opened 13 hours ago
Thanks for flagging this. The following may work. Needs testing though.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Event {
#[serde(flatten)]
pub event: InnerEvent,
pub compat: Compat,
}
// Same as previous event.
pub struct InnerEvent
Observations:
match
on event should now have arms with InnerEvent
types).compat
field in the ChallengeJson
; should that get removed? It's not in the docs any more anyway.compat
field needs to be Option
al; it's apparently not in the GameStart events: there it's actually in the game
field...
As also stated in https://github.com/lichess-org/api/issues/243, the docs don't agree with the actual implementation of the
compat
field of the event stream on the board api.This is an actual event on the stream:
The current API implementation expects the
compat
field on thechallenge
, but it is directly part of the event. I'm not sure how to correctly expose the field, since the API currently uses a generic nd-json parser that expects a type + field, without any extras (afaict).