Affects: 5.1.9.RELEASE

For a specific call on the Spotify API with WebClient, the response is partially deserialize. That does not occur on other calls, even if the type is similar. This seem to be quite tricky, so I'm ready to give access to the full project, or demonstrate it during an Hangout call.

    public Mono<SpotifyWrapper<SpotifyAlbum>> getUserAlbums(SpotifyAccessToken accessToken, int page) {
        ParameterizedTypeReference<SpotifyWrapper<SpotifyAlbum>> type = new ParameterizedTypeReference<>() {
        };

        return spotifyWebClient.get()
            .uri(uriBuilder -> uriBuilder
                .path("/v1/me/albums")
                .queryParam("offset", page * DEFAULT_OFFSET)
                .queryParam("limit", DEFAULT_OFFSET)
                .build())
            .header("Authorization", accessToken.getHeader())
            .retrieve()
            .bodyToMono(type)
            .log();
    }

The final object value after every single call. The correct number of items are processed, but all objects in the items list have null or default value.

result = {SpotifyWrapper@11478} 
 items = {ArrayList@11480}  size = 1
  0 = {SpotifyAlbum@11483} 
   images = {ArrayList@11484}  size = 0
   copyrights = {ArrayList@11485}  size = 0
   releaseDatePrecision = null
   label = null
   type = null
   externalIds = null
   uri = null
   tracks = null
   artists = {ArrayList@11486}  size = 0
   releaseDate = null
   genres = {ArrayList@11487}  size = 0
   popularity = 0
   name = null
   albumType = null
   href = null
   id = null
   externalUrls = null
 href = "https://api.spotify.com/v1/me/albums?offset=0&limit=25"
 limit = 25
 offset = 0
 prevLink = null
 nextLink = null
 total = 1

Model classes used :

SpotifyWrapper

public class SpotifyWrapper<T> {
    @JsonProperty("items")
    private List<T> items = new ArrayList<>();

    @JsonProperty("href")
    private String href;

    @JsonProperty("limit")
    private int limit;

    @JsonProperty("offset")
    private int offset;

    @JsonProperty("previous")
    private String prevLink;

    @JsonProperty("next")
    private String nextLink;

    @JsonProperty("total")
    private int total;

    public List<T> getItems() {
        return items;
    }

    public void setItems(List<T> items) {
        this.items = items;
    }

// ... All every getters and setters

SpotifyAlbum

@JsonInclude(JsonInclude.Include.NON_NULL)
public class SpotifyAlbum {

    @JsonProperty("images")
    private List<ImagesItem> images = new ArrayList<>();

    @JsonProperty("copyrights")
    private List<CopyrightsItem> copyrights= new ArrayList<>();

    @JsonProperty("release_date_precision")
    private String releaseDatePrecision;

    @JsonProperty("label")
    private String label;

    @JsonProperty("type")
    private String type;

    @JsonProperty("external_ids")
    private Map<String, String> externalIds;

    @JsonProperty("uri")
    private String uri;

    @JsonProperty("tracks")
    private Tracks tracks;

    @JsonProperty("artists")
    private List<SpotifyArtist> artists = new ArrayList<>();

    @JsonProperty("release_date")
    private String releaseDate;

    @JsonProperty("genres")
    private List<Object> genres = new ArrayList<>();

    @JsonProperty("popularity")
    private int popularity;

    @JsonProperty("name")
    private String name;

    @JsonProperty("album_type")
    private String albumType;

    @JsonProperty("href")
    private String href;

    @JsonProperty("id")
    private String id;

    @JsonProperty("external_urls")
    private ExternalUrls externalUrls;

    public void setImages(List<ImagesItem> images) {
        this.images = images;
    }

    public List<ImagesItem> getImages() {
        return images;
    }

 //...Every getters and setters ....
}

Comment From: jlefebure

Nevermind, I missed an object in the original documentation. PEKBAK issue