[PR #480] [MERGED] fix: deserialize empty images from null #484

Closed
opened 2026-02-27 20:24:54 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ramsayleung/rspotify/pull/480
Author: @plustik
Created: 4/29/2024
Status: Merged
Merged: 5/2/2024
Merged by: @ramsayleung

Base: masterHead: fix/serializing-null-images


📝 Commits (1)

  • cc507a8 fix: deserialize empty images from null

📊 Changes

1 file changed (+9 additions, -0 deletions)

View changed files

📝 rspotify-model/src/playlist.rs (+9 -0)

📄 Description

Description

Adjust the derived implementation of Deserialize for SimplifiedPlaylist. Instead of returning an error when deserializing the value null for the field images, this value is deserialized to an empty Vec.
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 https://github.com/ramsayleung/rspotify/issues/459. The Spotify-API is returning null instead of an empty array for the images-field in some instances.

Dependencies

None

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

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 returns images: null current_user_playlists wasn't usable prior to this change. In this case the PR implements the expected behavior.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ramsayleung/rspotify/pull/480 **Author:** [@plustik](https://github.com/plustik) **Created:** 4/29/2024 **Status:** ✅ Merged **Merged:** 5/2/2024 **Merged by:** [@ramsayleung](https://github.com/ramsayleung) **Base:** `master` ← **Head:** `fix/serializing-null-images` --- ### 📝 Commits (1) - [`cc507a8`](https://github.com/ramsayleung/rspotify/commit/cc507a82ef1f55eb1b9d3e3047b24ad9fb3a00c5) fix: deserialize empty images from null ### 📊 Changes **1 file changed** (+9 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `rspotify-model/src/playlist.rs` (+9 -0) </details> ### 📄 Description ## Description Adjust the derived implementation of `Deserialize` for `SimplifiedPlaylist`. Instead of returning an error when deserializing the value `null` for the field `images`, this value is deserialized to an empty `Vec`. 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 https://github.com/ramsayleung/rspotify/issues/459. The Spotify-API is returning `null` instead of an empty array for the `images`-field in some instances. ## Dependencies None ## Type of change Please delete options that are not relevant. - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ## How has this been tested? The change was tested by using the patched version of rspotify in [this](https://gitea.tecks.eu/plustik/plservice) 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 returns `images: null` `current_user_playlists` wasn't usable prior to this change. In this case the PR implements the expected behavior. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 20:24:54 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/rspotify#484
No description provided.