forked from loafle/openapi-generator-original
Fix dictionary/map deserialization (#19496)
This commit is contained in:
parent
1b30c1995f
commit
ff1fe256d8
@ -52,13 +52,13 @@ final _regMap = RegExp(r'^Map<String,(.*)>$');
|
|||||||
.toSet() as ReturnType;
|
.toSet() as ReturnType;
|
||||||
}
|
}
|
||||||
if (value is Map && (match = _regMap.firstMatch(targetType)) != null) {
|
if (value is Map && (match = _regMap.firstMatch(targetType)) != null) {
|
||||||
targetType = match![1]!; // ignore: parameter_assignments
|
targetType = match![1]!.trim(); // ignore: parameter_assignments
|
||||||
return Map<dynamic, BaseType>.fromIterables(
|
return Map<String, BaseType>.fromIterables(
|
||||||
value.keys,
|
value.keys as Iterable<String>,
|
||||||
value.values.map((dynamic v) => deserialize<BaseType, BaseType>(v, targetType, growable: growable)),
|
value.values.map((dynamic v) => deserialize<BaseType, BaseType>(v, targetType, growable: growable)),
|
||||||
) as ReturnType;
|
) as ReturnType;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
throw Exception('Cannot deserialize');
|
throw Exception('Cannot deserialize');
|
||||||
}
|
}
|
@ -183,13 +183,13 @@ final _regMap = RegExp(r'^Map<String,(.*)>$');
|
|||||||
.toSet() as ReturnType;
|
.toSet() as ReturnType;
|
||||||
}
|
}
|
||||||
if (value is Map && (match = _regMap.firstMatch(targetType)) != null) {
|
if (value is Map && (match = _regMap.firstMatch(targetType)) != null) {
|
||||||
targetType = match![1]!; // ignore: parameter_assignments
|
targetType = match![1]!.trim(); // ignore: parameter_assignments
|
||||||
return Map<dynamic, BaseType>.fromIterables(
|
return Map<String, BaseType>.fromIterables(
|
||||||
value.keys,
|
value.keys as Iterable<String>,
|
||||||
value.values.map((dynamic v) => deserialize<BaseType, BaseType>(v, targetType, growable: growable)),
|
value.values.map((dynamic v) => deserialize<BaseType, BaseType>(v, targetType, growable: growable)),
|
||||||
) as ReturnType;
|
) as ReturnType;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
throw Exception('Cannot deserialize');
|
throw Exception('Cannot deserialize');
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user