diff --git a/.github/workflows/samples-dart.yaml b/.github/workflows/samples-dart.yaml index 229b0c48813..21c06d2ba2e 100644 --- a/.github/workflows/samples-dart.yaml +++ b/.github/workflows/samples-dart.yaml @@ -40,7 +40,7 @@ jobs: key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('samples/**/pubspec.yaml') }} - uses: dart-lang/setup-dart@v1 with: - sdk: 2.14.0 + sdk: 2.15.0 - name: Run tests uses: ./.github/actions/run-samples with: diff --git a/docs/generators/dart-dio.md b/docs/generators/dart-dio.md index eee69cd87ea..486f4d5b782 100644 --- a/docs/generators/dart-dio.md +++ b/docs/generators/dart-dio.md @@ -11,7 +11,7 @@ title: Documentation for the dart-dio Generator | generator type | CLIENT | | | generator language | Dart | | | generator default templating engine | mustache | | -| helpTxt | Generates a Dart Dio client library with null-safety. | | +| helpTxt | Generates a Dart Dio client library. | | ## CONFIG OPTIONS These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details. diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java index 11495fd7672..9ddfc6e42c9 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java @@ -25,7 +25,6 @@ import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.*; -import java.util.stream.Collectors; import java.util.stream.Stream; import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java index 08452842365..4cc8fddad64 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java @@ -47,9 +47,7 @@ import org.slf4j.LoggerFactory; import java.io.File; import java.util.*; -import java.util.Map.Entry; import java.util.stream.Collectors; -import java.util.stream.Stream; import static org.openapitools.codegen.utils.StringUtils.underscore; @@ -109,14 +107,14 @@ public class DartDioClientCodegen extends AbstractDartCodegen { serializationLibrary.setDefault(SERIALIZATION_LIBRARY_DEFAULT); cliOptions.add(serializationLibrary); - final CliOption finalProperties = CliOption.newBoolean(FINAL_PROPERTIES, "Whether properties are marked as final when using Json Serializable for serialization"); - finalProperties.setDefault("true"); - cliOptions.add(finalProperties); - // Date Library Option final CliOption dateOption = CliOption.newString(DATE_LIBRARY, "Specify Date library"); dateOption.setDefault(DATE_LIBRARY_DEFAULT); + final CliOption finalProperties = CliOption.newBoolean(FINAL_PROPERTIES, "Whether properties are marked as final when using Json Serializable for serialization"); + finalProperties.setDefault("true"); + cliOptions.add(finalProperties); + final Map dateOptions = new HashMap<>(); dateOptions.put(DATE_LIBRARY_CORE, "[DEFAULT] Dart core library (DateTime)"); dateOptions.put(DATE_LIBRARY_TIME_MACHINE, "Time Machine is date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing."); @@ -147,7 +145,7 @@ public class DartDioClientCodegen extends AbstractDartCodegen { @Override public String getHelp() { - return "Generates a Dart Dio client library with null-safety."; + return "Generates a Dart Dio client library."; } @Override @@ -672,7 +670,6 @@ public class DartDioClientCodegen extends AbstractDartCodegen { } } - resultImports.addAll(rewriteImports(op.imports, false)); if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(library) && (op.getHasFormParams() || op.getHasQueryParams())) { resultImports.add("package:" + pubName + "/" + sourceFolder + "/api_util.dart"); } diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/README.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/README.mustache index 3efaca1cb66..588bf414ab9 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/README.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/README.mustache @@ -19,8 +19,11 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) ## Requirements -* Dart 2.12.0 or later OR Flutter 1.26.0 or later -* Dio 4.0.0+ +* Dart 2.15.0+ or Flutter 2.8.0+ +* Dio 5.0.0+ (https://pub.dev/packages/dio) +{{#useJsonSerializable}} +* JSON Serializable 6.1.5+ (https://pub.dev/packages/json_serializable) +{{/useJsonSerializable}} {{#useDateLibTimeMachine}} * timemachine option currently **DOES NOT** support sound null-safety and may not work {{/useDateLibTimeMachine}} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/api.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/api.mustache index 892cbafd469..86a3a87162a 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/api.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/api.mustache @@ -99,9 +99,10 @@ class {{classname}} { _path,{{#hasQueryParams}} queryParameters: _queryParameters,{{/hasQueryParams}} ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); }{{/hasBodyOrFormParams}} final _response = await _dio.request( @@ -123,9 +124,10 @@ class {{classname}} { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response<{{{returnType}}}>( diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/api_client.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/api_client.mustache index 0903a48759e..d0cc2dfb209 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/api_client.mustache @@ -25,8 +25,8 @@ class {{clientName}} { this.dio = dio ?? Dio(BaseOptions( baseUrl: basePathOverride ?? basePath, - connectTimeout: 5000, - receiveTimeout: 3000, + connectTimeout: const Duration(milliseconds: 5000), + receiveTimeout: const Duration(milliseconds: 3000), )) { if (interceptors == null) { this.dio.interceptors.addAll([ diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/pubspec.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/pubspec.mustache index 4faed4e3dc4..07d0b317dd3 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/pubspec.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/pubspec.mustache @@ -4,15 +4,10 @@ description: {{pubDescription}} homepage: {{pubHomepage}} environment: -{{#useBuiltValue}} - sdk: '>=2.12.0 <3.0.0' -{{/useBuiltValue}} -{{#useJsonSerializable}} - sdk: '>=2.14.0 <3.0.0' -{{/useJsonSerializable}} + sdk: '>=2.15.0 <3.0.0' dependencies: - dio: '>=4.0.1 <5.0.0' + dio: '^5.0.0' {{#useBuiltValue}} one_of: '>=1.5.0 <2.0.0' one_of_serializer: '>=1.5.0 <2.0.0' diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/README.md b/samples/openapi3/client/petstore/dart-dio/oneof/README.md index 53bfd08fec4..0c32bd3fdab 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof/README.md +++ b/samples/openapi3/client/petstore/dart-dio/oneof/README.md @@ -8,8 +8,8 @@ This Dart package is automatically generated by the [OpenAPI Generator](https:// ## Requirements -* Dart 2.12.0 or later OR Flutter 1.26.0 or later -* Dio 4.0.0+ +* Dart 2.15.0+ or Flutter 2.8.0+ +* Dio 5.0.0+ (https://pub.dev/packages/dio) ## Installation & Usage diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/api.dart b/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/api.dart index ba9424a2d2a..dfd8e847bdd 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/api.dart +++ b/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/api.dart @@ -26,8 +26,8 @@ class Openapi { this.dio = dio ?? Dio(BaseOptions( baseUrl: basePathOverride ?? basePath, - connectTimeout: 5000, - receiveTimeout: 3000, + connectTimeout: const Duration(milliseconds: 5000), + receiveTimeout: const Duration(milliseconds: 3000), )) { if (interceptors == null) { this.dio.interceptors.addAll([ diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/api/default_api.dart b/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/api/default_api.dart index e98b7ae9cae..845411e8c9c 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/api/default_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/api/default_api.dart @@ -72,9 +72,10 @@ class DefaultApi { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/pubspec.yaml b/samples/openapi3/client/petstore/dart-dio/oneof/pubspec.yaml index fb676f65c39..3cc6bce70ed 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof/pubspec.yaml +++ b/samples/openapi3/client/petstore/dart-dio/oneof/pubspec.yaml @@ -4,10 +4,10 @@ description: OpenAPI API client homepage: homepage environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: - dio: '>=4.0.1 <5.0.0' + dio: '^5.0.0' one_of: '>=1.5.0 <2.0.0' one_of_serializer: '>=1.5.0 <2.0.0' built_value: '>=8.4.0 <9.0.0' diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/README.md b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/README.md index 6a3fea771a1..2e89f5797ee 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/README.md +++ b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/README.md @@ -9,8 +9,8 @@ This Dart package is automatically generated by the [OpenAPI Generator](https:// ## Requirements -* Dart 2.12.0 or later OR Flutter 1.26.0 or later -* Dio 4.0.0+ +* Dart 2.15.0+ or Flutter 2.8.0+ +* Dio 5.0.0+ (https://pub.dev/packages/dio) ## Installation & Usage diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/api.dart b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/api.dart index 0bb368eace0..3e6abb37ddb 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/api.dart +++ b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/api.dart @@ -27,8 +27,8 @@ class Openapi { this.dio = dio ?? Dio(BaseOptions( baseUrl: basePathOverride ?? basePath, - connectTimeout: 5000, - receiveTimeout: 3000, + connectTimeout: const Duration(milliseconds: 5000), + receiveTimeout: const Duration(milliseconds: 3000), )) { if (interceptors == null) { this.dio.interceptors.addAll([ diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/api/bar_api.dart b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/api/bar_api.dart index 4afe604a557..779728686e4 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/api/bar_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/api/bar_api.dart @@ -67,9 +67,10 @@ class BarApi { _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -94,9 +95,10 @@ class BarApi { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/api/foo_api.dart b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/api/foo_api.dart index 232392c76a7..7a8e18f5205 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/api/foo_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/api/foo_api.dart @@ -68,9 +68,10 @@ class FooApi { _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -95,9 +96,10 @@ class FooApi { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -167,9 +169,10 @@ class FooApi { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response>( diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/pubspec.yaml b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/pubspec.yaml index fb676f65c39..3cc6bce70ed 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/pubspec.yaml +++ b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/pubspec.yaml @@ -4,10 +4,10 @@ description: OpenAPI API client homepage: homepage environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: - dio: '>=4.0.1 <5.0.0' + dio: '^5.0.0' one_of: '>=1.5.0 <2.0.0' one_of_serializer: '>=1.5.0 <2.0.0' built_value: '>=8.4.0 <9.0.0' diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/README.md b/samples/openapi3/client/petstore/dart-dio/oneof_primitive/README.md index d73bafd4c64..79d80cae25a 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/README.md +++ b/samples/openapi3/client/petstore/dart-dio/oneof_primitive/README.md @@ -8,8 +8,8 @@ This Dart package is automatically generated by the [OpenAPI Generator](https:// ## Requirements -* Dart 2.12.0 or later OR Flutter 1.26.0 or later -* Dio 4.0.0+ +* Dart 2.15.0+ or Flutter 2.8.0+ +* Dio 5.0.0+ (https://pub.dev/packages/dio) ## Installation & Usage diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/api.dart b/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/api.dart index 776737680d5..7eb05e3ea4e 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/api.dart +++ b/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/api.dart @@ -26,8 +26,8 @@ class Openapi { this.dio = dio ?? Dio(BaseOptions( baseUrl: basePathOverride ?? basePath, - connectTimeout: 5000, - receiveTimeout: 3000, + connectTimeout: const Duration(milliseconds: 5000), + receiveTimeout: const Duration(milliseconds: 3000), )) { if (interceptors == null) { this.dio.interceptors.addAll([ diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/api/default_api.dart b/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/api/default_api.dart index 8d500cb70aa..e350018598e 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/api/default_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/api/default_api.dart @@ -72,9 +72,10 @@ class DefaultApi { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/pubspec.yaml b/samples/openapi3/client/petstore/dart-dio/oneof_primitive/pubspec.yaml index fb676f65c39..3cc6bce70ed 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/pubspec.yaml +++ b/samples/openapi3/client/petstore/dart-dio/oneof_primitive/pubspec.yaml @@ -4,10 +4,10 @@ description: OpenAPI API client homepage: homepage environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: - dio: '>=4.0.1 <5.0.0' + dio: '^5.0.0' one_of: '>=1.5.0 <2.0.0' one_of_serializer: '>=1.5.0 <2.0.0' built_value: '>=8.4.0 <9.0.0' diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md index da100d49f50..152c6163d77 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md @@ -8,8 +8,9 @@ This Dart package is automatically generated by the [OpenAPI Generator](https:// ## Requirements -* Dart 2.12.0 or later OR Flutter 1.26.0 or later -* Dio 4.0.0+ +* Dart 2.15.0+ or Flutter 2.8.0+ +* Dio 5.0.0+ (https://pub.dev/packages/dio) +* JSON Serializable 6.1.5+ (https://pub.dev/packages/json_serializable) ## Installation & Usage diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api.dart index 55cd646d296..835b76584b2 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api.dart @@ -27,8 +27,8 @@ class Openapi { this.dio = dio ?? Dio(BaseOptions( baseUrl: basePathOverride ?? basePath, - connectTimeout: 5000, - receiveTimeout: 3000, + connectTimeout: const Duration(milliseconds: 5000), + receiveTimeout: const Duration(milliseconds: 3000), )) { if (interceptors == null) { this.dio.interceptors.addAll([ diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/another_fake_api.dart index 14aea6d2db4..242066101d2 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/another_fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/another_fake_api.dart @@ -64,9 +64,10 @@ _bodyData=jsonEncode(modelClient); _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -86,9 +87,10 @@ _responseData = deserialize(_response.data!, 'ModelCli throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/default_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/default_api.dart index 7d3bfdc51c3..0c65ecde1d0 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/default_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/default_api.dart @@ -67,9 +67,10 @@ _responseData = deserialize(_respo throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart index f9294bb4f19..6cb86a6e440 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart @@ -74,9 +74,10 @@ _responseData = deserialize(_response.data throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -154,9 +155,10 @@ _bodyData=jsonEncode(pet); _path, queryParameters: _queryParameters, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -219,9 +221,10 @@ _bodyData=jsonEncode(body); _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -241,9 +244,10 @@ _responseData = deserialize(_response.data!, 'bool', growable: true) throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -305,9 +309,10 @@ _bodyData=jsonEncode(outerComposite); _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -327,9 +332,10 @@ _responseData = deserialize(_response.data!, 'Ou throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -391,9 +397,10 @@ _bodyData=jsonEncode(body); _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -413,9 +420,10 @@ _responseData = deserialize(_response.data!, 'num', growable: true); throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -477,9 +485,10 @@ _bodyData=jsonEncode(body); _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -499,9 +508,10 @@ _responseData = deserialize(_response.data!, 'String', growable: throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -563,9 +573,10 @@ _bodyData=jsonEncode(outerObjectWithEnumProperty); _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -585,9 +596,10 @@ _responseData = deserialize( @@ -649,9 +661,10 @@ _bodyData=jsonEncode(body); _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -713,9 +726,10 @@ _bodyData=jsonEncode(fileSchemaTestClass); _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -784,9 +798,10 @@ _bodyData=jsonEncode(user); _path, queryParameters: _queryParameters, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -849,9 +864,10 @@ _bodyData=jsonEncode(modelClient); _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -871,9 +887,10 @@ _responseData = deserialize(_response.data!, 'ModelCli throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -967,9 +984,10 @@ _responseData = deserialize(_response.data!, 'ModelCli _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -1058,9 +1076,10 @@ _responseData = deserialize(_response.data!, 'ModelCli _path, queryParameters: _queryParameters, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -1196,9 +1215,10 @@ _bodyData=jsonEncode(requestBody); _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -1262,9 +1282,10 @@ _bodyData=jsonEncode(requestBody); _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_classname_tags123_api.dart index bc92a874576..74bd9d98819 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_classname_tags123_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_classname_tags123_api.dart @@ -71,9 +71,10 @@ _bodyData=jsonEncode(modelClient); _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -93,9 +94,10 @@ _responseData = deserialize(_response.data!, 'ModelCli throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/pet_api.dart index fba6d184eb5..e7abc3a8970 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/pet_api.dart @@ -70,9 +70,10 @@ _bodyData=jsonEncode(pet); _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -204,9 +205,10 @@ _responseData = deserialize, Pet>(_response.data!, 'List', growab throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response>( @@ -284,9 +286,10 @@ _responseData = deserialize, Pet>(_response.data!, 'Set', growable throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response>( @@ -360,9 +363,10 @@ _responseData = deserialize(_response.data!, 'Pet', growable: true); throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -429,9 +433,10 @@ _bodyData=jsonEncode(pet); _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -502,9 +507,10 @@ _bodyData=jsonEncode(pet); _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -575,9 +581,10 @@ _bodyData=jsonEncode(pet); _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -597,9 +604,10 @@ _responseData = deserialize(_response.data!, 'ApiRespo throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -670,9 +678,10 @@ _responseData = deserialize(_response.data!, 'ApiRespo _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -692,9 +701,10 @@ _responseData = deserialize(_response.data!, 'ApiRespo throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/store_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/store_api.dart index a2abc20e3b3..a1edb4c4317 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/store_api.dart @@ -121,9 +121,10 @@ _responseData = deserialize, int>(_response.data!, 'Map>( @@ -190,9 +191,10 @@ _responseData = deserialize(_response.data!, 'Order', growable: tr throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -254,9 +256,10 @@ _bodyData=jsonEncode(order); _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -276,9 +279,10 @@ _responseData = deserialize(_response.data!, 'Order', growable: tr throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/user_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/user_api.dart index ccd5e7a9511..af9badb618a 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/user_api.dart @@ -64,9 +64,10 @@ _bodyData=jsonEncode(user); _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -128,9 +129,10 @@ _bodyData=jsonEncode(user); _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -192,9 +194,10 @@ _bodyData=jsonEncode(user); _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -308,9 +311,10 @@ _responseData = deserialize(_response.data!, 'User', growable: true) throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -385,9 +389,10 @@ _responseData = deserialize(_response.data!, 'String', growable: throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -496,9 +501,10 @@ _bodyData=jsonEncode(user); _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/pubspec.yaml b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/pubspec.yaml index 6ad296fb8a8..b8c8318dedc 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/pubspec.yaml +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/pubspec.yaml @@ -4,10 +4,10 @@ description: OpenAPI API client homepage: homepage environment: - sdk: '>=2.14.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: - dio: '>=4.0.1 <5.0.0' + dio: '^5.0.0' json_annotation: '^4.4.0' dev_dependencies: diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/test/default_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/test/default_api_test.dart index eef4c41652e..f079565f978 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/test/default_api_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/test/default_api_test.dart @@ -7,7 +7,7 @@ void main() { final instance = Openapi().getDefaultApi(); group(DefaultApi, () { - //Future fooGet() async + //Future fooGet() async test('test fooGet', () async { // TODO }); diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md index da100d49f50..12076ad230c 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md @@ -8,8 +8,8 @@ This Dart package is automatically generated by the [OpenAPI Generator](https:// ## Requirements -* Dart 2.12.0 or later OR Flutter 1.26.0 or later -* Dio 4.0.0+ +* Dart 2.15.0+ or Flutter 2.8.0+ +* Dio 5.0.0+ (https://pub.dev/packages/dio) ## Installation & Usage diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api.dart index 21ef3bc359d..53d0c5a524b 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api.dart @@ -32,8 +32,8 @@ class Openapi { this.dio = dio ?? Dio(BaseOptions( baseUrl: basePathOverride ?? basePath, - connectTimeout: 5000, - receiveTimeout: 3000, + connectTimeout: const Duration(milliseconds: 5000), + receiveTimeout: const Duration(milliseconds: 3000), )) { if (interceptors == null) { this.dio.interceptors.addAll([ diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/another_fake_api.dart index 45709153344..59f1630f7fb 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/another_fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/another_fake_api.dart @@ -66,9 +66,10 @@ class AnotherFakeApi { _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -93,9 +94,10 @@ class AnotherFakeApi { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/default_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/default_api.dart index 1e1f4dad6ab..8f8e0f123c2 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/default_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/default_api.dart @@ -72,9 +72,10 @@ class DefaultApi { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/fake_api.dart index 37506ff1cfe..3a88d009d92 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/fake_api.dart @@ -83,9 +83,10 @@ class FakeApi { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -165,9 +166,10 @@ class FakeApi { _path, queryParameters: _queryParameters, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -231,9 +233,10 @@ class FakeApi { _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -254,9 +257,10 @@ class FakeApi { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -320,9 +324,10 @@ class FakeApi { _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -347,9 +352,10 @@ class FakeApi { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -412,9 +418,10 @@ class FakeApi { _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -435,9 +442,10 @@ class FakeApi { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -500,9 +508,10 @@ class FakeApi { _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -523,9 +532,10 @@ class FakeApi { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -589,9 +599,10 @@ class FakeApi { _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -616,9 +627,10 @@ class FakeApi { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -681,9 +693,10 @@ class FakeApi { _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -747,9 +760,10 @@ class FakeApi { _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -820,9 +834,10 @@ class FakeApi { _path, queryParameters: _queryParameters, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -887,9 +902,10 @@ class FakeApi { _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -914,9 +930,10 @@ class FakeApi { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -1026,9 +1043,10 @@ class FakeApi { _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -1121,9 +1139,10 @@ class FakeApi { _path, queryParameters: _queryParameters, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -1261,9 +1280,10 @@ class FakeApi { _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -1331,9 +1351,10 @@ class FakeApi { _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/fake_classname_tags123_api.dart index 96329ea11f2..e3742590d3c 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/fake_classname_tags123_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/fake_classname_tags123_api.dart @@ -73,9 +73,10 @@ class FakeClassnameTags123Api { _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -100,9 +101,10 @@ class FakeClassnameTags123Api { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/pet_api.dart index 50ab6268859..772f60146e4 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/pet_api.dart @@ -74,9 +74,10 @@ class PetApi { _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -213,9 +214,10 @@ class PetApi { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response>( @@ -298,9 +300,10 @@ class PetApi { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response>( @@ -379,9 +382,10 @@ class PetApi { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -450,9 +454,10 @@ class PetApi { _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -527,9 +532,10 @@ class PetApi { _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -604,9 +610,10 @@ class PetApi { _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -631,9 +638,10 @@ class PetApi { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -708,9 +716,10 @@ class PetApi { _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -735,9 +744,10 @@ class PetApi { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/store_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/store_api.dart index f3e847156e6..63062c848b5 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/store_api.dart @@ -127,9 +127,10 @@ class StoreApi { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response>( @@ -201,9 +202,10 @@ class StoreApi { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -267,9 +269,10 @@ class StoreApi { _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -294,9 +297,10 @@ class StoreApi { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/user_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/user_api.dart index 6faaed6336d..0593c1bf308 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/user_api.dart @@ -68,9 +68,10 @@ class UserApi { _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -134,9 +135,10 @@ class UserApi { _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -200,9 +202,10 @@ class UserApi { _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( @@ -321,9 +324,10 @@ class UserApi { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -399,9 +403,10 @@ class UserApi { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -512,9 +517,10 @@ class UserApi { _dio.options, _path, ), - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } final _response = await _dio.request( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/pubspec.yaml b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/pubspec.yaml index fb676f65c39..3cc6bce70ed 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/pubspec.yaml +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/pubspec.yaml @@ -4,10 +4,10 @@ description: OpenAPI API client homepage: homepage environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: - dio: '>=4.0.1 <5.0.0' + dio: '^5.0.0' one_of: '>=1.5.0 <2.0.0' one_of_serializer: '>=1.5.0 <2.0.0' built_value: '>=8.4.0 <9.0.0' diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/pubspec.yaml b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/pubspec.yaml index 80178cb89a9..5079f6732cd 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/pubspec.yaml +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/pubspec.yaml @@ -5,14 +5,14 @@ description: OpenAPI API Dart DIO client tests for petstore_client_lib_fake publish_to: none environment: - sdk: '>=2.10.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dev_dependencies: built_collection: 5.1.1 - built_value: 8.4.0 - dio: 4.0.1 - http_mock_adapter: 0.3.2 - mockito: 5.0.11 + built_value: 8.4.3 + dio: 5.0.0 + http_mock_adapter: 0.4.2 + mockito: 5.2.0 openapi: path: ../petstore_client_lib_fake - test: 1.17.4 + test: 1.21.0 diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/authentication_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/authentication_test.dart index 8d229af8131..5ecf0a91cee 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/authentication_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/authentication_test.dart @@ -4,8 +4,8 @@ import 'package:openapi/openapi.dart'; import 'package:test/test.dart'; void main() { - Openapi client; - DioAdapter tester; + late Openapi client; + late DioAdapter tester; setUp(() { client = Openapi(dio: Dio()); diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/fake_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/fake_api_test.dart index 24b1ff82d24..ece30683b58 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/fake_api_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/fake_api_test.dart @@ -2,14 +2,13 @@ import 'dart:typed_data'; import 'package:built_collection/built_collection.dart'; import 'package:dio/dio.dart'; -import 'package:dio/src/parameter.dart'; import 'package:http_mock_adapter/http_mock_adapter.dart'; import 'package:openapi/openapi.dart'; import 'package:test/test.dart'; void main() { - Openapi client; - DioAdapter tester; + late Openapi client; + late DioAdapter tester; setUp(() { client = Openapi(dio: Dio()); @@ -98,7 +97,7 @@ void main() { (server) => server.reply(200, null), data: { 'enum_form_string': 'formString', - 'enum_form_string_array': Matchers.listParam( + 'enum_form_string_array': Matchers.listParam( ListParam( ['foo', 'bar'], ListFormat.csv, @@ -111,6 +110,7 @@ void main() { headers: { 'enum_header_string': '-efg', 'content-type': 'application/x-www-form-urlencoded', + 'content-length': Matchers.integer, }, ); diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/pet_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/pet_api_test.dart index 8cb3d36e76e..6e32e3cd97e 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/pet_api_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/pet_api_test.dart @@ -1,6 +1,5 @@ import 'package:built_collection/built_collection.dart'; import 'package:dio/dio.dart'; -import 'package:dio/src/parameter.dart'; import 'package:http_mock_adapter/http_mock_adapter.dart'; import 'package:http_parser/http_parser.dart'; import 'package:openapi/openapi.dart'; @@ -10,8 +9,8 @@ void main() { const photo1 = 'https://localhost/photo1.jpg'; const photo2 = 'https://localhost/photo2.jpg'; - Openapi client; - DioAdapter tester; + late Openapi client; + late DioAdapter tester; setUp(() { client = Openapi(dio: Dio()); @@ -56,13 +55,13 @@ void main() { expect(response.statusCode, 200); expect(response.data, isNotNull); - expect(response.data.id, 5); - expect(response.data.name, 'Paula'); - expect(response.data.status, PetStatusEnum.sold); - expect(response.data.category.id, 1); - expect(response.data.category.name, 'dog'); - expect(response.data.photoUrls.length, 2); - expect(response.data.tags.length, 2); + expect(response.data!.id, 5); + expect(response.data!.name, 'Paula'); + expect(response.data!.status, PetStatusEnum.sold); + expect(response.data!.category?.id, 1); + expect(response.data!.category?.name, 'dog'); + expect(response.data!.photoUrls, hasLength(2)); + expect(response.data!.tags, hasLength(2)); }); test('minimal', () async { @@ -79,12 +78,12 @@ void main() { expect(response.statusCode, 200); expect(response.data, isNotNull); - expect(response.data.id, 5); - expect(response.data.name, 'Paula'); - expect(response.data.status, isNull); - expect(response.data.category, isNull); - expect(response.data.photoUrls, isNotNull); - expect(response.data.photoUrls, isEmpty); + expect(response.data!.id, 5); + expect(response.data!.name, 'Paula'); + expect(response.data!.status, isNull); + expect(response.data!.category, isNull); + expect(response.data!.photoUrls, isNotNull); + expect(response.data!.photoUrls, isEmpty); }); }); @@ -207,13 +206,13 @@ void main() { expect(response.statusCode, 200); expect(response.data, isNotNull); - expect(response.data.length, 2); - expect(response.data[0].id, 5); - expect(response.data[0].name, 'Paula'); - expect(response.data[0].status, PetStatusEnum.sold); - expect(response.data[1].id, 1); - expect(response.data[1].name, 'Mickey'); - expect(response.data[1].status, PetStatusEnum.available); + expect(response.data, hasLength(2)); + expect(response.data![0].id, 5); + expect(response.data![0].name, 'Paula'); + expect(response.data![0].status, PetStatusEnum.sold); + expect(response.data![1].id, 1); + expect(response.data![1].name, 'Mickey'); + expect(response.data![1].status, PetStatusEnum.available); }); }); @@ -252,7 +251,7 @@ void main() { ); expect(response.statusCode, 200); - expect(response.data.message, 'File uploaded'); + expect(response.data?.message, 'File uploaded'); }); test('uploadFileWithRequiredFile & additionalMetadata', () async { @@ -291,7 +290,7 @@ void main() { ); expect(response.statusCode, 200); - expect(response.data.message, 'File uploaded'); + expect(response.data?.message, 'File uploaded'); }); }); }); diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/store_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/store_api_test.dart index 12f6201cfc6..5b233485f9a 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/store_api_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/store_api_test.dart @@ -4,8 +4,8 @@ import 'package:openapi/openapi.dart'; import 'package:test/test.dart'; void main() { - Openapi client; - DioAdapter tester; + late Openapi client; + late DioAdapter tester; setUp(() { client = Openapi(dio: Dio()); @@ -31,7 +31,7 @@ void main() { expect(response.statusCode, 200); expect(response.data, isNotNull); - expect(response.data.length, 3); + expect(response.data, hasLength(3)); }); }); }