Peter-Schorn/SpotifyAPI

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

Closed this issue · 1 comments

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

  • PlaylistItem (derived from Track or Episode)
  • Album
  • Artist
  • Track

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!

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.