[PR #546] [CLOSED] fix: handle null playlists in category endpoints (#535) #530

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

📋 Pull Request Information

Original PR: https://github.com/ramsayleung/rspotify/pull/546
Author: @eioo
Created: 1/10/2026
Status: Closed

Base: masterHead: master


📝 Commits (1)

  • 2100a60 fix: handle null playlists in category endpoints (#535)

📊 Changes

2 files changed (+186 additions, -2 deletions)

View changed files

📝 rspotify-model/src/playlist.rs (+116 -2)
📝 tests/test_models.rs (+70 -0)

📄 Description

Description

This PR fixes an issue #535, where the Spotify API sometimes returns null playlists in category endpoints (like "Get Category's Playlists"), causing deserialization to fail. The fix adds custom deserialization logic that filters out invalid null playlists, ensuring only valid ones are returned.

Changes:

  • Added optional field structs for deserialization (SimplifiedPlaylistOptional, etc.)
  • Custom deserializer for CategoryPlaylists that filters null IDs
  • Tests to verify the fix works

Motivation and Context

User of https://github.com/aome510/spotify-player, which has this library as dependency. There is an issue that playlists cannot be loaded in the application, I assume it's related to #535.

Dependencies

None.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How has this been tested?

All existing tests pass, and added a new one: test_deserialization_playlist_item_with_malformed_episodes.

Is this change properly documented?

Yes. Let me know if CHANGELOG also needs adjustments.


🔄 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/546 **Author:** [@eioo](https://github.com/eioo) **Created:** 1/10/2026 **Status:** ❌ Closed **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`2100a60`](https://github.com/ramsayleung/rspotify/commit/2100a60843e19233ec3b616de05e9a3f334bba37) fix: handle null playlists in category endpoints (#535) ### 📊 Changes **2 files changed** (+186 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `rspotify-model/src/playlist.rs` (+116 -2) 📝 `tests/test_models.rs` (+70 -0) </details> ### 📄 Description ## Description This PR fixes an issue #535, where the Spotify API sometimes returns null playlists in category endpoints (like "Get Category's Playlists"), causing deserialization to fail. The fix adds custom deserialization logic that filters out invalid null playlists, ensuring only valid ones are returned. **Changes:** - Added optional field structs for deserialization (SimplifiedPlaylistOptional, etc.) - Custom deserializer for CategoryPlaylists that filters null IDs - Tests to verify the fix works ## Motivation and Context User of https://github.com/aome510/spotify-player, which has this library as dependency. There is [an issue](https://github.com/aome510/spotify-player/issues/821) that playlists cannot be loaded in the application, I assume it's related to #535. ## Dependencies None. ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## How has this been tested? All existing tests pass, and added a new one: `test_deserialization_playlist_item_with_malformed_episodes`. ## Is this change properly documented? Yes. Let me know if `CHANGELOG` also needs adjustments. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 20:25:04 +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#530
No description provided.