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

New case in UserRole/FilterRoles causing failure in decoder #251

Closed neilkachu closed 9 months ago

neilkachu commented 11 months ago

Calls to https://api.appstoreconnect.apple.com/v1/users are now returning a new unsupported enum case ( GENERATE_INDIVIDUAL_KEYS) in APIEndpoint.V1.Users.GetParameters.UserRole and thus causing a failure in the decoding:

Error: dataCorrupted(Swift.DecodingError.Context(codingPath: [StringCodingKey(stringValue: "data", intValue: nil), _JSONKey(stringValue: "Index 2", intValue: 2), StringCodingKey(stringValue: "attributes", intValue: nil), StringCodingKey(stringValue: "roles", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0)], debugDescription: "Cannot initialize UserRole from invalid String value GENERATE_INDIVIDUAL_KEYS", underlyingError: nil)).

example json:


"attributes" : {
     "username" : "xxxx@xxxxx.com",
    "firstName" : "FirstName",
    "lastName" : "LastName",
    "roles" : [
     "FINANCE",
     "GENERATE_INDIVIDUAL_KEYS",
     "CUSTOMER_SUPPORT",
     "MARKETING"
    ]
}
neilkachu commented 11 months ago

Maybe a use case for @unknown default in the CreateAPI Sourcery parser?

NoWiseMan commented 11 months ago

To this looks like Apple did change the API without publishing the changes.

I added the new value "GENERATE_INDIVIDUAL_KEYS" into the downloaded "app_store_connect_api.json" Add the end of the "UserRole": enum You can find the enum inline 134458 in the file "app_store_connect_api.json" Then run "make generate" as described in the readme

github-actions[bot] commented 10 months 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.

MortenGregersen commented 9 months ago

My contact at Apple says this was inadvertently released (it’s a new feature). The API should not return this value until the feature is released for real.