Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made Playlist Images Optional #65

Closed
wants to merge 2 commits into from

Conversation

ashinthetray
Copy link

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

Playlists without any tracks will not have no images and causes decoding error.
Empty playlist may not have images and causes decoding error
@Peter-Schorn
Copy link
Owner

Peter-Schorn commented Oct 17, 2024

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
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants