Skip to content

Ladybug uses (wrong) Jackson dependency in common #618

@nielsm5

Description

@nielsm5

I noticed that the ladybug uses Jackson:

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.

<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:

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions