forked from loafle/openapi-generator-original
9955 dart-dio-next only remove typed_data import if safe (#9956)
This commit is contained in:
@@ -322,6 +322,18 @@ public class DartDioNextClientCodegen extends AbstractDartCodegen {
|
||||
}
|
||||
}
|
||||
|
||||
// the MultipartFile handling above changes the type of some parameters from
|
||||
// `UInt8List`, the default for files, to `MultipartFile`.
|
||||
//
|
||||
// The following block removes the required import for Uint8List if it is no
|
||||
// longer in use.
|
||||
if (op.allParams.stream().noneMatch(param -> param.dataType.equals("Uint8List"))
|
||||
&& op.responses.stream().filter(response -> response.dataType != null)
|
||||
.noneMatch(response -> response.dataType.equals("Uint8List"))) {
|
||||
// Remove unused imports after processing
|
||||
op.imports.remove("Uint8List");
|
||||
}
|
||||
|
||||
for (CodegenParameter param : op.bodyParams) {
|
||||
if (param.isContainer) {
|
||||
final Map<String, Object> serializer = new HashMap<>();
|
||||
@@ -333,11 +345,6 @@ public class DartDioNextClientCodegen extends AbstractDartCodegen {
|
||||
}
|
||||
}
|
||||
|
||||
if (op.allParams.stream().noneMatch(param -> param.dataType.equals("Uint8List"))) {
|
||||
// Remove unused imports after processing
|
||||
op.imports.remove("Uint8List");
|
||||
}
|
||||
|
||||
resultImports.addAll(rewriteImports(op.imports, false));
|
||||
if (op.getHasFormParams() || op.getHasQueryParams()) {
|
||||
resultImports.add("package:" + pubName + "/src/api_util.dart");
|
||||
|
||||
Reference in New Issue
Block a user