-
Notifications
You must be signed in to change notification settings - Fork 9
Description
I noticed that the ladybug uses Jackson:
ladybug/ladybug-common/src/main/java/org/wearefrank/ladybug/web/common/ReportApiImpl.java
Lines 18 to 20 in 469e2b2
| import com.fasterxml.jackson.core.JsonProcessingException; | |
| import com.fasterxml.jackson.core.type.TypeReference; | |
| import com.fasterxml.jackson.databind.ObjectMapper; |
This depedency should be in the RS module.
ladybug/ladybug-common/pom.xml
Lines 17 to 20 in cc871f5
| <dependency> | |
| <groupId>com.fasterxml.jackson.jakarta.rs</groupId> | |
| <artifactId>jackson-jakarta-rs-json-provider</artifactId> | |
| </dependency> |
I would only expect the jackson-annotations dependency in the common module, as that's used to describe how to (de-)serialize classes/fields.
I noticed this bit of code in the ReportApiImpl that will break if my suggestions are to be implemented:
ladybug/ladybug-common/src/main/java/org/wearefrank/ladybug/web/common/ReportApiImpl.java
Lines 285 to 289 in 469e2b2
| if (variablesJson != null && !variablesJson.isEmpty()) { | |
| ObjectMapper mapper = new ObjectMapper(); | |
| variablesMap = mapper.readValue(variablesJson, new TypeReference<Map<String, String>>() { | |
| }); | |
| } |
But the mechanism is a bit odd as well. You should try to avoid using Map altogether and use a DTO instead (with the aforementioned annotations).