fix: null team reviews
This commit is contained in:
parent
e6339d7c4f
commit
03c2ff9a17
6 changed files with 145 additions and 3 deletions
|
@ -2034,6 +2034,7 @@ pub struct PullRequest {
|
|||
#[serde(deserialize_with = "crate::none_if_blank_url")]
|
||||
pub patch_url: Option<url::Url>,
|
||||
pub pin_order: Option<u64>,
|
||||
#[serde(deserialize_with = "crate::requested_reviewers_ignore_null")]
|
||||
pub requested_reviewers: Option<Vec<User>>,
|
||||
pub state: Option<StateType>,
|
||||
pub title: Option<String>,
|
||||
|
|
12
src/lib.rs
12
src/lib.rs
|
@ -358,6 +358,18 @@ where
|
|||
.or(Ok(None))
|
||||
}
|
||||
|
||||
fn requested_reviewers_ignore_null<'de, D, DE>(
|
||||
deserializer: D,
|
||||
) -> Result<Option<Vec<structs::User>>, DE>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
DE: serde::de::Error,
|
||||
{
|
||||
let list: Option<Vec<Option<structs::User>>> =
|
||||
Option::deserialize(deserializer).map_err(DE::custom)?;
|
||||
Ok(list.map(|list| list.into_iter().filter_map(|x| x).collect::<Vec<_>>()))
|
||||
}
|
||||
|
||||
fn parse_ssh_url(raw_url: &String) -> Result<Url, url::ParseError> {
|
||||
// in case of a non-standard ssh-port (not 22), the ssh url coming from the forgejo API
|
||||
// is actually parseable by the url crate, so try to do that first
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue