Peter-Schorn / SpotifyAPI

A Swift library for the Spotify web API. Supports all endpoints.
https://peter-schorn.github.io/SpotifyAPI/documentation/spotifywebapi
MIT License
251 stars 32 forks source link

Update playlist images to be optional. #57

Closed jlopez closed 1 month ago

jlopez commented 3 months ago

The Playlist API just started returning a null image array (instead of an empty array as the documentation suggests and the code assumes). This change prevents the JSONDecoder from crashing when decoding such playlists.

Peter-Schorn commented 3 months ago

Change the code to decode a value of null into an empty array. This will avoid breaking API compatibility. In order to accomplish this, you must add a public init(from decoder: Decoder) throws method to Playlist, similar to the method in Album: https://github.com/Peter-Schorn/SpotifyAPI/blob/52a0e30f9f36221ee73da30004e4e6e5a389ab2f/Sources/SpotifyWebAPI/Object%20Model/Music%20Objects/Album.swift#L276-L349

Peter-Schorn commented 3 months ago

Please try 03799102987847ab6674f275b729dd5bdd9fe5f0 (or the latest commit on master).

Peter-Schorn commented 1 month ago

Implemented in version 3.0.1.