Skip to content

Commit

Permalink
attempt to use Jackson.newObjectMapper()
Browse files Browse the repository at this point in the history
  • Loading branch information
akphi committed Apr 14, 2023
1 parent 4fcb18c commit e345555
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 22 deletions.
8 changes: 4 additions & 4 deletions legend-sdlc-server-shared/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-healthchecks</artifactId>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-jackson</artifactId>
</dependency>

<dependency>
<groupId>io.prometheus</groupId>
Expand Down Expand Up @@ -158,10 +162,6 @@
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>

<!-- TEST -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
import io.dropwizard.jackson.Jackson;

import javax.ws.rs.ext.ContextResolver;

public class BaseServerJacksonJsonProvider extends JacksonJsonProvider implements ContextResolver<ObjectMapper>
{
private final ObjectMapper objectMapper = new ObjectMapper()
.registerModule(new JavaTimeModule())
private final ObjectMapper objectMapper = Jackson.newObjectMapper()
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);

@Override
Expand Down
8 changes: 4 additions & 4 deletions legend-sdlc-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>

<dependency>
<groupId>com.google.inject</groupId>
Expand Down Expand Up @@ -231,6 +227,10 @@
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-healthchecks</artifactId>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-jackson</artifactId>
</dependency>

<dependency>
<groupId>io.swagger</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
import io.dropwizard.jackson.Jackson;
import org.finos.legend.sdlc.domain.model.entity.Entity;
import org.finos.legend.sdlc.domain.model.project.Project;
import org.finos.legend.sdlc.domain.model.project.configuration.ProjectDependency;
Expand All @@ -33,8 +33,7 @@

public class LegendSDLCServerForTestJacksonJsonProvider extends JacksonJsonProvider implements ContextResolver<ObjectMapper>
{
private final ObjectMapper objectMapper = new ObjectMapper()
.registerModule(new JavaTimeModule())
private final ObjectMapper objectMapper = Jackson.newObjectMapper()
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.addMixIn(Project.class, InMemoryMixins.Project.class)
.addMixIn(Workspace.class, InMemoryMixins.Workspace.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
import io.dropwizard.jackson.Jackson;
import org.finos.legend.sdlc.domain.model.entity.Entity;
import org.finos.legend.sdlc.domain.model.project.Project;
import org.finos.legend.sdlc.domain.model.project.configuration.ProjectDependency;
Expand Down Expand Up @@ -74,8 +74,7 @@ private Client createClient()

static class SDLCServerClientRuleJacksonJsonProvider extends JacksonJsonProvider implements ContextResolver<ObjectMapper>
{
private final ObjectMapper objectMapper = new ObjectMapper()
.registerModule(new JavaTimeModule())
private final ObjectMapper objectMapper = Jackson.newObjectMapper()
.enable(SerializationFeature.INDENT_OUTPUT)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.setSerializationInclusion(JsonInclude.Include.NON_NULL)
Expand Down
5 changes: 0 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -832,11 +832,6 @@
<version>${legend.engine.version}</version>
</dependency>
<!-- External dependencies -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
Expand Down

0 comments on commit e345555

Please sign in to comment.