Skip to content

Commit 557b0f2

Browse files
authored
Merge pull request #121 from connyduck/patch-1
add @JsonIgnore to Element.parent
2 parents 2e1c512 + b4b63c8 commit 557b0f2

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

kontent-delivery/src/main/java/kentico/kontent/delivery/Element.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
package kentico.kontent.delivery;
2626

27+
import com.fasterxml.jackson.annotation.JsonIgnore;
2728
import com.fasterxml.jackson.annotation.JsonProperty;
2829
import com.fasterxml.jackson.annotation.JsonSubTypes;
2930
import com.fasterxml.jackson.annotation.JsonTypeInfo;
@@ -96,6 +97,7 @@ public abstract class Element<T> {
9697
* @param parent the parent to this
9798
* @return the parent to this
9899
*/
100+
@JsonIgnore
99101
ContentItem parent;
100102

101103
/**

kontent-delivery/src/test/java/kentico/kontent/delivery/JacksonBindingsTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,19 @@ public void testContentItemDeserialization() throws IOException {
145145

146146
}
147147

148+
@Test
149+
public void testContentItemSerialization() throws IOException {
150+
ContentItemResponse response = objectMapper.readValue(
151+
this.getClass().getResource("SampleContentItem.json"), ContentItemResponse.class);
152+
153+
String serializedContentItemResponse = objectMapper.writeValueAsString(response);
154+
155+
ContentItemResponse response2 = objectMapper.readValue(
156+
serializedContentItemResponse, ContentItemResponse.class);
157+
158+
Assert.assertEquals(response, response2);
159+
}
160+
148161
@Test
149162
public void testContentTypeListDeserialization() throws IOException {
150163
ContentTypesListingResponse response = objectMapper.readValue(

0 commit comments

Comments
 (0)