Skip to content

Fix: accept both item(s) and track(s) from playlist(_items) endpoints#560

Merged
ramsayleung merged 3 commits into
ramsayleung:masterfrom
jullanggit:master
Mar 18, 2026
Merged

Fix: accept both item(s) and track(s) from playlist(_items) endpoints#560
ramsayleung merged 3 commits into
ramsayleung:masterfrom
jullanggit:master

Conversation

@jullanggit
Copy link
Copy Markdown
Contributor

@jullanggit jullanggit commented Mar 17, 2026

Description

Spotify now seems to send both items and tracks for the playlists and playlist items endpoints, which currently fails to deserialize, as both map the the same struct field. Instead deserialize them seperately in shadow, and then map them to the real struct.

Motivation and Context

My app got errors for these items

Type of change

The app mentioned above, now works :)

Is this change properly documented?

Yup, updated the changelog

Spotify now seems to send both items and tracks for the me/playlists
endpoint, which currently fails to deserialize, as both map the the same
struct field. Instead deserialize them seperately in shadow, and then
map them to the real struct.
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the rspotify-model crate by introducing greater flexibility in deserializing data from Spotify's playlist-related API endpoints. It specifically addresses inconsistencies where the API might return playlist content using either "items" or "tracks" (and "item" or "track" for individual entries), ensuring that the application can correctly parse these responses regardless of the field name used.

Highlights

  • Flexible Playlist Content Deserialization: The SimplifiedPlaylistShadow struct was updated to accept either an items or tracks field for playlist content, making the deserialization more robust to API variations.
  • Flexible Playlist Item Deserialization: The PlaylistItemShadow struct was modified to accept either an item or track field for individual playlist entries, accommodating different API response structures.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • rspotify-model/src/playlist.rs
    • Updated SimplifiedPlaylistShadow to correctly deserialize playlist content from either items or tracks fields.
    • Modified PlaylistItemShadow to correctly deserialize individual playlist entries from either item or track fields.
Activity
  • No activity has occurred on this pull request since its creation.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request aims to add backward compatibility for recent field name changes in the Spotify API, specifically from track(s) to item(s). The implementation for SimplifiedPlaylist is correct. However, there's a logic error in the implementation for PlaylistItem that breaks backward compatibility for the deprecated track field. I've left a comment with a suggested fix.

Comment thread rspotify-model/src/playlist.rs Outdated
@ramsayleung ramsayleung merged commit e5ad4bb into ramsayleung:master Mar 18, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants