Closed bdbergeron closed 9 months ago
This will likely help to resolve #85, #94, #95, and #96.
Considering how many enum
types are being used in the codebase and their inherent instability with Apple's Decodable
parsing, you may want to consider adopting a library like airbnb/ResilientDecoding to help prevent issues like this from arising again in the future. Simply using the @Resilient
property wrapper on a variable referencing an optional enum type ensures that a decoding failure will fallback to the variable being nil
.
import ResilientDecoding
extension VercelProject {
struct ProtectionSettings: Decodable {
@Resilient var deploymentType: DeploymentTypeProtection?
}
}
enum DeploymentTypeProtection: String, Decodable {
case standard = "prod_deployment_urls_and_all_previews"
case preview
case all
}
With that in place, if the Vercel API ever changes an existing or adds a new Deployment Protection type value, the decoding will no longer fail but instead simply set ProtectionSettings.deploymentType = nil
.
Hey @daneden, any chance you can take a quick look at this and get a build to the App Store with this fix? Thanks!
@daneden @bdbergeron Is there anything I can do to help get this across the finish line?
@loganbek @bdbergeron unfortunately I’m now experiencing an issue with Xcode related to provisioning profiles and code signing. I’m in touch with Apple Developer Support to try and fix the issue, which is preventing upload of the new build to App Store Connect.
This fix is now shipped in v3.2.1. I’ve actually also got a change ready for 3.2.2 that fixes this issue another way: by removing the deployment protection key from the structure. That key, along with about a dozen others, wasn't actually used anywhere in the app. I'd encountered a similar decoding issue with Node versions, which, again, I had used an enum for and, again, wasn't actually used anywhere.
Appreciate the tip about ResilientDecoding, @bdbergeron; I may well reach for it in a future release!
Like many other users, my projects have disappeared from the Zeitgeist app recently. All of my projects have Deployment Protection setup to require Vercel authorization to preview deployments and any other domains except the most recent production deployment, which in Vercel parlance is "Standard Protection."
The
DeploymentTypeProtection
enum currently only handlespreview
andall
values for the API response, resulting in a decoding failure if a user has Standard Protection enabled on any of their projects. This PR adds support for the new value returned by the Vercel API for projects with Standard Protection enabled.