Skip to content

Commit

Permalink
Add mapper to JSON client
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisLainez committed Apr 26, 2024
1 parent 99ab8a8 commit fb45adf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ dependencies {
implementation "com.fasterxml.jackson.module:jackson-module-afterburner"

testImplementation 'org.springframework.boot:spring-boot-starter-validation'

implementation "jakarta.ws.rs:jakarta.ws.rs-api:${revJAXRS}"
implementation 'jakarta.platform:jakarta.jakartaee-api:10.0.0' //Needed to jakarta.ws.rs-api

}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@
*/
package com.netflix.conductor.common.config;

import com.fasterxml.jackson.databind.module.SimpleModule;
import com.netflix.conductor.common.jackson.JsonProtoModule;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.module.afterburner.AfterburnerModule;
import jakarta.ws.rs.core.MultivaluedHashMap;
import jakarta.ws.rs.core.MultivaluedMap;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;

/**
* A Factory class for creating a customized {@link ObjectMapper}. This is only used by the
Expand Down Expand Up @@ -48,6 +53,10 @@ public ObjectMapper getObjectMapper() {
JsonInclude.Include.NON_NULL, JsonInclude.Include.ALWAYS));
objectMapper.registerModule(new JsonProtoModule());
objectMapper.registerModule(new AfterburnerModule());
SimpleModule module = new SimpleModule();
module.addAbstractTypeMapping(MultivaluedMap.class,
MultivaluedHashMap.class);
objectMapper.registerModule(module);
return objectMapper;
}
}

0 comments on commit fb45adf

Please sign in to comment.