File tree Expand file tree Collapse file tree
src/main/java/com/afrozaar/wordpress/wpapi/v2 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33
44 <groupId >com.afrozaar.wordpress</groupId >
55 <artifactId >wp-api-v2-client-java</artifactId >
6- <version >4.10 .0</version >
6+ <version >4.11 .0</version >
77
88 <packaging >jar</packaging >
99
Original file line number Diff line number Diff line change 4444public class Post {
4545
4646 @ JsonProperty ("author" )
47- private Long author ;
47+ private List < Long > author = new ArrayList <>() ;
4848 @ JsonProperty ("content" )
4949 private Content content ;
5050 @ JsonProperty ("status" )
@@ -101,13 +101,11 @@ public void setCategoryIds(List<Long> categoryIds) {
101101 this .categoryIds = categoryIds ;
102102 }
103103
104- @ JsonProperty ("author" )
105104 public Long getAuthor () {
106- return author ;
105+ return author . size () > 0 ? author . get ( 0 ) : null ;
107106 }
108107
109- @ JsonProperty ("author" )
110- public void setAuthor (Long author ) {
108+ public void setAuthor (List <Long > author ) {
111109 this .author = author ;
112110 }
113111
Original file line number Diff line number Diff line change 1010import com .afrozaar .wordpress .wpapi .v2 .model .Title ;
1111
1212import java .util .Arrays ;
13+ import java .util .Collections ;
1314import java .util .List ;
1415
1516/**
@@ -183,7 +184,7 @@ public PostBuilder but() {
183184
184185 public Post build () {
185186 Post post = new Post ();
186- post .setAuthor (author );
187+ post .setAuthor (Collections . singletonList ( author ) );
187188 post .setId (id );
188189 post .setTitle (title );
189190 post .setLinks (Links );
Original file line number Diff line number Diff line change 77
88import org .springframework .http .HttpStatus ;
99import org .springframework .http .ResponseEntity ;
10+ import org .springframework .http .converter .json .Jackson2ObjectMapperBuilder ;
1011import org .springframework .web .client .HttpClientErrorException ;
1112
13+ import com .fasterxml .jackson .databind .DeserializationFeature ;
1214import com .fasterxml .jackson .databind .JsonNode ;
1315import com .fasterxml .jackson .databind .ObjectMapper ;
1416import com .fasterxml .jackson .databind .node .ObjectNode ;
15-
1617import org .slf4j .Logger ;
1718import org .slf4j .LoggerFactory ;
1819
@@ -41,7 +42,7 @@ public final class CustomRenderableParser {
4142 private static final Logger LOG = LoggerFactory .getLogger (CustomRenderableParser .class );
4243 public static final String FIELD_PREVIOUS = "previous" ;
4344 public static final String FIELD_DELETED = "deleted" ;
44- private static ObjectMapper objectMapper = new ObjectMapper ();
45+ private static ObjectMapper objectMapper = Jackson2ObjectMapperBuilder . json (). featuresToEnable ( DeserializationFeature . ACCEPT_SINGLE_VALUE_AS_ARRAY ). build ();
4546 private static final Set <String > modifiableFields = new HashSet <>(Arrays .asList ("description" , "caption" ));
4647 private static final String RENDERED = "rendered" ;
4748 private static final String RAW = "raw" ;
You can’t perform that action at this time.
0 commit comments