Skip to content

Commit cbc27b6

Browse files
committed
Merge remote-tracking branch 'origin/main' into 6.x
2 parents 45d6da0 + 80abfca commit cbc27b6

File tree

3 files changed

+38
-21
lines changed

3 files changed

+38
-21
lines changed

src/main/java/org/gitlab4j/api/systemhooks/MergeRequestSystemHookEvent.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22

33
import org.gitlab4j.api.webhook.MergeRequestEvent;
44

5+
import com.fasterxml.jackson.annotation.JsonIgnore;
6+
57
public class MergeRequestSystemHookEvent extends MergeRequestEvent implements SystemHookEvent {
68
private static final long serialVersionUID = 1L;
79

810
public static final String X_GITLAB_EVENT = "System Hook";
911
public static final String MERGE_REQUEST_EVENT = "merge_request";
1012

1113
private String eventType;
14+
private String eventName;
1215

1316
@Override
1417
public String getObjectKind() {
@@ -17,14 +20,28 @@ public String getObjectKind() {
1720

1821
@Override
1922
public String getEventName() {
20-
return (MERGE_REQUEST_EVENT);
23+
return eventName;
24+
}
25+
26+
public void setEventName(String eventName) {
27+
this.eventName = eventName;
2128
}
2229

2330
public String getEventType() {
2431
return eventType;
2532
}
33+
34+
public void setEventType(String eventType) {
35+
this.eventType = eventType;
36+
}
2637

38+
/**
39+
* @deprecated use {@link #setEventType(String)} instead
40+
* @param eventType
41+
*/
42+
@Deprecated
43+
@JsonIgnore
2744
public void setEvent_type(String eventType) {
28-
this.eventType = eventType;
45+
setEventType(eventType);
2946
}
3047
}

src/test/java/org/gitlab4j/api/JsonUtils.java

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

2323
import com.fasterxml.jackson.core.JsonParseException;
2424
import com.fasterxml.jackson.core.JsonProcessingException;
25+
import com.fasterxml.jackson.databind.DeserializationFeature;
2526
import com.fasterxml.jackson.databind.JsonMappingException;
2627
import com.fasterxml.jackson.databind.JsonNode;
2728
import com.fasterxml.jackson.databind.MapperFeature;
@@ -34,6 +35,7 @@ public class JsonUtils {
3435
jacksonJson = new JacksonJson();
3536
jacksonJson.getObjectMapper().configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
3637
jacksonJson.getObjectMapper().configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true);
38+
jacksonJson.getObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true);
3739
}
3840

3941
static JsonNode readTreeFromMap(Map<String, Object> map) throws JsonParseException, JsonMappingException, IOException {
Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
{
2-
"commit": {
3-
"id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c",
4-
"parents": [{ "id": "4ad91d3c1144c406e50c7b33bae684bd6837faf8" }],
5-
"tree": "46e82de44b1061621357f24c05515327f2795a95",
6-
"message": "add projects API",
7-
"author": {
8-
"name": "John Smith",
9-
"email": "[email protected]"
10-
},
11-
"committer": {
12-
"name": "John Smith",
13-
"email": "[email protected]"
14-
},
15-
"authored_date": "2012-06-27T12:51:39Z",
16-
"committed_date": "2012-06-28T10:44:20Z"
17-
},
18-
"protected": true
1+
{
2+
"commit": {
3+
"author_email": "[email protected]",
4+
"author_name": "John Smith",
5+
"authored_date": "2012-06-27T05:51:39Z",
6+
"committed_date": "2012-06-28T03:44:20Z",
7+
"committer_email": "[email protected]",
8+
"committer_name": "John Smith",
9+
"id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c",
10+
"short_id": "7b5c3cc",
11+
"title": "add projects API",
12+
"message": "add projects API",
13+
"parent_ids": [
14+
"4ad91d3c1144c406e50c7b33bae684bd6837faf8"
15+
]
16+
},
17+
"protected": true
1918
}
20-

0 commit comments

Comments
 (0)