Skip to content

Commit f16987b

Browse files
committed
fix: deserialize resource-group
1 parent d64c6b2 commit f16987b

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

backend/api-gateway/src/main/java/com/datamate/gateway/infrastructure/client/impl/OmsExtensionServiceImpl.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.datamate.gateway.infrastructure.client.OmsExtensionService;
55
import com.datamate.gateway.infrastructure.client.dto.ResourceGroup;
66
import com.datamate.gateway.infrastructure.client.dto.Resp;
7+
import com.fasterxml.jackson.databind.JavaType;
78
import com.fasterxml.jackson.databind.ObjectMapper;
89

910
import lombok.extern.slf4j.Slf4j;
@@ -61,8 +62,12 @@ public String getUserGroupId(String userName) {
6162
String responseBody = EntityUtils.toString(response.getEntity());
6263
log.info("response code: {}, response body: {}", response.getCode(), responseBody);
6364

65+
JavaType listType = objectMapper.getTypeFactory()
66+
.constructParametricType(List.class, ResourceGroup.class);
67+
JavaType respType = objectMapper.getTypeFactory()
68+
.constructParametricType(Resp.class, listType);
6469
Resp<List<ResourceGroup>> resp = objectMapper.readValue(responseBody,
65-
objectMapper.getTypeFactory().constructParametricType(Resp.class, List.class, ResourceGroup.class));
70+
objectMapper.getTypeFactory().constructParametricType(Resp.class, respType));
6671

6772
if (resp.data() == null || resp.data().isEmpty()) {
6873
return null;

0 commit comments

Comments
 (0)