#667 - Ignore unknown properties in LinkMixin.
In HAL-based documents (HAL and HAL-FORMS), the "templated" property must be ignored in LinkMixin, because that's where it is applied. Removes the need for a no-op `setTemplated` method in Link. * Test cases drafted for both HAL an HAL-FORMS to verify proper behavior. * Jackson2HalFormsIntegrationTest migrated from Hamcrest to AssertJ assertions. Related pull requests: #668
This commit is contained in:
@@ -221,18 +221,6 @@ public class Link implements Serializable {
|
||||
return !getUriTemplate().getVariables().isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* This no-op setter is required to deserialize a link that contains a templated URL. It allows Jackson to
|
||||
* "set" the property, but since {@code templated} is a virtual property, the injected value {@code true} or
|
||||
* {@code false) is ignored.
|
||||
*
|
||||
* The method is kept private so no one attempts to actually use it.
|
||||
*
|
||||
* @param __ - don't care what value is passed in. The true value {@link #isTemplated()} is based upon the {@link UriTemplate}.
|
||||
*/
|
||||
private void setTemplated(boolean __) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns the current template into a {@link Link} by expanding it using the given parameters.
|
||||
*
|
||||
|
||||
@@ -30,7 +30,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
* @author Oliver Gierke
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
@JsonIgnoreProperties({ "rel", "media", "affordances", "template" })
|
||||
@JsonIgnoreProperties(value = { "rel", "media", "affordances", "template" }, ignoreUnknown = true)
|
||||
public abstract class LinkMixin extends Link {
|
||||
|
||||
private static final long serialVersionUID = 4720588561299667409L;
|
||||
|
||||
Reference in New Issue
Block a user