Skip to content

Commit 3940028

Browse files
committed
Use DateOnlySerializer when appropriate
1 parent de79457 commit 3940028

File tree

11 files changed

+38
-11
lines changed

11 files changed

+38
-11
lines changed

Diff for: gitlab4j-models/src/main/java/org/gitlab4j/api/models/AbstractEpic.java

+8
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.fasterxml.jackson.annotation.JsonIgnore;
1313
import com.fasterxml.jackson.annotation.JsonProperty;
1414
import com.fasterxml.jackson.annotation.JsonValue;
15+
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
1516

1617
public class AbstractEpic<E extends AbstractEpic<E>> extends AbstractMinimalEpic<E> implements Serializable {
1718
private static final long serialVersionUID = 1L;
@@ -45,9 +46,16 @@ public String toString() {
4546
private References references;
4647
private Author author;
4748
private List<String> labels;
49+
50+
@JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
4851
private Date startDate;
52+
53+
@JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
4954
private Date dueDate;
55+
56+
@JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
5057
private Date endDate;
58+
5159
private Date createdAt;
5260
private Date updatedAt;
5361
private Date closedAt;

Diff for: gitlab4j-models/src/main/java/org/gitlab4j/api/models/Epic.java

+5
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@
44

55
import org.gitlab4j.models.utils.JacksonJson;
66

7+
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
8+
79
public class Epic extends AbstractEpic<Epic> {
810
private static final long serialVersionUID = 1L;
911

1012
private Boolean startDateIsFixed;
1113
private Boolean dueDateIsFixed;
14+
15+
@JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
1216
private Date dueDateFromInheritedSource;
17+
1318
private Boolean subscribed;
1419

1520
public Boolean getStartDateIsFixed() {

Diff for: gitlab4j-models/src/main/java/org/gitlab4j/api/models/ImpersonationToken.java

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import com.fasterxml.jackson.annotation.JsonCreator;
1111
import com.fasterxml.jackson.annotation.JsonValue;
12+
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
1213

1314
public class ImpersonationToken implements Serializable {
1415
private static final long serialVersionUID = 1L;
@@ -52,6 +53,8 @@ public String toString() {
5253
private Date createdAt;
5354
private Date lastUsedAt;
5455
private Boolean impersonation;
56+
57+
@JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
5558
private Date expiresAt;
5659

5760
public Boolean getActive() {

Diff for: gitlab4j-models/src/main/java/org/gitlab4j/api/models/ProjectAccessToken.java

+5
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,18 @@
77
import org.gitlab4j.models.Constants;
88
import org.gitlab4j.models.utils.JacksonJson;
99

10+
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
11+
1012
public class ProjectAccessToken implements Serializable {
1113
private static final long serialVersionUID = 1L;
1214

1315
private Long userId;
1416
private List<Constants.ProjectAccessTokenScope> scopes;
1517
private String name;
18+
19+
@JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
1620
private Date expiresAt;
21+
1722
private Long id;
1823
private Boolean active;
1924
private Date createdAt;

Diff for: gitlab4j-models/src/main/java/org/gitlab4j/api/models/RelatedEpic.java

+5
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@
44

55
import org.gitlab4j.models.utils.JacksonJson;
66

7+
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
8+
79
public class RelatedEpic extends AbstractEpic<RelatedEpic> {
810
private static final long serialVersionUID = 1L;
911

1012
private Boolean startDateIsFixed;
1113
private Boolean dueDateIsFixed;
14+
15+
@JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
1216
private Date dueDateFromInheritedSource;
17+
1318
private Long relatedEpicLinkId;
1419
private LinkType linkType;
1520
private Date linkCreatedAt;

Diff for: gitlab4j-models/src/test/resources/org/gitlab4j/models/child-epic.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222
"avatar_url": "http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon",
2323
"web_url": "http://gitlab.example.com/arnita"
2424
},
25-
"start_date": "2018-07-01T00:00:00Z",
26-
"due_date": "2018-07-31T00:00:00Z",
25+
"start_date": "2024-12-01",
26+
"end_date": "2024-12-31",
27+
"due_date": "2024-12-31",
2728
"created_at": "2018-07-17T13:36:22.770Z",
2829
"updated_at": "2018-07-18T12:22:05.239Z",
2930
"closed_at": "2018-08-18T12:22:05.239Z",

Diff for: gitlab4j-models/src/test/resources/org/gitlab4j/models/epic.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
"avatar_url": "http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon",
2323
"web_url": "http://gitlab.example.com/arnita"
2424
},
25-
"start_date": "2018-07-01T00:00:00Z",
25+
"start_date": "2018-07-01",
2626
"start_date_is_fixed": false,
27-
"due_date": "2018-07-31T00:00:00Z",
27+
"due_date": "2018-07-31",
2828
"due_date_is_fixed": false,
29-
"due_date_from_inherited_source": "2018-07-31T00:00:00Z",
29+
"due_date_from_inherited_source": "2018-07-31",
3030
"created_at": "2018-07-17T13:36:22.770Z",
3131
"updated_at": "2018-07-18T12:22:05.239Z",
3232
"closed_at": "2018-08-18T12:22:05.239Z",

Diff for: gitlab4j-models/src/test/resources/org/gitlab4j/models/group-access-token.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
"user_id": 79,
1212
"last_used_at": "2023-09-28T19:26:26.675Z",
1313
"active": true,
14-
"expires_at": "2024-06-18T00:00:00Z",
14+
"expires_at": "2024-06-18",
1515
"access_level": 40
1616
}

Diff for: gitlab4j-models/src/test/resources/org/gitlab4j/models/impersonation-token.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
"last_used_at": "2018-03-17T17:19:28.697Z",
1212
"id" : 3,
1313
"impersonation" : true,
14-
"expires_at" : "2017-04-14T00:00:00Z"
14+
"expires_at" : "2017-04-14"
1515
}

Diff for: gitlab4j-models/src/test/resources/org/gitlab4j/models/project-access-token.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"read_repository"
66
],
77
"name" : "Project Access Token Name",
8-
"expires_at" : "2021-01-31T00:00:00Z",
8+
"expires_at" : "2021-01-31",
99
"id" : 10,
1010
"active" : true,
1111
"created_at" : "2021-01-20T22:11:48.151Z",

Diff for: gitlab4j-models/src/test/resources/org/gitlab4j/models/related-epics.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
"avatar_url": "http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon",
2424
"web_url": "http://gitlab.example.com/arnita"
2525
},
26-
"start_date": "2018-07-01T00:00:00Z",
26+
"start_date": "2018-07-01",
2727
"start_date_is_fixed": false,
28-
"due_date": "2018-07-31T00:00:00Z",
28+
"due_date": "2018-07-31",
2929
"due_date_is_fixed": false,
30-
"due_date_from_inherited_source": "2018-07-31T00:00:00Z",
30+
"due_date_from_inherited_source": "2018-07-31",
3131
"created_at": "2018-07-17T13:36:22.770Z",
3232
"updated_at": "2018-07-18T12:22:05.239Z",
3333
"closed_at": "2018-08-18T12:22:05.239Z",

0 commit comments

Comments
 (0)