AvdLee / appstoreconnect-swift-sdk

The Swift SDK to work with the App Store Connect API from Apple.
Other
1.48k stars 198 forks source link

`CiGitUser.avatarUrl` fails to decode an empty string #240

Closed reggian closed 1 year ago

reggian commented 1 year ago

When doing a create build run request the CiBuildRunResponse contains a CiGitUser object. The response path data.attributes.sourceCommit.author.avaterUrl can contain an empty string which fails to decode.

Error: Failed to decode response:
{
  "data" : {
    "type" : "ciBuildRuns",
    "id" : "297878df-48de-4b78-8232-2c5f11f95aef",
    "attributes" : {
      "number" : 30,
      "createdDate" : "2023-08-28T13:55:04.529Z",
      "startedDate" : null,
      "finishedDate" : null,
      "sourceCommit" : {
        "commitSha" : "",
        "message" : "",
        "author" : {
          "displayName" : "",
          "avatarUrl" : ""
        },
        "committer" : {
          "displayName" : "",
          "avatarUrl" : ""
        },
        "webUrl" : ""
      },
      "destinationCommit" : null,
      "isPullRequestBuild" : false,
      "issueCounts" : null,
      "executionProgress" : "PENDING",
      "completionStatus" : null,
      "startReason" : "MANUAL",
      "cancelReason" : null
    },
    "relationships" : {
      "builds" : {
        "links" : {
          "self" : "https://api.appstoreconnect.apple.com/v1/ciBuildRuns/297878df-48de-4b78-8232-2c5f11f95aef/relationships/builds",
          "related" : "https://api.appstoreconnect.apple.com/v1/ciBuildRuns/297878df-48de-4b78-8232-2c5f11f95aef/builds"
        }
      },
      "actions" : {
        "links" : {
          "self" : "https://api.appstoreconnect.apple.com/v1/ciBuildRuns/297878df-48de-4b78-8232-2c5f11f95aef/relationships/actions",
          "related" : "https://api.appstoreconnect.apple.com/v1/ciBuildRuns/297878df-48de-4b78-8232-2c5f11f95aef/actions"
        }
      }
    },
    "links" : {
      "self" : "https://api.appstoreconnect.apple.com/v1/ciBuildRuns/297878df-48de-4b78-8232-2c5f11f95aef"
    }
  },
  "links" : {
    "self" : "https://api.appstoreconnect.apple.com/v1/ciBuildRuns"
  }
}
Error: dataCorrupted(Swift.DecodingError.Context(codingPath: [StringCodingKey(stringValue: "data", intValue: nil), StringCodingKey(stringValue: "attributes", intValue: nil), StringCodingKey(stringValue: "sourceCommit", intValue: nil), StringCodingKey(stringValue: "author", intValue: nil), StringCodingKey(stringValue: "avatarUrl", intValue: nil)], debugDescription: "Invalid URL string.", underlyingError: nil)).
github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 30 days with no activity. Remove the Stale label or comment or this will be closed in 10 days.