Peter-Schorn / SpotifyAPI

A Swift library for the Spotify web API. Supports all endpoints.
https://peter-schorn.github.io/SpotifyAPI/documentation/spotifywebapi
MIT License
265 stars 32 forks source link

Music Objects should be identifiable with non-nil "id" (as well as uri) #55

Closed danwood closed 8 months ago

danwood commented 8 months ago

Many music objects are marked with optional id, which makes them unable to conform to Identifiable:

Please make these non-nil since they are not nil in the spec, AFAIK (and perhaps go ahead and include conformance to Identifiable?) … This would help a lot with SwiftUI functionality.

Also, could the 'uri' fields also be non-optional? It seems like this could simplify client code a lot!

Peter-Schorn commented 8 months ago

All of these fields are optional because they can, in fact, be null, despite what the documentation says. I've observed this in the API. This is mostly because playlists can contain local tracks. These tracks usually have little, if any, metadata attached to them. Also note that, even when a URI is present, playlists can contain duplicate items.