{
  "format": "json",
  "type": "object",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Spotify Playlist Schema",
  "allOf": [
    {
      "$ref": "#/definitions/Playlist"
    },
    {
      "$ref": "#/definitions/PlaylistNotDocumentedFields"
    }
  ],
  "definitions": {
    "URL": {
      "type": "string",
      "format": "uri",
      "qt-uri-protocols": [
        "https"
      ],
      "examples": [
        "https:/example.com",
        "https://api.spotify.com/v1/users/ztdexo9v04s5umq3x2uxbmo3s"
      ]
    },
    "SpotifyID": {
      "type": "string",
      "examples": [
        "4aawyAB9vmqN3uQ7FjRGTy"
      ]
    },
    "SpotifyUserID": {
      "type": "string",
      "examples": [
        "wizzler",
        "ztdexo9v04s5umq3x2uxbmo3s"
      ]
    },
    "SpotifyURI": {
      "type": "string",
      "examples": [
        "spotify:track:6rqhFgbbKwnb9MLmUQDhG6",
        "spotify:user:ztdexo9v04s5umq3x2uxbmo3s"
      ]
    },
    "SpotifyURL": {
      "$ref": "#/definitions/URL",
      "examples": [
        "http://open.spotify.com/track/6rqhFgbbKwnb9MLmUQDhG6"
      ]
    },
    "ExternalIDs": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "isrc": {
          "type": "string",
          "examples": [
            "CAV161500008",
            "GBDXG0600014"
          ]
        },
        "ean": {
          "type": "string",
          "examples": [
            "4640000900854"
          ]
        },
        "upc": {
          "type": "string",
          "examples": [
            "886445458077"
          ]
        }
      },
      "title": "ExternalIDs"
    },
    "ExternalUrls": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "spotify": {
          "$ref": "#/definitions/URL"
        }
      },
      "title": "ExternalUrls"
    },
    "Copyrights": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string",
            "examples": [
              "1999 Sony Music Entertainment Inc. WARNING: All rights reserved. Unauthorized duplication is a violation of applicable laws."
            ]
          },
          "type": {
            "type": "string",
            "examples": [
              "p"
            ]
          }
        }
      },
      "title": "Copyrights"
    },
    "GenresArray": {
      "type": "array",
      "items": {
        "type": "string",
        "examples": [
          "Prog rock",
          "Grunge"
        ]
      },
      "title": "GenresArray"
    },
    "AvailableMarkets": {
      "type": "array",
      "items": {
        "type": "string",
        "examples": [
          "CA",
          "BR",
          "IT"
        ]
      },
      "title": "AvailableMarkets"
    },
    "Image": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "url": {
          "$ref": "#/definitions/URL"
        },
        "height": {
          "type": "integer",
          "examples": [
            300
          ]
        },
        "width": {
          "type": "integer",
          "examples": [
            300
          ]
        }
      },
      "required": [
        "height",
        "url",
        "width"
      ],
      "title": "Image"
    },
    "ImagesArray": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/Image"
      }
    },
    "Restrictions": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "reason": {
          "type": "string",
          "enum": [
            "market",
            "product",
            "explicit"
          ]
        }
      },
      "title": "Restrictions"
    },
    "Followers": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "href": {
          "type": "null",
          "description": "According to docs this field will contain null value for now"
        },
        "total": {
          "type": "integer",
          "examples": [
            101
          ]
        }
      },
      "title": "Followers"
    },
    "Album": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "album_type": {
          "type": "string",
          "enum": [
            "album",
            "single",
            "compilation"
          ]
        },
        "total_tracks": {
          "type": "integer",
          "examples": [
            11
          ]
        },
        "available_markets": {
          "$ref": "#/definitions/AvailableMarkets"
        },
        "external_urls": {
          "$ref": "#/definitions/ExternalUrls"
        },
        "href": {
          "$ref": "#/definitions/URL"
        },
        "id": {
          "$ref": "#/definitions/SpotifyID"
        },
        "images": {
          "$ref": "#/definitions/ImagesArray"
        },
        "name": {
          "type": "string",
          "examples": [
            "In Through the Out Door"
          ]
        },
        "release_date": {
          "type": "string",
          "examples": [
            "1981-12"
          ]
        },
        "release_date_precision": {
          "type": "string",
          "enum": [
            "day",
            "year",
            "month"
          ]
        },
        "restrictions": {
          "$ref": "#/definitions/Restrictions"
        },
        "type": {
          "type": "string",
          "enum": [
            "album"
          ]
        },
        "uri": {
          "$ref": "#/definitions/SpotifyURI"
        }
      },
      "required": [
        "album_type",
        "total_tracks",
        "available_markets",
        "external_urls",
        "href",
        "id",
        "images",
        "name",
        "release_date",
        "release_date_precision",
        "type",
        "uri"
      ]
    },
    "AlbumAdditionalFields": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "album_group": {
          "type": "string",
          "enum": [
            "album",
            "single",
            "compilation",
            "appears_on"
          ]
        },
        "artists": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Artist"
          }
        }
      }
    },
    "AlbumNotDocumentedFields": {
      "type": "object",
      "properties": {
        "copyrights": {
          "$ref": "#/definitions/Copyrights"
        },
        "external_ids": {
          "$ref": "#/definitions/ExternalIDs"
        },
        "genres": {
          "$ref": "#/definitions/GenresArray"
        },
        "label": {
          "type": "string",
          "examples": [
            "Monument",
            "Electric Lady Studio"
          ]
        },
        "popularity": {
          "type": "integer",
          "examples": [
            0,
            57
          ]
        }
      },
      "title": "Album fields that are not documented, but yet present in response"
    },
    "Artist": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "external_urls": {
          "$ref": "#/definitions/ExternalUrls"
        },
        "href": {
          "$ref": "#/definitions/URL"
        },
        "id": {
          "$ref": "#/definitions/SpotifyID"
        },
        "name": {
          "type": "string",
          "examples": [
            "Dark Side of the Moon"
          ]
        },
        "type": {
          "type": "string",
          "enum": [
            "artist"
          ]
        },
        "uri": {
          "$ref": "#/definitions/SpotifyURI"
        }
      },
      "title": "Artist"
    },
    "ArtistAdditionalFields": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "followers": {
          "$ref": "#/definitions/Followers"
        },
        "genres": {
          "$ref": "#/definitions/GenresArray"
        },
        "images": {
          "$ref": "#/definitions/ImagesArray"
        },
        "popularity": {
          "type": "integer",
          "examples": [
            0,
            57
          ]
        }
      },
      "title": "ArtistAdditionalFields"
    },
    "Playlist": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "collaborative": {
          "type": "boolean"
        },
        "description": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "external_urls": {
          "$ref": "#/definitions/ExternalUrls"
        },
        "followers": {
          "$ref": "#/definitions/Followers"
        },
        "href": {
          "$ref": "#/definitions/URL"
        },
        "id": {
          "$ref": "#/definitions/SpotifyID"
        },
        "images": {
          "$ref": "#/definitions/ImagesArray"
        },
        "name": {
          "type": "string"
        },
        "owner": {
          "$ref": "#/definitions/Owner"
        },
        "public": {
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "snapshot_id": {
          "type": "string",
          "examples": [
            "MTcsZTcwYTg1MDcwZDkzZDM2MGI1ZWQ2MDVhMzA0OThmYTllMDAzMzk3ZA=="
          ]
        },
        "tracks": {
          "$ref": "#/definitions/TracksWrapped"
        },
        "type": {
          "type": "string",
          "enum": [
            "playlist"
          ]
        },
        "uri": {
          "$ref": "#/definitions/SpotifyURI"
        }
      },
      "title": "Playlist"
    },
    "PlaylistNotDocumentedFields": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "primary_color": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "title": "Playlist object fields that are not documented, but yet present in response"
    },
    "Track": {
      "type": "object",
      "properties": {
        "album": {
          "allOf": [
            {
              "$ref": "#/definitions/Album"
            },
            {
              "$ref": "#/definitions/AlbumAdditionalFields"
            }
          ]
        },
        "artists": {
          "type": "array",
          "items": {
            "allOf": [
              {
                "$ref": "#/definitions/Artist"
              },
              {
                "$ref": "#/definitions/ArtistAdditionalFields"
              }
            ]
          }
        },
        "available_markets": {
          "$ref": "#/definitions/AvailableMarkets"
        },
        "disc_number": {
          "type": "integer",
          "examples": [
            2
          ]
        },
        "duration_ms": {
          "type": "integer",
          "examples": [
            123145
          ]
        },
        "explicit": {
          "type": "boolean"
        },
        "external_ids": {
          "$ref": "#/definitions/ExternalIDs"
        },
        "external_urls": {
          "$ref": "#/definitions/ExternalUrls"
        },
        "href": {
          "$ref": "#/definitions/URL"
        },
        "id": {
          "$ref": "#/definitions/SpotifyID"
        },
        "is_playable": {
          "type": "boolean"
        },
        "linked_from": {
          "$ref": "#/definitions/Track"
        },
        "restrictions": {
          "$ref": "#/definitions/Restrictions"
        },
        "name": {
          "type": "string",
          "examples": [
            "Sultans of Swing"
          ]
        },
        "popularity": {
          "type": "integer",
          "examples": [
            0,
            54
          ]
        },
        "preview_url": {
          "oneOf": [
            {
              "$ref": "#/definitions/URL"
            },
            {
              "type": "null"
            }
          ]
        },
        "track_number": {
          "type": "integer",
          "examples": [
            12
          ]
        },
        "type": {
          "type": "string",
          "enum": [
            "track"
          ]
        },
        "uri": {
          "$ref": "#/definitions/SpotifyURI"
        },
        "is_local": {
          "type": "boolean"
        }
      },
      "title": "Track"
    },
    "TracksWrapped": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "href": {
          "$ref": "#/definitions/URL"
        },
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Track"
          }
        },
        "limit": {
          "type": "integer",
          "examples": [
            10
          ]
        },
        "next": {
          "oneOf": [
            {
              "$ref": "#/definitions/URL"
            },
            {
              "type": "null"
            }
          ]
        },
        "offset": {
          "type": "integer",
          "examples": [
            10
          ]
        },
        "previous": {
          "oneOf": [
            {
              "$ref": "#/definitions/URL"
            },
            {
              "type": "null"
            }
          ]
        },
        "total": {
          "type": "integer",
          "examples": [
            67
          ]
        }
      },
      "required": [
        "href",
        "items",
        "limit",
        "next",
        "offset",
        "previous",
        "total"
      ],
      "title": "TracksWrapped"
    },
    "Owner": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "display_name": {
          "type": "string",
          "examples": [
            "Roger"
          ]
        },
        "external_urls":{
          "$ref": "#/definitions/ExternalUrls"
        },
        "followers": {
          "$ref": "#/definitions/Followers"
        },
        "href": {
          "$ref": "#/definitions/URL"
        },
        "id": {
          "$ref": "#/definitions/SpotifyUserID"
        },
        "images": {
          "$ref": "#/definitions/ImagesArray"
        },
        "type": {
          "type": "string",
          "enum": [
            "user"
          ]
        },
        "uri": {
          "$ref": "#/definitions/SpotifyURI"
        }
      },
      "title": "Owner"
    }
  }
}
