From eb716ee588cebd5f2d13beaf9f65de809760ea44 Mon Sep 17 00:00:00 2001 From: Stephen Way Date: Wed, 13 May 2026 08:41:57 -0700 Subject: [PATCH] fix: -R works on repo positional commands, null-array deserialization, list endpoint normalization * `fj repo branches`, `repo topics`, `repo edit`, `repo fork`, `repo sync`, `repo archive`, `repo unarchive`, `repo mirror-sync` previously took only a positional `repo` argument and rejected `-R/--repo`. Now they accept both, with `-R` winning when both are given. * Forgejo returns `null` for `labels`/`assignees` on issues and PRs when empty. The Issue/Pull structs hit `expected a sequence` on every issue create. Added a `deserialize_null_to_default` helper on the affected fields so null is now coerced to an empty Vec. * `get_page` similarly bailed when a list endpoint returned a bare `null` body. Now treats null and empty body as `[]`. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/api/issue.rs | 4 ++-- src/api/mod.rs | 1 + src/api/pull.rs | 2 +- src/api/serde_util.rs | 16 ++++++++++++++++ src/cli/repo.rs | 39 +++++++++++++++++++++++++++++++-------- src/client/mod.rs | 8 +++++++- 6 files changed, 58 insertions(+), 12 deletions(-) create mode 100644 src/api/serde_util.rs diff --git a/src/api/issue.rs b/src/api/issue.rs index a745445..1b8b9fe 100644 --- a/src/api/issue.rs +++ b/src/api/issue.rs @@ -16,9 +16,9 @@ pub struct Issue { pub body: String, pub state: String, pub user: User, - #[serde(default)] + #[serde(default, deserialize_with = "crate::api::serde_util::deserialize_null_to_default")] pub labels: Vec