Skip to content

Commit a65d0b8

Browse files
fixed issues where import wouldn't get included
1 parent 3e95845 commit a65d0b8

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

  • modules/openapi-generator/src/main/java/org/openapitools/codegen/languages
  • samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -658,16 +658,6 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<Mo
658658
}
659659
}
660660

661-
if (SERIALIZATION_LIBRARY_JSON_SERIALIZABLE.equals(library)) {
662-
// built_value serialization uses Uint8List for all MultipartFile types
663-
// in json_serialization, MultipartFile is used as the file parameter type, but
664-
// MultipartFile isn't readable, instead we convert this to a Uin8List
665-
if (op.isResponseFile) {
666-
op.returnType = "Uint8List";
667-
op.returnBaseType = "Uint8List";
668-
}
669-
}
670-
671661
// The MultipartFile handling above changes the type of some parameters from
672662
// `UInt8List`, the default for files, to `MultipartFile`.
673663
//
@@ -680,6 +670,17 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<Mo
680670
op.imports.remove("Uint8List");
681671
}
682672

673+
if (SERIALIZATION_LIBRARY_JSON_SERIALIZABLE.equals(library)) {
674+
// built_value serialization uses Uint8List for all MultipartFile types
675+
// in json_serialization, MultipartFile is used as the file parameter type, but
676+
// MultipartFile isn't readable, instead we convert this to a Uin8List
677+
if (op.isResponseFile) {
678+
op.imports.add("Uint8List");
679+
op.returnType = "Uint8List";
680+
op.returnBaseType = "Uint8List";
681+
}
682+
}
683+
683684
resultImports.addAll(rewriteImports(op.imports, false));
684685

685686
if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(library)) {

samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/pet_api.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import 'dart:convert';
99
import 'package:openapi/src/deserialize.dart';
1010
import 'package:dio/dio.dart';
1111

12+
import 'dart:typed_data';
1213
import 'package:openapi/src/model/api_response.dart';
1314
import 'package:openapi/src/model/pet.dart';
1415

0 commit comments

Comments
 (0)