gouqi icon indicating copy to clipboard operation
gouqi copied to clipboard

UserResponse.name should be Option<String> for JIRA Cloud compatibility

Open avrabe opened this issue 2 months ago • 0 comments

Description

The UserResponse.name field is currently required (pub name: String) but JIRA Cloud does not always return this field, causing deserialization failures even when API operations succeed.

Affected Code

File: src/attachments.rs:21

Current code:

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct UserResponse {
    pub active: bool,
    #[serde(rename = "avatarUrls")]
    pub avatar_urls: BTreeMap<String, String>,
    #[serde(rename = "displayName")]
    pub display_name: String,
    pub key: Option<String>,
    pub name: String,  // ❌ This should be Option<String>
    #[serde(rename = "self")]
    pub self_link: String,
    #[serde(rename = "timeZone")]
    pub timezone: Option<String>,
}

How to Reproduce

  1. Upload an attachment to JIRA Cloud using issues().upload_attachment()
  2. The upload succeeds on JIRA's side
  3. Deserialization of the response fails with: missing field 'name' at line 1 column 1078

Expected Behavior

The upload should succeed and return parsed AttachmentResponse data.

Actual Behavior

Error: Serialization error: missing field `name` at line 1 column 1078

Proposed Fix

Change the field to be optional:

pub name: Option<String>,

This matches the pattern already used for key and timezone fields in the same struct.

Environment

  • gouqi version: 0.19.1
  • JIRA type: Cloud
  • Tested with: Atlassian JIRA Cloud (https://*.atlassian.net)

Impact

This bug prevents successful parsing of attachment upload responses on JIRA Cloud, even though the uploads themselves succeed. The name field appears to be deprecated or optional in modern JIRA Cloud APIs.

Additional Context

The User struct (which UserResponse is based on) likely has similar issues. Consider reviewing all user-related structs for optional fields that JIRA Cloud may not always return.

avrabe avatar Oct 21 '25 06:10 avrabe