rspotify: json parse error when getting playlist with no image
Describe the bug
Calling get-playlist
API with playlist having no image will return a response with images
field null
. However, according to https://docs.rs/rspotify-model/0.12.0/rspotify_model/playlist/struct.FullPlaylist.html, rspotify
specifies the field as Vec<Image>
. This leads to the following error when parsing the json response:
json parse error: invalid type: null, expected a sequence at line 1 column 293: invalid type: null, expected a sequence at line 1 column 293
To Reproduce Steps to reproduce the behavior:
- Create a new playlist with Spotify, making sure that it has no image
- Call
get-playlist
API using the new playlist’s URI - Observe
images
field has a value ofnull
About this issue
- Original URL
- State: open
- Created 4 months ago
- Comments: 16 (10 by maintainers)
Commits related to this issue
- Patch spotify API bugs (#386) Resolves #330 Resolves #383 Resolves #384 Related upstream issues: - https://github.com/ramsayleung/rspotify/issues/452 - https://github.com/ramsayleung/rspoti... — committed to aome510/spotify-player by aome510 4 months ago
- Create a playlist on initialization. Woohoo! Currently a fun bug here (https://github.com/ramsayleung/rspotify/issues/459) makes this a bit annoying to deal with, but that should eventually get fixed... — committed to joshuamorton/stag by joshuamorton 3 months ago
In the meantime, one may use the API to check which playlist is the culprit. Go the the spotify API documentation link below and test the query with limit = 50 offset = 0 on your own account (you need to be logged in): https://developer.spotify.com/documentation/web-api/reference/get-a-list-of-current-users-playlists Then Ctrl+F for
"images": null
#[serde(default)]
will fail if the key is present with a null value: