From 96e6bc46502fb94799125e6619ba5a866cfe8b50 Mon Sep 17 00:00:00 2001 From: Peter Leibiger Date: Wed, 16 Dec 2020 16:24:09 +0100 Subject: [PATCH] [dart-dio] Allow dynamic headers and add additional dio parameters (#8191) * fixes some compile errors due to header params not being of type `String` * add optional `extra` and `validateStatus` parameters from dio --- .../src/main/resources/dart-dio/api.mustache | 8 +- .../petstore_client_lib/lib/api/pet_api.dart | 64 ++++++++-- .../lib/api/store_api.dart | 32 ++++- .../petstore_client_lib/lib/api/user_api.dart | 64 ++++++++-- .../petstore_client_lib/lib/api/pet_api.dart | 64 ++++++++-- .../lib/api/store_api.dart | 32 ++++- .../petstore_client_lib/lib/api/user_api.dart | 64 ++++++++-- .../lib/api/another_fake_api.dart | 8 +- .../lib/api/default_api.dart | 8 +- .../lib/api/fake_api.dart | 120 +++++++++++++++--- .../lib/api/fake_classname_tags123_api.dart | 8 +- .../lib/api/pet_api.dart | 72 +++++++++-- .../lib/api/store_api.dart | 32 ++++- .../lib/api/user_api.dart | 64 ++++++++-- 14 files changed, 560 insertions(+), 80 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/dart-dio/api.mustache b/modules/openapi-generator/src/main/resources/dart-dio/api.mustache index 58fd56baac9..a7f830a5135 100644 --- a/modules/openapi-generator/src/main/resources/dart-dio/api.mustache +++ b/modules/openapi-generator/src/main/resources/dart-dio/api.mustache @@ -24,13 +24,17 @@ class {{classname}} { {{{dataType}}} {{paramName}},{{/optionalParams}} CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '{{{path}}}'{{#pathParams}}.replaceAll('{' r'{{baseName}}' '}', {{{paramName}}}.toString()){{/pathParams}}; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; {{#headerParams}} @@ -102,7 +106,9 @@ class {{classname}} { 'where': '{{#isKeyInQuery}}query{{/isKeyInQuery}}{{#isKeyInHeader}}header{{/isKeyInHeader}}',{{/isApiKey}} },{{/authMethods}} ],{{/hasAuthMethods}} + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart index 0c71ae0e8e6..c975d10e631 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart @@ -22,13 +22,17 @@ class PetApi { Pet body, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/pet'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -57,7 +61,9 @@ class PetApi { 'name': 'petstore_auth', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -74,13 +80,17 @@ class PetApi { String apiKey, CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; headerParams[r'api_key'] = apiKey; @@ -103,7 +113,9 @@ class PetApi { 'name': 'petstore_auth', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -119,13 +131,17 @@ class PetApi { BuiltList status, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/pet/findByStatus'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams[r'status'] = status; @@ -148,7 +164,9 @@ class PetApi { 'name': 'petstore_auth', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -178,13 +196,17 @@ class PetApi { BuiltList tags, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/pet/findByTags'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams[r'tags'] = tags; @@ -207,7 +229,9 @@ class PetApi { 'name': 'petstore_auth', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -237,13 +261,17 @@ class PetApi { int petId, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -267,7 +295,9 @@ class PetApi { 'where': 'header', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -296,13 +326,17 @@ class PetApi { Pet body, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/pet'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -331,7 +365,9 @@ class PetApi { 'name': 'petstore_auth', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -349,13 +385,17 @@ class PetApi { String status, CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -384,7 +424,9 @@ class PetApi { 'name': 'petstore_auth', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -402,13 +444,17 @@ class PetApi { Uint8List file, CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/pet/{petId}/uploadImage'.replaceAll('{' r'petId' '}', petId.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -441,7 +487,9 @@ class PetApi { 'name': 'petstore_auth', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart index 2d6820a6ff4..eb62c2dc17f 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart @@ -19,13 +19,17 @@ class StoreApi { String orderId, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/store/order/{orderId}'.replaceAll('{' r'orderId' '}', orderId.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -42,7 +46,9 @@ class StoreApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -57,13 +63,17 @@ class StoreApi { Future>> getInventory({ CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/store/inventory'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -87,7 +97,9 @@ class StoreApi { 'where': 'header', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -117,13 +129,17 @@ class StoreApi { int orderId, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/store/order/{orderId}'.replaceAll('{' r'orderId' '}', orderId.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -140,7 +156,9 @@ class StoreApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -169,13 +187,17 @@ class StoreApi { Order body, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/store/order'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -196,7 +218,9 @@ class StoreApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart index 8c89c0bf370..9183e1f5a76 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart @@ -19,13 +19,17 @@ class UserApi { User body, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/user'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -46,7 +50,9 @@ class UserApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -62,13 +68,17 @@ class UserApi { BuiltList body, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/user/createWithArray'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -90,7 +100,9 @@ class UserApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -106,13 +118,17 @@ class UserApi { BuiltList body, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/user/createWithList'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -134,7 +150,9 @@ class UserApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -150,13 +168,17 @@ class UserApi { String username, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -173,7 +195,9 @@ class UserApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -189,13 +213,17 @@ class UserApi { String username, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -212,7 +240,9 @@ class UserApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -242,13 +272,17 @@ class UserApi { String password, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/user/login'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams[r'username'] = username; @@ -267,7 +301,9 @@ class UserApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -294,13 +330,17 @@ class UserApi { Future> logoutUser({ CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/user/logout'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -317,7 +357,9 @@ class UserApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -334,13 +376,17 @@ class UserApi { User body, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -361,7 +407,9 @@ class UserApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart index e74ee3f940f..29837e6354b 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart @@ -22,13 +22,17 @@ class PetApi { Pet pet, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/pet'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -57,7 +61,9 @@ class PetApi { 'name': 'petstore_auth', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -87,13 +93,17 @@ class PetApi { String apiKey, CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; headerParams[r'api_key'] = apiKey; @@ -116,7 +126,9 @@ class PetApi { 'name': 'petstore_auth', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -132,13 +144,17 @@ class PetApi { BuiltList status, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/pet/findByStatus'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams[r'status'] = status; @@ -161,7 +177,9 @@ class PetApi { 'name': 'petstore_auth', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -191,13 +209,17 @@ class PetApi { BuiltList tags, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/pet/findByTags'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams[r'tags'] = tags; @@ -220,7 +242,9 @@ class PetApi { 'name': 'petstore_auth', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -250,13 +274,17 @@ class PetApi { int petId, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -280,7 +308,9 @@ class PetApi { 'where': 'header', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -309,13 +339,17 @@ class PetApi { Pet pet, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/pet'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -344,7 +378,9 @@ class PetApi { 'name': 'petstore_auth', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -375,13 +411,17 @@ class PetApi { String status, CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -410,7 +450,9 @@ class PetApi { 'name': 'petstore_auth', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -428,13 +470,17 @@ class PetApi { Uint8List file, CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/pet/{petId}/uploadImage'.replaceAll('{' r'petId' '}', petId.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -467,7 +513,9 @@ class PetApi { 'name': 'petstore_auth', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart index a5c1fb5a798..cc30e5b5597 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart @@ -19,13 +19,17 @@ class StoreApi { String orderId, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/store/order/{orderId}'.replaceAll('{' r'orderId' '}', orderId.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -42,7 +46,9 @@ class StoreApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -57,13 +63,17 @@ class StoreApi { Future>> getInventory({ CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/store/inventory'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -87,7 +97,9 @@ class StoreApi { 'where': 'header', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -117,13 +129,17 @@ class StoreApi { int orderId, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/store/order/{orderId}'.replaceAll('{' r'orderId' '}', orderId.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -140,7 +156,9 @@ class StoreApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -169,13 +187,17 @@ class StoreApi { Order order, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/store/order'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -198,7 +220,9 @@ class StoreApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart index d8abb0867e2..c7ba72a9a88 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart @@ -19,13 +19,17 @@ class UserApi { User user, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/user'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -55,7 +59,9 @@ class UserApi { 'where': 'header', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -71,13 +77,17 @@ class UserApi { BuiltList user, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/user/createWithArray'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -108,7 +118,9 @@ class UserApi { 'where': 'header', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -124,13 +136,17 @@ class UserApi { BuiltList user, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/user/createWithList'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -161,7 +177,9 @@ class UserApi { 'where': 'header', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -177,13 +195,17 @@ class UserApi { String username, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -207,7 +229,9 @@ class UserApi { 'where': 'header', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -223,13 +247,17 @@ class UserApi { String username, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -246,7 +274,9 @@ class UserApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -276,13 +306,17 @@ class UserApi { String password, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/user/login'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams[r'username'] = username; @@ -301,7 +335,9 @@ class UserApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -328,13 +364,17 @@ class UserApi { Future> logoutUser({ CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/user/logout'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -358,7 +398,9 @@ class UserApi { 'where': 'header', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -375,13 +417,17 @@ class UserApi { User user, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -411,7 +457,9 @@ class UserApi { 'where': 'header', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart index f7eefe7d7e9..bb7458c32f1 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart @@ -18,13 +18,17 @@ class AnotherFakeApi { ModelClient modelClient, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/another-fake/dummy'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -47,7 +51,9 @@ class AnotherFakeApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/default_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/default_api.dart index 7d13a5522cc..4ddaced7faf 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/default_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/default_api.dart @@ -17,13 +17,17 @@ class DefaultApi { Future> fooGet({ CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/foo'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -40,7 +44,9 @@ class DefaultApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart index 71e1aaf2738..4347da0f254 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart @@ -25,13 +25,17 @@ class FakeApi { Future> fakeHealthGet({ CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/fake/health'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -48,7 +52,9 @@ class FakeApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -79,13 +85,17 @@ class FakeApi { String header1, CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/fake/http-signature-test'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; headerParams[r'header_1'] = header1; @@ -116,7 +126,9 @@ class FakeApi { 'name': 'http_signature_test', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -132,13 +144,17 @@ class FakeApi { bool body, CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/fake/outer/boolean'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -161,7 +177,9 @@ class FakeApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -189,13 +207,17 @@ class FakeApi { OuterComposite outerComposite, CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/fake/outer/composite'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -218,7 +240,9 @@ class FakeApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -247,13 +271,17 @@ class FakeApi { num body, CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/fake/outer/number'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -276,7 +304,9 @@ class FakeApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -304,13 +334,17 @@ class FakeApi { String body, CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/fake/outer/string'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -333,7 +367,9 @@ class FakeApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -361,13 +397,17 @@ class FakeApi { FileSchemaTestClass fileSchemaTestClass, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/fake/body-with-file-schema'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -390,7 +430,9 @@ class FakeApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -407,13 +449,17 @@ class FakeApi { User user, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/fake/body-with-query-params'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams[r'query'] = query; @@ -437,7 +483,9 @@ class FakeApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -453,13 +501,17 @@ class FakeApi { ModelClient modelClient, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/fake'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -482,7 +534,9 @@ class FakeApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -524,13 +578,17 @@ class FakeApi { String callback, CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/fake'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -571,7 +629,9 @@ class FakeApi { 'name': 'http_basic_test', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -594,13 +654,17 @@ class FakeApi { String enumFormString, CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/fake'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; headerParams[r'enum_header_string_array'] = enumHeaderStringArray; @@ -630,7 +694,9 @@ class FakeApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -651,13 +717,17 @@ class FakeApi { int int64Group, CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/fake'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; headerParams[r'required_boolean_group'] = requiredBooleanGroup; @@ -685,7 +755,9 @@ class FakeApi { 'name': 'bearer_test', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -701,13 +773,17 @@ class FakeApi { BuiltMap requestBody, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/fake/inline-additionalProperties'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -730,7 +806,9 @@ class FakeApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -747,13 +825,17 @@ class FakeApi { String param2, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/fake/jsonFormData'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -777,7 +859,9 @@ class FakeApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -797,13 +881,17 @@ class FakeApi { BuiltList context, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/fake/test-query-paramters'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams[r'pipe'] = pipe; @@ -825,7 +913,9 @@ class FakeApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart index fae8bbf33d7..568b5043f6d 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart @@ -18,13 +18,17 @@ class FakeClassnameTags123Api { ModelClient modelClient, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/fake_classname_test'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -54,7 +58,9 @@ class FakeClassnameTags123Api { 'where': 'query', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart index 7bc7b217fa1..7f79f93ca0a 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart @@ -22,13 +22,17 @@ class PetApi { Pet pet, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/pet'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -57,7 +61,9 @@ class PetApi { 'name': 'petstore_auth', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -74,13 +80,17 @@ class PetApi { String apiKey, CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; headerParams[r'api_key'] = apiKey; @@ -103,7 +113,9 @@ class PetApi { 'name': 'petstore_auth', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -119,13 +131,17 @@ class PetApi { BuiltList status, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/pet/findByStatus'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams[r'status'] = status; @@ -148,7 +164,9 @@ class PetApi { 'name': 'petstore_auth', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -178,13 +196,17 @@ class PetApi { BuiltList tags, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/pet/findByTags'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams[r'tags'] = tags; @@ -207,7 +229,9 @@ class PetApi { 'name': 'petstore_auth', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -237,13 +261,17 @@ class PetApi { int petId, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -267,7 +295,9 @@ class PetApi { 'where': 'header', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -296,13 +326,17 @@ class PetApi { Pet pet, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/pet'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -331,7 +365,9 @@ class PetApi { 'name': 'petstore_auth', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -349,13 +385,17 @@ class PetApi { String status, CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -384,7 +424,9 @@ class PetApi { 'name': 'petstore_auth', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -402,13 +444,17 @@ class PetApi { Uint8List file, CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/pet/{petId}/uploadImage'.replaceAll('{' r'petId' '}', petId.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -441,7 +487,9 @@ class PetApi { 'name': 'petstore_auth', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -472,13 +520,17 @@ class PetApi { String additionalMetadata, CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/fake/{petId}/uploadImageWithRequiredFile'.replaceAll('{' r'petId' '}', petId.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -511,7 +563,9 @@ class PetApi { 'name': 'petstore_auth', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/store_api.dart index 89f845eea20..98f0a4f507b 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/store_api.dart @@ -19,13 +19,17 @@ class StoreApi { String orderId, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/store/order/{order_id}'.replaceAll('{' r'order_id' '}', orderId.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -42,7 +46,9 @@ class StoreApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -57,13 +63,17 @@ class StoreApi { Future>> getInventory({ CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/store/inventory'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -87,7 +97,9 @@ class StoreApi { 'where': 'header', }, ], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -117,13 +129,17 @@ class StoreApi { int orderId, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/store/order/{order_id}'.replaceAll('{' r'order_id' '}', orderId.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -140,7 +156,9 @@ class StoreApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -169,13 +187,17 @@ class StoreApi { Order order, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/store/order'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -198,7 +220,9 @@ class StoreApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/user_api.dart index 3e2d4936a18..52a48e251df 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/user_api.dart @@ -19,13 +19,17 @@ class UserApi { User user, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/user'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -48,7 +52,9 @@ class UserApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -64,13 +70,17 @@ class UserApi { BuiltList user, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/user/createWithArray'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -94,7 +104,9 @@ class UserApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -110,13 +122,17 @@ class UserApi { BuiltList user, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/user/createWithList'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -140,7 +156,9 @@ class UserApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -156,13 +174,17 @@ class UserApi { String username, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -179,7 +201,9 @@ class UserApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -195,13 +219,17 @@ class UserApi { String username, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -218,7 +246,9 @@ class UserApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -248,13 +278,17 @@ class UserApi { String password, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/user/login'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams[r'username'] = username; @@ -273,7 +307,9 @@ class UserApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -300,13 +336,17 @@ class UserApi { Future> logoutUser({ CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/user/logout'; final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -323,7 +363,9 @@ class UserApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken, @@ -340,13 +382,17 @@ class UserApi { User user, { CancelToken cancelToken, Map headers, + Map extra, + ValidateStatus validateStatus, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress, }) async { final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString()); final Map queryParams = {}; - final Map headerParams = Map.from(headers ?? {}); + final Map headerParams = { + if (headers != null) ...headers, + }; dynamic bodyData; queryParams.removeWhere((key, value) => value == null); @@ -369,7 +415,9 @@ class UserApi { headers: headerParams, extra: { 'secure': [], + if (extra != null) ...extra, }, + validateStatus: validateStatus, contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json', ), cancelToken: cancelToken,