[PR #533] [MERGED] [fix] Fix the malformed JSON response of get-playlists-tracks endpoint #519

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

📋 Pull Request Information

Original PR: https://github.com/ramsayleung/rspotify/pull/533
Author: @ramsayleung
Created: 7/8/2025
Status: Merged
Merged: 7/8/2025
Merged by: @ramsayleung

Base: masterHead: ramsay/fix-malformed-json


📝 Commits (3)

  • 9b55124 [fix]Fix the malformed JSON response of playlist_items_manual endpoint
  • 4927bfe Update CHANGELOG and fix cargo error
  • 7b961c6 Fix clippy error

📊 Changes

5 files changed (+141 additions, -1 deletions)

View changed files

📝 CHANGELOG.md (+4 -0)
📝 rspotify-model/src/lib.rs (+23 -0)
📝 rspotify-model/src/show.rs (+2 -1)
📝 rspotify-model/src/track.rs (+1 -0)
📝 tests/test_models.rs (+111 -0)

📄 Description

Description

Fix the misformed JSON response of get-playlists-tracks endpoint, the problem is that the PlayableItem enum expects either a Track or Episode, but the JSON contains a hybrid object that has characteristics of both.

But based on API doc of get playlist item:

Information about the track or episode.
Will be one of the following:

This is a classic case of API documentation vs. reality mismatch.

Motivation and Context

https://github.com/ramsayleung/rspotify/issues/525

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?

  • test_deserialization_playlist_item_with_malformed_episodes: passed

Is this change properly documented?

Yes

Don't forget to add an entry to the CHANGELOG if necessary (new features, breaking changes, relevant internal improvements).


🔄 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/533 **Author:** [@ramsayleung](https://github.com/ramsayleung) **Created:** 7/8/2025 **Status:** ✅ Merged **Merged:** 7/8/2025 **Merged by:** [@ramsayleung](https://github.com/ramsayleung) **Base:** `master` ← **Head:** `ramsay/fix-malformed-json` --- ### 📝 Commits (3) - [`9b55124`](https://github.com/ramsayleung/rspotify/commit/9b55124b9c18fb8375d78608ca60ccf7cf1f011b) [fix]Fix the malformed JSON response of playlist_items_manual endpoint - [`4927bfe`](https://github.com/ramsayleung/rspotify/commit/4927bfe4c262cf4764104a8e8fda04939b6aa5e9) Update CHANGELOG and fix cargo error - [`7b961c6`](https://github.com/ramsayleung/rspotify/commit/7b961c6f367fa5e1a45d2b7619148341da13d966) Fix clippy error ### 📊 Changes **5 files changed** (+141 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+4 -0) 📝 `rspotify-model/src/lib.rs` (+23 -0) 📝 `rspotify-model/src/show.rs` (+2 -1) 📝 `rspotify-model/src/track.rs` (+1 -0) 📝 `tests/test_models.rs` (+111 -0) </details> ### 📄 Description ## Description Fix the misformed JSON response of `get-playlists-tracks` endpoint, the problem is that the `PlayableItem` enum expects either a `Track` or `Episode`, but the JSON contains a **hybrid** object that has characteristics of both. But based on API doc of [get playlist item](https://developer.spotify.com/documentation/web-api/reference/get-playlists-tracks): > Information about the track or episode. > Will be one of the following: This is a classic case of API documentation vs. reality mismatch. ## Motivation and Context https://github.com/ramsayleung/rspotify/issues/525 ## 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? - [x] `test_deserialization_playlist_item_with_malformed_episodes`: passed ## Is this change properly documented? Yes Don't forget to add an entry to the CHANGELOG if necessary (new features, breaking changes, relevant internal improvements). --- <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:01 +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#519
No description provided.