summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-09-18 02:26:01 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-09-18 02:26:01 +0200
commitce5834979cd72b52ad473924a0c322d0cdcca11c (patch)
treef05991e519c650f64b71ebdd0bdb7e0f4ef24e7e /examples
parente36e042093287e6b21004e24b609c6d1de7fc64a (diff)
downloadiced-ce5834979cd72b52ad473924a0c322d0cdcca11c.tar.gz
iced-ce5834979cd72b52ad473924a0c322d0cdcca11c.tar.bz2
iced-ce5834979cd72b52ad473924a0c322d0cdcca11c.zip
Fix deserialization of `PullRequest` with empty body in `changelog` tool
Diffstat (limited to 'examples')
-rw-r--r--examples/changelog/src/changelog.rs4
-rw-r--r--examples/changelog/src/main.rs9
2 files changed, 9 insertions, 4 deletions
diff --git a/examples/changelog/src/changelog.rs b/examples/changelog/src/changelog.rs
index 4aeb9574..275afec7 100644
--- a/examples/changelog/src/changelog.rs
+++ b/examples/changelog/src/changelog.rs
@@ -306,7 +306,7 @@ impl Contribution {
pub struct PullRequest {
pub id: u64,
pub title: String,
- pub description: String,
+ pub description: Option<String>,
pub labels: Vec<String>,
pub author: String,
}
@@ -334,7 +334,7 @@ impl PullRequest {
#[derive(Deserialize)]
struct Schema {
title: String,
- body: String,
+ body: Option<String>,
user: User,
labels: Vec<Label>,
}
diff --git a/examples/changelog/src/main.rs b/examples/changelog/src/main.rs
index 663b8b9f..f889e757 100644
--- a/examples/changelog/src/main.rs
+++ b/examples/changelog/src/main.rs
@@ -90,8 +90,13 @@ impl Generator {
return Task::none();
};
- let description =
- markdown::parse(&pull_request.description).collect();
+ let description = markdown::parse(
+ pull_request
+ .description
+ .as_deref()
+ .unwrap_or("*No description provided*"),
+ )
+ .collect();
*state = State::Loaded {
title: pull_request.title.clone(),