SpotifyAPI icon indicating copy to clipboard operation
SpotifyAPI copied to clipboard

Made Playlist Images Optional

Open ashinthetray opened this issue 1 year ago • 1 comments

Spotify playlists with no tracks will have images as nil. Current Playlist model has images as non-nil & causes decoding error.

  • Images are now optional in Playlist model
  • Images are also optional in Playlist Initializer

ashinthetray avatar Oct 16 '24 04:10 ashinthetray

Hi Ashwin.

In order to maintain API stability, please change the decoding logic so that a value of null/ a missing image key in the JSON is decoded into an empty array. Existing clients rely on the images property being non-nil. This also means that changing the Playlist initializer is unecessary.

Peter-Schorn avatar Oct 17 '24 02:10 Peter-Schorn

After testing my code with an empty playlist that contains no images, I found that it already correctly decodes a value of null for the images key in the JSON into an empty array. My code can also handle the case where the images key is missing from the JSON entirely. Thus, I cannot reproduce this error. If you are still experiencing a decoding error, please create an issue.

Peter-Schorn avatar Nov 23 '24 03:11 Peter-Schorn