|
1 | 1 | package com.dabsquared.gitlabjenkins.gitlab; |
2 | 2 |
|
| 3 | +import com.fasterxml.jackson.databind.DeserializationFeature; |
| 4 | +import com.fasterxml.jackson.databind.ObjectMapper; |
| 5 | +import com.fasterxml.jackson.databind.PropertyNamingStrategies; |
3 | 6 | import jakarta.ws.rs.Consumes; |
4 | 7 | import jakarta.ws.rs.Produces; |
5 | 8 | import jakarta.ws.rs.core.MediaType; |
6 | 9 | import jakarta.ws.rs.ext.ContextResolver; |
7 | 10 | import jakarta.ws.rs.ext.Provider; |
8 | | -import tools.jackson.databind.ObjectMapper; |
9 | | -import tools.jackson.databind.PropertyNamingStrategies; |
10 | | -import tools.jackson.databind.cfg.EnumFeature; |
11 | | -import tools.jackson.databind.json.JsonMapper; |
12 | 11 |
|
13 | 12 | /** |
14 | 13 | * @author Robin Müller |
|
18 | 17 | @Produces(MediaType.APPLICATION_JSON) |
19 | 18 | public class JacksonConfig implements ContextResolver<ObjectMapper> { |
20 | 19 | public ObjectMapper getContext(Class<?> type) { |
21 | | - return JsonMapper.builder() |
22 | | - .propertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE) |
23 | | - .configure(EnumFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true) |
24 | | - .build(); |
| 20 | + return new ObjectMapper() |
| 21 | + .setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE) |
| 22 | + .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) |
| 23 | + .configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true); |
25 | 24 | } |
26 | 25 | } |
0 commit comments