#1147 - Make sure we explicitly expose all media type model properties.

Jackson can be configured to not auto-detect properties on objects to be rendered, requiring them to be explicitly annotated with @JsonProperty to be exposed. In such a configuration setup, some of our model types do not work properly as so far we have expected public properties to be included automatically.

This commit changes that to explicitly include @JsonProperty on all of the getter methods exposed.
This commit is contained in:
Oliver Drotbohm
2019-12-09 09:38:19 +01:00
parent 452189edd8
commit 7744bda4b1
11 changed files with 41 additions and 12 deletions

View File

@@ -37,6 +37,7 @@ import org.springframework.util.StringUtils;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Value object for links.
@@ -46,9 +47,9 @@ import com.fasterxml.jackson.annotation.JsonInclude;
* @author Jens Schauder
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(value = "templated", ignoreUnknown = true)
@JsonIgnoreProperties(value = { "templated", "template" }, ignoreUnknown = true)
@AllArgsConstructor(access = AccessLevel.PACKAGE)
@Getter
@Getter(onMethod = @__(@JsonProperty))
@EqualsAndHashCode(
of = { "rel", "href", "hreflang", "media", "title", "type", "deprecation", "profile", "name", "affordances" })
public class Link implements Serializable {