fix: deserialize empty images from null #480
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adjust the derived implementation of
Deserialize
forSimplifiedPlaylist
. Instead of returning an error when deserializing the valuenull
for the fieldimages
, this value is deserialized to an emptyVec
.This is necessary, because the Spotify-API is returning
null
instead of an empty array for this field in some instances.Motivation and Context
This fixes the problem described in #459. The Spotify-API is returning
null
instead of an empty array for theimages
-field in some instances.Dependencies
None
Type of change
Please delete options that are not relevant.
How has this been tested?
The change was tested by using the patched version of rspotify in this project.
Is this change properly documented?
I don't think this needs to be documented. The change won't affect the behavior of rspotify when the Spotify-API returns
images: []
. When the Spotify-API returnsimages: null
current_user_playlists
wasn't usable prior to this change. In this case the PR implements the expected behavior.