forked from loafle/openapi-generator-original
Fixed bug that did not allow json arrays to be deserialized by Jackson
This commit is contained in:
parent
97fca910a1
commit
5fa98b12b8
@ -51,8 +51,11 @@ public class ApiInvoker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Object deserialize(String json, String containerType, Class cls) throws ApiException {
|
public static Object deserialize(String json, String containerType, Class cls) throws ApiException {
|
||||||
|
if(null != containerType) {
|
||||||
|
containerType = containerType.toLowerCase();
|
||||||
|
}
|
||||||
try{
|
try{
|
||||||
if("List".equals(containerType)) {
|
if("list".equals(containerType) || "array".equals(containerType)) {
|
||||||
JavaType typeInfo = JsonUtil.getJsonMapper().getTypeFactory().constructCollectionType(List.class, cls);
|
JavaType typeInfo = JsonUtil.getJsonMapper().getTypeFactory().constructCollectionType(List.class, cls);
|
||||||
List response = (List<?>) JsonUtil.getJsonMapper().readValue(json, typeInfo);
|
List response = (List<?>) JsonUtil.getJsonMapper().readValue(json, typeInfo);
|
||||||
return response;
|
return response;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user