Skip to content

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

@avrabe

Description

@avrabe

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions