diff --git a/src/api.rs b/src/api.rs index d58486d..07a9212 100644 --- a/src/api.rs +++ b/src/api.rs @@ -316,7 +316,8 @@ pub struct PageInfo { #[serde(default)] pub end_cursor: Option, /// Cursor for previous page - pub start_cursor: Base64UrlString, + #[serde(default)] + pub start_cursor: Option, } /// Response to query @@ -498,4 +499,13 @@ mod tests { r#"{"model":"kjzl6hvfrbw6c8apa5yce6ah3fsz9sgrh6upniy0tz8z76gdm169ds3tf8c051t","account":"test","queryFilters":{"where":{"id":{"equalTo":"1"}}},"first":100}"# ); } + + #[test] + fn should_deserialize_empty_result() { + let res: QueryResponse = serde_json::from_str( + r#"{"edges":[],"pageInfo":{"hasNextPage":false,"hasPreviousPage":false}}"#, + ) + .unwrap(); + assert!(res.edges.is_empty()); + } }