From e6baaef299b290a0ffbea29084b3b3235b7647e7 Mon Sep 17 00:00:00 2001 From: Hammy Date: Sun, 6 Jun 2021 04:24:43 +0100 Subject: [PATCH] Add new constructor with @JsonCreator annotation As the API is inconsistent, the Studio object within the Waifu endpoint was returning a String, this implementation allows Jackson to instantiate the Studio class even if a String was returned --- src/main/java/org/goudham/me/api/entity/Studio.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/goudham/me/api/entity/Studio.java b/src/main/java/org/goudham/me/api/entity/Studio.java index dbe47fa..29894bd 100644 --- a/src/main/java/org/goudham/me/api/entity/Studio.java +++ b/src/main/java/org/goudham/me/api/entity/Studio.java @@ -2,10 +2,7 @@ package org.goudham.me.api.entity; import javax.annotation.processing.Generated; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyDescription; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.*; import java.util.Objects; @@ -29,6 +26,12 @@ import java.util.Objects; }) @Generated("jsonschema2pojo") public class Studio { + + @JsonCreator + Studio(String name) { + this.name = name; + } + /** * {@link Studio} ID */