From 4347316c4f4680a9ed8b4c8ee810897d1e373c0d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 May 2021 06:10:53 +0000 Subject: [PATCH 01/11] Bump jimschubert/query-tag-action from 1 to 2 Bumps [jimschubert/query-tag-action](https://github.com/jimschubert/query-tag-action) from 1 to 2. - [Release notes](https://github.com/jimschubert/query-tag-action/releases) - [Commits](https://github.com/jimschubert/query-tag-action/compare/v1...v2) Signed-off-by: dependabot[bot] --- .github/workflows/docker-tag-latest-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-tag-latest-release.yml b/.github/workflows/docker-tag-latest-release.yml index d380cacbe83d..a871f36ceadd 100644 --- a/.github/workflows/docker-tag-latest-release.yml +++ b/.github/workflows/docker-tag-latest-release.yml @@ -19,7 +19,7 @@ jobs: # This action will "unshallow" so we have all tag info - name: Get latest tag id: tagger - uses: jimschubert/query-tag-action@v1 + uses: jimschubert/query-tag-action@v2 with: include: 'v*' exclude: '*-rc*' From 5c4ceb7c14627169b32b2e14b22fdd76fb5f7309 Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Sat, 6 Aug 2022 21:44:39 +0200 Subject: [PATCH 02/11] Use a normal variable name inside a function, no need to make it private. --- .../serialization/native/native_class.mustache | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_class.mustache b/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_class.mustache index 63c061a1ffc5..2d55a19810c4 100644 --- a/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_class.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_class.mustache @@ -52,7 +52,7 @@ class {{{classname}}} { String toString() => '{{{classname}}}[{{#vars}}{{{name}}}=${{{name}}}{{^-last}}, {{/-last}}{{/vars}}]'; Map toJson() { - final _json = {}; + final json = {}; {{#vars}} {{#isNullable}} if ({{{name}}} != null) { @@ -66,45 +66,45 @@ class {{{classname}}} { {{/isNullable}} {{#isDateTime}} {{#pattern}} - _json[r'{{{baseName}}}'] = _dateEpochMarker == '{{{pattern}}}' + json[r'{{{baseName}}}'] = _dateEpochMarker == '{{{pattern}}}' ? {{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.millisecondsSinceEpoch : {{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc().toIso8601String(); {{/pattern}} {{^pattern}} - _json[r'{{{baseName}}}'] = {{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc().toIso8601String(); + json[r'{{{baseName}}}'] = {{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc().toIso8601String(); {{/pattern}} {{/isDateTime}} {{#isDate}} {{#pattern}} - _json[r'{{{baseName}}}'] = _dateEpochMarker == '{{{pattern}}}' + json[r'{{{baseName}}}'] = _dateEpochMarker == '{{{pattern}}}' ? {{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.millisecondsSinceEpoch : _dateFormatter.format({{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc()); {{/pattern}} {{^pattern}} - _json[r'{{{baseName}}}'] = _dateFormatter.format({{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc()); + json[r'{{{baseName}}}'] = _dateFormatter.format({{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc()); {{/pattern}} {{/isDate}} {{^isDateTime}} {{^isDate}} - _json[r'{{{baseName}}}'] = {{{name}}}; + json[r'{{{baseName}}}'] = {{{name}}}; {{/isDate}} {{/isDateTime}} {{#isNullable}} } else { - _json[r'{{{baseName}}}'] = null; + json[r'{{{baseName}}}'] = null; } {{/isNullable}} {{^isNullable}} {{^required}} {{^defaultValue}} } else { - _json[r'{{{baseName}}}'] = null; + json[r'{{{baseName}}}'] = null; } {{/defaultValue}} {{/required}} {{/isNullable}} {{/vars}} - return _json; + return json; } /// Returns a new [{{{classname}}}] instance and imports its values from From d9cdc6e617474eff0d9e6a8dd90bc0f96d4cea97 Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Sat, 6 Aug 2022 22:06:37 +0200 Subject: [PATCH 03/11] Pass on authentication names because authentication implementations may need those! --- .../src/main/resources/dart2/api.mustache | 2 ++ .../src/main/resources/dart2/api_client.mustache | 10 +++++----- .../main/resources/dart2/auth/api_key_auth.mustache | 6 +++++- .../main/resources/dart2/auth/authentication.mustache | 6 +++++- .../main/resources/dart2/auth/http_basic_auth.mustache | 6 +++++- .../resources/dart2/auth/http_bearer_auth.mustache | 6 +++++- .../src/main/resources/dart2/auth/oauth.mustache | 6 +++++- 7 files changed, 32 insertions(+), 10 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/dart2/api.mustache b/modules/openapi-generator/src/main/resources/dart2/api.mustache index e40ebac39408..2ce04e81f0eb 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api.mustache @@ -86,6 +86,7 @@ class {{{classname}}} { {{/headerParams}} {{/hasHeaderParams}} + const authNames = [{{#authMethods}}'{{{name}}}'{{^-last}}, {{/-last}}{{/authMethods}}]; const contentTypes = [{{#prioritizedContentTypes}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/prioritizedContentTypes}}]; {{#isMultipart}} @@ -128,6 +129,7 @@ class {{{classname}}} { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } diff --git a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache index d8db09013b90..e1828e800d8d 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache @@ -1,7 +1,7 @@ {{>header}} {{>part_of}} class ApiClient { - ApiClient({this.basePath = '{{{basePath}}}', this.authentication}); + ApiClient({this.basePath = '{{{basePath}}}', this.authentication,}); final String basePath; @@ -36,8 +36,9 @@ class ApiClient { Map headerParams, Map formParams, String? contentType, + List authNames, ) async { - _updateParamsForAuth(queryParams, headerParams); + _updateParamsForAuth(authNames, queryParams, headerParams); headerParams.addAll(_defaultHeaderMap); if (contentType != null) { @@ -159,12 +160,11 @@ class ApiClient { /// Update query and header parameters based on authentication settings. void _updateParamsForAuth( + List authNames, List queryParams, Map headerParams, ) { - if (authentication != null) { - authentication!.applyToParams(queryParams, headerParams); - } + authentication?.applyToParams(authNames, queryParams, headerParams); } {{#native_serialization}} diff --git a/modules/openapi-generator/src/main/resources/dart2/auth/api_key_auth.mustache b/modules/openapi-generator/src/main/resources/dart2/auth/api_key_auth.mustache index b4f5a4587246..138a6d08742d 100644 --- a/modules/openapi-generator/src/main/resources/dart2/auth/api_key_auth.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/auth/api_key_auth.mustache @@ -10,7 +10,11 @@ class ApiKeyAuth implements Authentication { String apiKey = ''; @override - void applyToParams(List queryParams, Map headerParams) { + void applyToParams( + List authNames, + List queryParams, + Map headerParams, + ) { final paramValue = apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey'; if (paramValue.isNotEmpty) { diff --git a/modules/openapi-generator/src/main/resources/dart2/auth/authentication.mustache b/modules/openapi-generator/src/main/resources/dart2/auth/authentication.mustache index e8aaaa4d5411..7d4e1c350219 100644 --- a/modules/openapi-generator/src/main/resources/dart2/auth/authentication.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/auth/authentication.mustache @@ -3,5 +3,9 @@ // ignore: one_member_abstracts abstract class Authentication { /// Apply authentication settings to header and query params. - void applyToParams(List queryParams, Map headerParams); + void applyToParams( + List authNames, + List queryParams, + Map headerParams, + ); } diff --git a/modules/openapi-generator/src/main/resources/dart2/auth/http_basic_auth.mustache b/modules/openapi-generator/src/main/resources/dart2/auth/http_basic_auth.mustache index 544219733921..8ba6613cfd11 100644 --- a/modules/openapi-generator/src/main/resources/dart2/auth/http_basic_auth.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/auth/http_basic_auth.mustache @@ -7,7 +7,11 @@ class HttpBasicAuth implements Authentication { String password; @override - void applyToParams(List queryParams, Map headerParams) { + void applyToParams( + List authNames, + List queryParams, + Map headerParams, + ) { if (username.isNotEmpty && password.isNotEmpty) { final credentials = '$username:$password'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; diff --git a/modules/openapi-generator/src/main/resources/dart2/auth/http_bearer_auth.mustache b/modules/openapi-generator/src/main/resources/dart2/auth/http_bearer_auth.mustache index 7c480c5e81d3..380867cccc4c 100644 --- a/modules/openapi-generator/src/main/resources/dart2/auth/http_bearer_auth.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/auth/http_bearer_auth.mustache @@ -17,7 +17,11 @@ class HttpBearerAuth implements Authentication { } @override - void applyToParams(List queryParams, Map headerParams) { + void applyToParams( + List authNames, + List queryParams, + Map headerParams, + ) { if (_accessToken == null) { return; } diff --git a/modules/openapi-generator/src/main/resources/dart2/auth/oauth.mustache b/modules/openapi-generator/src/main/resources/dart2/auth/oauth.mustache index c5c64d522184..cd2f487409c2 100644 --- a/modules/openapi-generator/src/main/resources/dart2/auth/oauth.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/auth/oauth.mustache @@ -6,7 +6,11 @@ class OAuth implements Authentication { String accessToken; @override - void applyToParams(List queryParams, Map headerParams) { + void applyToParams( + List authNames, + List queryParams, + Map headerParams, + ) { if (accessToken.isNotEmpty) { headerParams['Authorization'] = 'Bearer $accessToken'; } From e8b92cf1e6f5bf5e4ec0328615f161a0edf7ba29 Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Sat, 6 Aug 2022 22:23:27 +0200 Subject: [PATCH 04/11] Generate Petstore samples. --- .../petstore_client_lib/lib/api/pet_api.dart | 16 +++++ .../lib/api/store_api.dart | 8 +++ .../petstore_client_lib/lib/api/user_api.dart | 16 +++++ .../petstore_client_lib/lib/api_client.dart | 10 ++-- .../lib/auth/api_key_auth.dart | 6 +- .../lib/auth/authentication.dart | 6 +- .../lib/auth/http_basic_auth.dart | 6 +- .../lib/auth/http_bearer_auth.dart | 6 +- .../petstore_client_lib/lib/auth/oauth.dart | 6 +- .../lib/model/api_response.dart | 16 ++--- .../lib/model/category.dart | 12 ++-- .../petstore_client_lib/lib/model/order.dart | 26 ++++---- .../petstore_client_lib/lib/model/pet.dart | 22 +++---- .../petstore_client_lib/lib/model/tag.dart | 12 ++-- .../petstore_client_lib/lib/model/user.dart | 36 +++++------ .../lib/api/another_fake_api.dart | 2 + .../lib/api/default_api.dart | 2 + .../lib/api/fake_api.dart | 34 +++++++++++ .../lib/api/fake_classname_tags123_api.dart | 2 + .../lib/api/pet_api.dart | 18 ++++++ .../lib/api/store_api.dart | 8 +++ .../lib/api/user_api.dart | 16 +++++ .../lib/api_client.dart | 10 ++-- .../lib/auth/api_key_auth.dart | 6 +- .../lib/auth/authentication.dart | 6 +- .../lib/auth/http_basic_auth.dart | 6 +- .../lib/auth/http_bearer_auth.dart | 6 +- .../lib/auth/oauth.dart | 6 +- .../model/additional_properties_class.dart | 8 +-- .../lib/model/all_of_with_single_ref.dart | 12 ++-- .../lib/model/animal.dart | 8 +-- .../lib/model/api_response.dart | 16 ++--- .../model/array_of_array_of_number_only.dart | 6 +- .../lib/model/array_of_number_only.dart | 6 +- .../lib/model/array_test.dart | 10 ++-- .../lib/model/capitalization.dart | 28 ++++----- .../lib/model/cat.dart | 12 ++-- .../lib/model/cat_all_of.dart | 8 +-- .../lib/model/category.dart | 10 ++-- .../lib/model/class_model.dart | 8 +-- .../lib/model/deprecated_object.dart | 8 +-- .../lib/model/dog.dart | 12 ++-- .../lib/model/dog_all_of.dart | 8 +-- .../lib/model/enum_arrays.dart | 10 ++-- .../lib/model/enum_test.dart | 34 +++++------ .../lib/model/file_schema_test_class.dart | 10 ++-- .../lib/model/foo.dart | 6 +- .../lib/model/foo_get_default_response.dart | 8 +-- .../lib/model/format_test.dart | 60 +++++++++---------- .../lib/model/has_only_read_only.dart | 12 ++-- .../lib/model/health_check_result.dart | 8 +-- .../lib/model/map_test.dart | 12 ++-- ...rties_and_additional_properties_class.dart | 14 ++--- .../lib/model/model200_response.dart | 12 ++-- .../lib/model/model_client.dart | 8 +-- .../lib/model/model_file.dart | 8 +-- .../lib/model/model_list.dart | 8 +-- .../lib/model/model_return.dart | 8 +-- .../lib/model/name.dart | 18 +++--- .../lib/model/nullable_class.dart | 48 +++++++-------- .../lib/model/number_only.dart | 8 +-- .../model/object_with_deprecated_fields.dart | 18 +++--- .../lib/model/order.dart | 26 ++++---- .../lib/model/outer_composite.dart | 16 ++--- .../outer_object_with_enum_property.dart | 6 +- .../lib/model/pet.dart | 22 +++---- .../lib/model/read_only_first.dart | 12 ++-- .../lib/model/special_model_name.dart | 8 +-- .../lib/model/tag.dart | 12 ++-- .../lib/model/user.dart | 36 +++++------ 70 files changed, 548 insertions(+), 386 deletions(-) diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart index d0354de38dbb..22858e953afa 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart @@ -37,6 +37,7 @@ class PetApi { final headerParams = {}; final formParams = {}; + const authNames = ['petstore_auth']; const contentTypes = ['application/json', 'application/xml']; @@ -48,6 +49,7 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -102,6 +104,7 @@ class PetApi { headerParams[r'api_key'] = parameterToString(apiKey); } + const authNames = ['petstore_auth']; const contentTypes = []; @@ -113,6 +116,7 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -156,6 +160,7 @@ class PetApi { queryParams.addAll(_queryParams('csv', 'status', status)); + const authNames = ['petstore_auth']; const contentTypes = []; @@ -167,6 +172,7 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -219,6 +225,7 @@ class PetApi { queryParams.addAll(_queryParams('csv', 'tags', tags)); + const authNames = ['petstore_auth']; const contentTypes = []; @@ -230,6 +237,7 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -281,6 +289,7 @@ class PetApi { final headerParams = {}; final formParams = {}; + const authNames = ['api_key']; const contentTypes = []; @@ -292,6 +301,7 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -339,6 +349,7 @@ class PetApi { final headerParams = {}; final formParams = {}; + const authNames = ['petstore_auth']; const contentTypes = ['application/json', 'application/xml']; @@ -350,6 +361,7 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -404,6 +416,7 @@ class PetApi { final headerParams = {}; final formParams = {}; + const authNames = ['petstore_auth']; const contentTypes = ['application/x-www-form-urlencoded']; if (name != null) { @@ -421,6 +434,7 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -473,6 +487,7 @@ class PetApi { final headerParams = {}; final formParams = {}; + const authNames = ['petstore_auth']; const contentTypes = ['multipart/form-data']; bool hasFields = false; @@ -498,6 +513,7 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart index db1ac1f010bf..51b4b81fb0f5 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart @@ -38,6 +38,7 @@ class StoreApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = []; @@ -49,6 +50,7 @@ class StoreApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -83,6 +85,7 @@ class StoreApi { final headerParams = {}; final formParams = {}; + const authNames = ['api_key']; const contentTypes = []; @@ -94,6 +97,7 @@ class StoreApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -137,6 +141,7 @@ class StoreApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = []; @@ -148,6 +153,7 @@ class StoreApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -195,6 +201,7 @@ class StoreApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = ['application/json']; @@ -206,6 +213,7 @@ class StoreApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart index a44252a6130b..46eef79d505a 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart @@ -37,6 +37,7 @@ class UserApi { final headerParams = {}; final formParams = {}; + const authNames = ['api_key']; const contentTypes = ['application/json']; @@ -48,6 +49,7 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -87,6 +89,7 @@ class UserApi { final headerParams = {}; final formParams = {}; + const authNames = ['api_key']; const contentTypes = ['application/json']; @@ -98,6 +101,7 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -137,6 +141,7 @@ class UserApi { final headerParams = {}; final formParams = {}; + const authNames = ['api_key']; const contentTypes = ['application/json']; @@ -148,6 +153,7 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -188,6 +194,7 @@ class UserApi { final headerParams = {}; final formParams = {}; + const authNames = ['api_key']; const contentTypes = []; @@ -199,6 +206,7 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -239,6 +247,7 @@ class UserApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = []; @@ -250,6 +259,7 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -303,6 +313,7 @@ class UserApi { queryParams.addAll(_queryParams('', 'username', username)); queryParams.addAll(_queryParams('', 'password', password)); + const authNames = []; const contentTypes = []; @@ -314,6 +325,7 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -359,6 +371,7 @@ class UserApi { final headerParams = {}; final formParams = {}; + const authNames = ['api_key']; const contentTypes = []; @@ -370,6 +383,7 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -408,6 +422,7 @@ class UserApi { final headerParams = {}; final formParams = {}; + const authNames = ['api_key']; const contentTypes = ['application/json']; @@ -419,6 +434,7 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart index ce5560f03f00..cc93bf3d40f0 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart @@ -11,7 +11,7 @@ part of openapi.api; class ApiClient { - ApiClient({this.basePath = 'http://petstore.swagger.io/v2', this.authentication}); + ApiClient({this.basePath = 'http://petstore.swagger.io/v2', this.authentication,}); final String basePath; @@ -46,8 +46,9 @@ class ApiClient { Map headerParams, Map formParams, String? contentType, + List authNames, ) async { - _updateParamsForAuth(queryParams, headerParams); + _updateParamsForAuth(authNames, queryParams, headerParams); headerParams.addAll(_defaultHeaderMap); if (contentType != null) { @@ -167,12 +168,11 @@ class ApiClient { /// Update query and header parameters based on authentication settings. void _updateParamsForAuth( + List authNames, List queryParams, Map headerParams, ) { - if (authentication != null) { - authentication!.applyToParams(queryParams, headerParams); - } + authentication?.applyToParams(authNames, queryParams, headerParams); } static dynamic _deserialize(dynamic value, String targetType, {bool growable = false}) { diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart index e304eda321ee..c3729546eca6 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart @@ -20,7 +20,11 @@ class ApiKeyAuth implements Authentication { String apiKey = ''; @override - void applyToParams(List queryParams, Map headerParams) { + void applyToParams( + List authNames, + List queryParams, + Map headerParams, + ) { final paramValue = apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey'; if (paramValue.isNotEmpty) { diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart index 49baf7c46a9c..d1de54235e51 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart @@ -13,5 +13,9 @@ part of openapi.api; // ignore: one_member_abstracts abstract class Authentication { /// Apply authentication settings to header and query params. - void applyToParams(List queryParams, Map headerParams); + void applyToParams( + List authNames, + List queryParams, + Map headerParams, + ); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart index 81abd7185f2d..5c5d2069d533 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart @@ -17,7 +17,11 @@ class HttpBasicAuth implements Authentication { String password; @override - void applyToParams(List queryParams, Map headerParams) { + void applyToParams( + List authNames, + List queryParams, + Map headerParams, + ) { if (username.isNotEmpty && password.isNotEmpty) { final credentials = '$username:$password'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart index 213f3483b8fb..c7e9fd1fea89 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart @@ -27,7 +27,11 @@ class HttpBearerAuth implements Authentication { } @override - void applyToParams(List queryParams, Map headerParams) { + void applyToParams( + List authNames, + List queryParams, + Map headerParams, + ) { if (_accessToken == null) { return; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart index e9b87cffb052..e90331d79c9c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart @@ -16,7 +16,11 @@ class OAuth implements Authentication { String accessToken; @override - void applyToParams(List queryParams, Map headerParams) { + void applyToParams( + List authNames, + List queryParams, + Map headerParams, + ) { if (accessToken.isNotEmpty) { headerParams['Authorization'] = 'Bearer $accessToken'; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart index a4eaa58a9d08..38df202ce9b0 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart @@ -59,23 +59,23 @@ class ApiResponse { String toString() => 'ApiResponse[code=$code, type=$type, message=$message]'; Map toJson() { - final _json = {}; + final json = {}; if (code != null) { - _json[r'code'] = code; + json[r'code'] = code; } else { - _json[r'code'] = null; + json[r'code'] = null; } if (type != null) { - _json[r'type'] = type; + json[r'type'] = type; } else { - _json[r'type'] = null; + json[r'type'] = null; } if (message != null) { - _json[r'message'] = message; + json[r'message'] = message; } else { - _json[r'message'] = null; + json[r'message'] = null; } - return _json; + return json; } /// Returns a new [ApiResponse] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/category.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/category.dart index d010dbf2c441..3f424dfb4eb9 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/category.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/category.dart @@ -48,18 +48,18 @@ class Category { String toString() => 'Category[id=$id, name=$name]'; Map toJson() { - final _json = {}; + final json = {}; if (id != null) { - _json[r'id'] = id; + json[r'id'] = id; } else { - _json[r'id'] = null; + json[r'id'] = null; } if (name != null) { - _json[r'name'] = name; + json[r'name'] = name; } else { - _json[r'name'] = null; + json[r'name'] = null; } - return _json; + return json; } /// Returns a new [Category] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart index 27db5fd31821..a353e15298c0 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart @@ -81,34 +81,34 @@ class Order { String toString() => 'Order[id=$id, petId=$petId, quantity=$quantity, shipDate=$shipDate, status=$status, complete=$complete]'; Map toJson() { - final _json = {}; + final json = {}; if (id != null) { - _json[r'id'] = id; + json[r'id'] = id; } else { - _json[r'id'] = null; + json[r'id'] = null; } if (petId != null) { - _json[r'petId'] = petId; + json[r'petId'] = petId; } else { - _json[r'petId'] = null; + json[r'petId'] = null; } if (quantity != null) { - _json[r'quantity'] = quantity; + json[r'quantity'] = quantity; } else { - _json[r'quantity'] = null; + json[r'quantity'] = null; } if (shipDate != null) { - _json[r'shipDate'] = shipDate!.toUtc().toIso8601String(); + json[r'shipDate'] = shipDate!.toUtc().toIso8601String(); } else { - _json[r'shipDate'] = null; + json[r'shipDate'] = null; } if (status != null) { - _json[r'status'] = status; + json[r'status'] = status; } else { - _json[r'status'] = null; + json[r'status'] = null; } - _json[r'complete'] = complete; - return _json; + json[r'complete'] = complete; + return json; } /// Returns a new [Order] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart index e93bff4b5dc2..c97f8a710575 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart @@ -69,26 +69,26 @@ class Pet { String toString() => 'Pet[id=$id, category=$category, name=$name, photoUrls=$photoUrls, tags=$tags, status=$status]'; Map toJson() { - final _json = {}; + final json = {}; if (id != null) { - _json[r'id'] = id; + json[r'id'] = id; } else { - _json[r'id'] = null; + json[r'id'] = null; } if (category != null) { - _json[r'category'] = category; + json[r'category'] = category; } else { - _json[r'category'] = null; + json[r'category'] = null; } - _json[r'name'] = name; - _json[r'photoUrls'] = photoUrls; - _json[r'tags'] = tags; + json[r'name'] = name; + json[r'photoUrls'] = photoUrls; + json[r'tags'] = tags; if (status != null) { - _json[r'status'] = status; + json[r'status'] = status; } else { - _json[r'status'] = null; + json[r'status'] = null; } - return _json; + return json; } /// Returns a new [Pet] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart index 18e86440a168..e718c6690269 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart @@ -48,18 +48,18 @@ class Tag { String toString() => 'Tag[id=$id, name=$name]'; Map toJson() { - final _json = {}; + final json = {}; if (id != null) { - _json[r'id'] = id; + json[r'id'] = id; } else { - _json[r'id'] = null; + json[r'id'] = null; } if (name != null) { - _json[r'name'] = name; + json[r'name'] = name; } else { - _json[r'name'] = null; + json[r'name'] = null; } - return _json; + return json; } /// Returns a new [Tag] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/user.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/user.dart index 4d3d14508cda..7a14b4426780 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/user.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/user.dart @@ -115,48 +115,48 @@ class User { String toString() => 'User[id=$id, username=$username, firstName=$firstName, lastName=$lastName, email=$email, password=$password, phone=$phone, userStatus=$userStatus]'; Map toJson() { - final _json = {}; + final json = {}; if (id != null) { - _json[r'id'] = id; + json[r'id'] = id; } else { - _json[r'id'] = null; + json[r'id'] = null; } if (username != null) { - _json[r'username'] = username; + json[r'username'] = username; } else { - _json[r'username'] = null; + json[r'username'] = null; } if (firstName != null) { - _json[r'firstName'] = firstName; + json[r'firstName'] = firstName; } else { - _json[r'firstName'] = null; + json[r'firstName'] = null; } if (lastName != null) { - _json[r'lastName'] = lastName; + json[r'lastName'] = lastName; } else { - _json[r'lastName'] = null; + json[r'lastName'] = null; } if (email != null) { - _json[r'email'] = email; + json[r'email'] = email; } else { - _json[r'email'] = null; + json[r'email'] = null; } if (password != null) { - _json[r'password'] = password; + json[r'password'] = password; } else { - _json[r'password'] = null; + json[r'password'] = null; } if (phone != null) { - _json[r'phone'] = phone; + json[r'phone'] = phone; } else { - _json[r'phone'] = null; + json[r'phone'] = null; } if (userStatus != null) { - _json[r'userStatus'] = userStatus; + json[r'userStatus'] = userStatus; } else { - _json[r'userStatus'] = null; + json[r'userStatus'] = null; } - return _json; + return json; } /// Returns a new [User] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/another_fake_api.dart index 689eafbd8ed7..f03350c4dfff 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/another_fake_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/another_fake_api.dart @@ -37,6 +37,7 @@ class AnotherFakeApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = ['application/json']; @@ -48,6 +49,7 @@ class AnotherFakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart index c62615343015..6ac6f276ffe9 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart @@ -28,6 +28,7 @@ class DefaultApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = []; @@ -39,6 +40,7 @@ class DefaultApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart index 6cfbfb4e6c93..d4bd12ec939b 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart @@ -30,6 +30,7 @@ class FakeApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = []; @@ -41,6 +42,7 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -93,6 +95,7 @@ class FakeApi { headerParams[r'header_1'] = parameterToString(header1); } + const authNames = ['http_signature_test']; const contentTypes = ['application/json', 'application/xml']; @@ -104,6 +107,7 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -145,6 +149,7 @@ class FakeApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = ['application/json']; @@ -156,6 +161,7 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -199,6 +205,7 @@ class FakeApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = ['application/json']; @@ -210,6 +217,7 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -253,6 +261,7 @@ class FakeApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = ['application/json']; @@ -264,6 +273,7 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -307,6 +317,7 @@ class FakeApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = ['application/json']; @@ -318,6 +329,7 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -361,6 +373,7 @@ class FakeApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = ['application/json']; @@ -372,6 +385,7 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -415,6 +429,7 @@ class FakeApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = ['image/png']; @@ -426,6 +441,7 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -460,6 +476,7 @@ class FakeApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = ['application/json']; @@ -471,6 +488,7 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -505,6 +523,7 @@ class FakeApi { queryParams.addAll(_queryParams('', 'query', query)); + const authNames = []; const contentTypes = ['application/json']; @@ -516,6 +535,7 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -552,6 +572,7 @@ class FakeApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = ['application/json']; @@ -563,6 +584,7 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -649,6 +671,7 @@ class FakeApi { final headerParams = {}; final formParams = {}; + const authNames = ['http_basic_test']; const contentTypes = ['application/x-www-form-urlencoded']; if (integer != null) { @@ -699,6 +722,7 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -823,6 +847,7 @@ class FakeApi { headerParams[r'enum_header_string'] = parameterToString(enumHeaderString); } + const authNames = []; const contentTypes = ['application/x-www-form-urlencoded']; if (enumFormStringArray != null) { @@ -840,6 +865,7 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -931,6 +957,7 @@ class FakeApi { headerParams[r'boolean_group'] = parameterToString(booleanGroup); } + const authNames = ['bearer_test']; const contentTypes = []; @@ -942,6 +969,7 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -996,6 +1024,7 @@ class FakeApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = ['application/json']; @@ -1007,6 +1036,7 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -1049,6 +1079,7 @@ class FakeApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = ['application/x-www-form-urlencoded']; if (param != null) { @@ -1066,6 +1097,7 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -1127,6 +1159,7 @@ class FakeApi { } queryParams.addAll(_queryParams('', 'allowEmpty', allowEmpty)); + const authNames = []; const contentTypes = []; @@ -1138,6 +1171,7 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart index 2782357efb9b..158c127195bf 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart @@ -37,6 +37,7 @@ class FakeClassnameTags123Api { final headerParams = {}; final formParams = {}; + const authNames = ['api_key_query']; const contentTypes = ['application/json']; @@ -48,6 +49,7 @@ class FakeClassnameTags123Api { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart index 371afa625cfc..74d8ab2b059d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart @@ -37,6 +37,7 @@ class PetApi { final headerParams = {}; final formParams = {}; + const authNames = ['petstore_auth']; const contentTypes = ['application/json', 'application/xml']; @@ -48,6 +49,7 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -94,6 +96,7 @@ class PetApi { headerParams[r'api_key'] = parameterToString(apiKey); } + const authNames = ['petstore_auth']; const contentTypes = []; @@ -105,6 +108,7 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -148,6 +152,7 @@ class PetApi { queryParams.addAll(_queryParams('csv', 'status', status)); + const authNames = ['petstore_auth']; const contentTypes = []; @@ -159,6 +164,7 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -211,6 +217,7 @@ class PetApi { queryParams.addAll(_queryParams('csv', 'tags', tags)); + const authNames = ['petstore_auth']; const contentTypes = []; @@ -222,6 +229,7 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -273,6 +281,7 @@ class PetApi { final headerParams = {}; final formParams = {}; + const authNames = ['api_key']; const contentTypes = []; @@ -284,6 +293,7 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -331,6 +341,7 @@ class PetApi { final headerParams = {}; final formParams = {}; + const authNames = ['petstore_auth']; const contentTypes = ['application/json', 'application/xml']; @@ -342,6 +353,7 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -388,6 +400,7 @@ class PetApi { final headerParams = {}; final formParams = {}; + const authNames = ['petstore_auth']; const contentTypes = ['application/x-www-form-urlencoded']; if (name != null) { @@ -405,6 +418,7 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -457,6 +471,7 @@ class PetApi { final headerParams = {}; final formParams = {}; + const authNames = ['petstore_auth']; const contentTypes = ['multipart/form-data']; bool hasFields = false; @@ -482,6 +497,7 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -542,6 +558,7 @@ class PetApi { final headerParams = {}; final formParams = {}; + const authNames = ['petstore_auth']; const contentTypes = ['multipart/form-data']; bool hasFields = false; @@ -567,6 +584,7 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/store_api.dart index 68c1c9fdccb9..ee1756bea39b 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/store_api.dart @@ -38,6 +38,7 @@ class StoreApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = []; @@ -49,6 +50,7 @@ class StoreApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -83,6 +85,7 @@ class StoreApi { final headerParams = {}; final formParams = {}; + const authNames = ['api_key']; const contentTypes = []; @@ -94,6 +97,7 @@ class StoreApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -137,6 +141,7 @@ class StoreApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = []; @@ -148,6 +153,7 @@ class StoreApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -195,6 +201,7 @@ class StoreApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = ['application/json']; @@ -206,6 +213,7 @@ class StoreApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/user_api.dart index a44252a6130b..dec46b87bd84 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/user_api.dart @@ -37,6 +37,7 @@ class UserApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = ['application/json']; @@ -48,6 +49,7 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -87,6 +89,7 @@ class UserApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = ['application/json']; @@ -98,6 +101,7 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -137,6 +141,7 @@ class UserApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = ['application/json']; @@ -148,6 +153,7 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -188,6 +194,7 @@ class UserApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = []; @@ -199,6 +206,7 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -239,6 +247,7 @@ class UserApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = []; @@ -250,6 +259,7 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -303,6 +313,7 @@ class UserApi { queryParams.addAll(_queryParams('', 'username', username)); queryParams.addAll(_queryParams('', 'password', password)); + const authNames = []; const contentTypes = []; @@ -314,6 +325,7 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -359,6 +371,7 @@ class UserApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = []; @@ -370,6 +383,7 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } @@ -408,6 +422,7 @@ class UserApi { final headerParams = {}; final formParams = {}; + const authNames = []; const contentTypes = ['application/json']; @@ -419,6 +434,7 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, + authNames, ); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart index 94a25909e6d9..ce14a4b9c1d5 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart @@ -11,7 +11,7 @@ part of openapi.api; class ApiClient { - ApiClient({this.basePath = 'http://petstore.swagger.io:80/v2', this.authentication}); + ApiClient({this.basePath = 'http://petstore.swagger.io:80/v2', this.authentication,}); final String basePath; @@ -46,8 +46,9 @@ class ApiClient { Map headerParams, Map formParams, String? contentType, + List authNames, ) async { - _updateParamsForAuth(queryParams, headerParams); + _updateParamsForAuth(authNames, queryParams, headerParams); headerParams.addAll(_defaultHeaderMap); if (contentType != null) { @@ -167,12 +168,11 @@ class ApiClient { /// Update query and header parameters based on authentication settings. void _updateParamsForAuth( + List authNames, List queryParams, Map headerParams, ) { - if (authentication != null) { - authentication!.applyToParams(queryParams, headerParams); - } + authentication?.applyToParams(authNames, queryParams, headerParams); } static dynamic _deserialize(dynamic value, String targetType, {bool growable = false}) { diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/api_key_auth.dart index e304eda321ee..c3729546eca6 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/api_key_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/api_key_auth.dart @@ -20,7 +20,11 @@ class ApiKeyAuth implements Authentication { String apiKey = ''; @override - void applyToParams(List queryParams, Map headerParams) { + void applyToParams( + List authNames, + List queryParams, + Map headerParams, + ) { final paramValue = apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey'; if (paramValue.isNotEmpty) { diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/authentication.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/authentication.dart index 49baf7c46a9c..d1de54235e51 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/authentication.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/authentication.dart @@ -13,5 +13,9 @@ part of openapi.api; // ignore: one_member_abstracts abstract class Authentication { /// Apply authentication settings to header and query params. - void applyToParams(List queryParams, Map headerParams); + void applyToParams( + List authNames, + List queryParams, + Map headerParams, + ); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_basic_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_basic_auth.dart index 81abd7185f2d..5c5d2069d533 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_basic_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_basic_auth.dart @@ -17,7 +17,11 @@ class HttpBasicAuth implements Authentication { String password; @override - void applyToParams(List queryParams, Map headerParams) { + void applyToParams( + List authNames, + List queryParams, + Map headerParams, + ) { if (username.isNotEmpty && password.isNotEmpty) { final credentials = '$username:$password'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_bearer_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_bearer_auth.dart index 213f3483b8fb..c7e9fd1fea89 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_bearer_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_bearer_auth.dart @@ -27,7 +27,11 @@ class HttpBearerAuth implements Authentication { } @override - void applyToParams(List queryParams, Map headerParams) { + void applyToParams( + List authNames, + List queryParams, + Map headerParams, + ) { if (_accessToken == null) { return; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/oauth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/oauth.dart index e9b87cffb052..e90331d79c9c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/oauth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/oauth.dart @@ -16,7 +16,11 @@ class OAuth implements Authentication { String accessToken; @override - void applyToParams(List queryParams, Map headerParams) { + void applyToParams( + List authNames, + List queryParams, + Map headerParams, + ) { if (accessToken.isNotEmpty) { headerParams['Authorization'] = 'Bearer $accessToken'; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/additional_properties_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/additional_properties_class.dart index 43adda6ff718..e82b8265bf59 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/additional_properties_class.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/additional_properties_class.dart @@ -36,10 +36,10 @@ class AdditionalPropertiesClass { String toString() => 'AdditionalPropertiesClass[mapProperty=$mapProperty, mapOfMapProperty=$mapOfMapProperty]'; Map toJson() { - final _json = {}; - _json[r'map_property'] = mapProperty; - _json[r'map_of_map_property'] = mapOfMapProperty; - return _json; + final json = {}; + json[r'map_property'] = mapProperty; + json[r'map_of_map_property'] = mapOfMapProperty; + return json; } /// Returns a new [AdditionalPropertiesClass] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/all_of_with_single_ref.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/all_of_with_single_ref.dart index 22a9e4600d63..531853431976 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/all_of_with_single_ref.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/all_of_with_single_ref.dart @@ -42,18 +42,18 @@ class AllOfWithSingleRef { String toString() => 'AllOfWithSingleRef[username=$username, singleRefType=$singleRefType]'; Map toJson() { - final _json = {}; + final json = {}; if (username != null) { - _json[r'username'] = username; + json[r'username'] = username; } else { - _json[r'username'] = null; + json[r'username'] = null; } if (singleRefType != null) { - _json[r'SingleRefType'] = singleRefType; + json[r'SingleRefType'] = singleRefType; } else { - _json[r'SingleRefType'] = null; + json[r'SingleRefType'] = null; } - return _json; + return json; } /// Returns a new [AllOfWithSingleRef] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart index ab9fe4deccdb..2d279e07c494 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart @@ -36,10 +36,10 @@ class Animal { String toString() => 'Animal[className=$className, color=$color]'; Map toJson() { - final _json = {}; - _json[r'className'] = className; - _json[r'color'] = color; - return _json; + final json = {}; + json[r'className'] = className; + json[r'color'] = color; + return json; } /// Returns a new [Animal] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/api_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/api_response.dart index a4eaa58a9d08..38df202ce9b0 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/api_response.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/api_response.dart @@ -59,23 +59,23 @@ class ApiResponse { String toString() => 'ApiResponse[code=$code, type=$type, message=$message]'; Map toJson() { - final _json = {}; + final json = {}; if (code != null) { - _json[r'code'] = code; + json[r'code'] = code; } else { - _json[r'code'] = null; + json[r'code'] = null; } if (type != null) { - _json[r'type'] = type; + json[r'type'] = type; } else { - _json[r'type'] = null; + json[r'type'] = null; } if (message != null) { - _json[r'message'] = message; + json[r'message'] = message; } else { - _json[r'message'] = null; + json[r'message'] = null; } - return _json; + return json; } /// Returns a new [ApiResponse] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_array_of_number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_array_of_number_only.dart index c328bc86ab9f..4314803a3ba5 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_array_of_number_only.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_array_of_number_only.dart @@ -31,9 +31,9 @@ class ArrayOfArrayOfNumberOnly { String toString() => 'ArrayOfArrayOfNumberOnly[arrayArrayNumber=$arrayArrayNumber]'; Map toJson() { - final _json = {}; - _json[r'ArrayArrayNumber'] = arrayArrayNumber; - return _json; + final json = {}; + json[r'ArrayArrayNumber'] = arrayArrayNumber; + return json; } /// Returns a new [ArrayOfArrayOfNumberOnly] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_number_only.dart index 15a737605dc6..8e9d6784f804 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_number_only.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_number_only.dart @@ -31,9 +31,9 @@ class ArrayOfNumberOnly { String toString() => 'ArrayOfNumberOnly[arrayNumber=$arrayNumber]'; Map toJson() { - final _json = {}; - _json[r'ArrayNumber'] = arrayNumber; - return _json; + final json = {}; + json[r'ArrayNumber'] = arrayNumber; + return json; } /// Returns a new [ArrayOfNumberOnly] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_test.dart index f9497f9a719b..a914c04ee52a 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_test.dart @@ -41,11 +41,11 @@ class ArrayTest { String toString() => 'ArrayTest[arrayOfString=$arrayOfString, arrayArrayOfInteger=$arrayArrayOfInteger, arrayArrayOfModel=$arrayArrayOfModel]'; Map toJson() { - final _json = {}; - _json[r'array_of_string'] = arrayOfString; - _json[r'array_array_of_integer'] = arrayArrayOfInteger; - _json[r'array_array_of_model'] = arrayArrayOfModel; - return _json; + final json = {}; + json[r'array_of_string'] = arrayOfString; + json[r'array_array_of_integer'] = arrayArrayOfInteger; + json[r'array_array_of_model'] = arrayArrayOfModel; + return json; } /// Returns a new [ArrayTest] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/capitalization.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/capitalization.dart index fc5ed9f6d2f2..024d0edcc4be 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/capitalization.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/capitalization.dart @@ -93,38 +93,38 @@ class Capitalization { String toString() => 'Capitalization[smallCamel=$smallCamel, capitalCamel=$capitalCamel, smallSnake=$smallSnake, capitalSnake=$capitalSnake, sCAETHFlowPoints=$sCAETHFlowPoints, ATT_NAME=$ATT_NAME]'; Map toJson() { - final _json = {}; + final json = {}; if (smallCamel != null) { - _json[r'smallCamel'] = smallCamel; + json[r'smallCamel'] = smallCamel; } else { - _json[r'smallCamel'] = null; + json[r'smallCamel'] = null; } if (capitalCamel != null) { - _json[r'CapitalCamel'] = capitalCamel; + json[r'CapitalCamel'] = capitalCamel; } else { - _json[r'CapitalCamel'] = null; + json[r'CapitalCamel'] = null; } if (smallSnake != null) { - _json[r'small_Snake'] = smallSnake; + json[r'small_Snake'] = smallSnake; } else { - _json[r'small_Snake'] = null; + json[r'small_Snake'] = null; } if (capitalSnake != null) { - _json[r'Capital_Snake'] = capitalSnake; + json[r'Capital_Snake'] = capitalSnake; } else { - _json[r'Capital_Snake'] = null; + json[r'Capital_Snake'] = null; } if (sCAETHFlowPoints != null) { - _json[r'SCA_ETH_Flow_Points'] = sCAETHFlowPoints; + json[r'SCA_ETH_Flow_Points'] = sCAETHFlowPoints; } else { - _json[r'SCA_ETH_Flow_Points'] = null; + json[r'SCA_ETH_Flow_Points'] = null; } if (ATT_NAME != null) { - _json[r'ATT_NAME'] = ATT_NAME; + json[r'ATT_NAME'] = ATT_NAME; } else { - _json[r'ATT_NAME'] = null; + json[r'ATT_NAME'] = null; } - return _json; + return json; } /// Returns a new [Capitalization] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart index a3011f6a11ea..5da9cf9a2a8c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart @@ -47,15 +47,15 @@ class Cat { String toString() => 'Cat[className=$className, color=$color, declawed=$declawed]'; Map toJson() { - final _json = {}; - _json[r'className'] = className; - _json[r'color'] = color; + final json = {}; + json[r'className'] = className; + json[r'color'] = color; if (declawed != null) { - _json[r'declawed'] = declawed; + json[r'declawed'] = declawed; } else { - _json[r'declawed'] = null; + json[r'declawed'] = null; } - return _json; + return json; } /// Returns a new [Cat] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat_all_of.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat_all_of.dart index d9b6f7300505..7dfc68e8ff2f 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat_all_of.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat_all_of.dart @@ -37,13 +37,13 @@ class CatAllOf { String toString() => 'CatAllOf[declawed=$declawed]'; Map toJson() { - final _json = {}; + final json = {}; if (declawed != null) { - _json[r'declawed'] = declawed; + json[r'declawed'] = declawed; } else { - _json[r'declawed'] = null; + json[r'declawed'] = null; } - return _json; + return json; } /// Returns a new [CatAllOf] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/category.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/category.dart index 364afedb3e70..f4695bed5dc3 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/category.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/category.dart @@ -42,14 +42,14 @@ class Category { String toString() => 'Category[id=$id, name=$name]'; Map toJson() { - final _json = {}; + final json = {}; if (id != null) { - _json[r'id'] = id; + json[r'id'] = id; } else { - _json[r'id'] = null; + json[r'id'] = null; } - _json[r'name'] = name; - return _json; + json[r'name'] = name; + return json; } /// Returns a new [Category] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/class_model.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/class_model.dart index 96e9daa12e2e..8c4c060fb60d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/class_model.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/class_model.dart @@ -37,13 +37,13 @@ class ClassModel { String toString() => 'ClassModel[class_=$class_]'; Map toJson() { - final _json = {}; + final json = {}; if (class_ != null) { - _json[r'_class'] = class_; + json[r'_class'] = class_; } else { - _json[r'_class'] = null; + json[r'_class'] = null; } - return _json; + return json; } /// Returns a new [ClassModel] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/deprecated_object.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/deprecated_object.dart index bb90d8abe893..4d3b15c7706d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/deprecated_object.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/deprecated_object.dart @@ -37,13 +37,13 @@ class DeprecatedObject { String toString() => 'DeprecatedObject[name=$name]'; Map toJson() { - final _json = {}; + final json = {}; if (name != null) { - _json[r'name'] = name; + json[r'name'] = name; } else { - _json[r'name'] = null; + json[r'name'] = null; } - return _json; + return json; } /// Returns a new [DeprecatedObject] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart index bad82eff1e13..d07298479309 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart @@ -47,15 +47,15 @@ class Dog { String toString() => 'Dog[className=$className, color=$color, breed=$breed]'; Map toJson() { - final _json = {}; - _json[r'className'] = className; - _json[r'color'] = color; + final json = {}; + json[r'className'] = className; + json[r'color'] = color; if (breed != null) { - _json[r'breed'] = breed; + json[r'breed'] = breed; } else { - _json[r'breed'] = null; + json[r'breed'] = null; } - return _json; + return json; } /// Returns a new [Dog] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog_all_of.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog_all_of.dart index fd2aedb5a7f5..7830a1f1c266 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog_all_of.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog_all_of.dart @@ -37,13 +37,13 @@ class DogAllOf { String toString() => 'DogAllOf[breed=$breed]'; Map toJson() { - final _json = {}; + final json = {}; if (breed != null) { - _json[r'breed'] = breed; + json[r'breed'] = breed; } else { - _json[r'breed'] = null; + json[r'breed'] = null; } - return _json; + return json; } /// Returns a new [DogAllOf] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart index 42830ee43746..7217c169ec99 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart @@ -36,14 +36,14 @@ class EnumArrays { String toString() => 'EnumArrays[justSymbol=$justSymbol, arrayEnum=$arrayEnum]'; Map toJson() { - final _json = {}; + final json = {}; if (justSymbol != null) { - _json[r'just_symbol'] = justSymbol; + json[r'just_symbol'] = justSymbol; } else { - _json[r'just_symbol'] = null; + json[r'just_symbol'] = null; } - _json[r'array_enum'] = arrayEnum; - return _json; + json[r'array_enum'] = arrayEnum; + return json; } /// Returns a new [EnumArrays] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart index d947a241e5bc..0a8ab56327b0 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart @@ -84,44 +84,44 @@ class EnumTest { String toString() => 'EnumTest[enumString=$enumString, enumStringRequired=$enumStringRequired, enumInteger=$enumInteger, enumNumber=$enumNumber, outerEnum=$outerEnum, outerEnumInteger=$outerEnumInteger, outerEnumDefaultValue=$outerEnumDefaultValue, outerEnumIntegerDefaultValue=$outerEnumIntegerDefaultValue]'; Map toJson() { - final _json = {}; + final json = {}; if (enumString != null) { - _json[r'enum_string'] = enumString; + json[r'enum_string'] = enumString; } else { - _json[r'enum_string'] = null; + json[r'enum_string'] = null; } - _json[r'enum_string_required'] = enumStringRequired; + json[r'enum_string_required'] = enumStringRequired; if (enumInteger != null) { - _json[r'enum_integer'] = enumInteger; + json[r'enum_integer'] = enumInteger; } else { - _json[r'enum_integer'] = null; + json[r'enum_integer'] = null; } if (enumNumber != null) { - _json[r'enum_number'] = enumNumber; + json[r'enum_number'] = enumNumber; } else { - _json[r'enum_number'] = null; + json[r'enum_number'] = null; } if (outerEnum != null) { - _json[r'outerEnum'] = outerEnum; + json[r'outerEnum'] = outerEnum; } else { - _json[r'outerEnum'] = null; + json[r'outerEnum'] = null; } if (outerEnumInteger != null) { - _json[r'outerEnumInteger'] = outerEnumInteger; + json[r'outerEnumInteger'] = outerEnumInteger; } else { - _json[r'outerEnumInteger'] = null; + json[r'outerEnumInteger'] = null; } if (outerEnumDefaultValue != null) { - _json[r'outerEnumDefaultValue'] = outerEnumDefaultValue; + json[r'outerEnumDefaultValue'] = outerEnumDefaultValue; } else { - _json[r'outerEnumDefaultValue'] = null; + json[r'outerEnumDefaultValue'] = null; } if (outerEnumIntegerDefaultValue != null) { - _json[r'outerEnumIntegerDefaultValue'] = outerEnumIntegerDefaultValue; + json[r'outerEnumIntegerDefaultValue'] = outerEnumIntegerDefaultValue; } else { - _json[r'outerEnumIntegerDefaultValue'] = null; + json[r'outerEnumIntegerDefaultValue'] = null; } - return _json; + return json; } /// Returns a new [EnumTest] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/file_schema_test_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/file_schema_test_class.dart index 57332cfe3836..21d819ce73be 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/file_schema_test_class.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/file_schema_test_class.dart @@ -42,14 +42,14 @@ class FileSchemaTestClass { String toString() => 'FileSchemaTestClass[file=$file, files=$files]'; Map toJson() { - final _json = {}; + final json = {}; if (file != null) { - _json[r'file'] = file; + json[r'file'] = file; } else { - _json[r'file'] = null; + json[r'file'] = null; } - _json[r'files'] = files; - return _json; + json[r'files'] = files; + return json; } /// Returns a new [FileSchemaTestClass] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo.dart index d788ffcc5bac..4fd3f08d59a8 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo.dart @@ -31,9 +31,9 @@ class Foo { String toString() => 'Foo[bar=$bar]'; Map toJson() { - final _json = {}; - _json[r'bar'] = bar; - return _json; + final json = {}; + json[r'bar'] = bar; + return json; } /// Returns a new [Foo] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo_get_default_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo_get_default_response.dart index e240869104fa..a4ce441dfbed 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo_get_default_response.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo_get_default_response.dart @@ -37,13 +37,13 @@ class FooGetDefaultResponse { String toString() => 'FooGetDefaultResponse[string=$string]'; Map toJson() { - final _json = {}; + final json = {}; if (string != null) { - _json[r'string'] = string; + json[r'string'] = string; } else { - _json[r'string'] = null; + json[r'string'] = null; } - return _json; + return json; } /// Returns a new [FooGetDefaultResponse] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/format_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/format_test.dart index 20bf557aa8f6..3e0d9737e3ac 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/format_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/format_test.dart @@ -190,72 +190,72 @@ class FormatTest { String toString() => 'FormatTest[integer=$integer, int32=$int32, int64=$int64, number=$number, float=$float, double_=$double_, decimal=$decimal, string=$string, byte=$byte, binary=$binary, date=$date, dateTime=$dateTime, uuid=$uuid, password=$password, patternWithDigits=$patternWithDigits, patternWithDigitsAndDelimiter=$patternWithDigitsAndDelimiter]'; Map toJson() { - final _json = {}; + final json = {}; if (integer != null) { - _json[r'integer'] = integer; + json[r'integer'] = integer; } else { - _json[r'integer'] = null; + json[r'integer'] = null; } if (int32 != null) { - _json[r'int32'] = int32; + json[r'int32'] = int32; } else { - _json[r'int32'] = null; + json[r'int32'] = null; } if (int64 != null) { - _json[r'int64'] = int64; + json[r'int64'] = int64; } else { - _json[r'int64'] = null; + json[r'int64'] = null; } - _json[r'number'] = number; + json[r'number'] = number; if (float != null) { - _json[r'float'] = float; + json[r'float'] = float; } else { - _json[r'float'] = null; + json[r'float'] = null; } if (double_ != null) { - _json[r'double'] = double_; + json[r'double'] = double_; } else { - _json[r'double'] = null; + json[r'double'] = null; } if (decimal != null) { - _json[r'decimal'] = decimal; + json[r'decimal'] = decimal; } else { - _json[r'decimal'] = null; + json[r'decimal'] = null; } if (string != null) { - _json[r'string'] = string; + json[r'string'] = string; } else { - _json[r'string'] = null; + json[r'string'] = null; } - _json[r'byte'] = byte; + json[r'byte'] = byte; if (binary != null) { - _json[r'binary'] = binary; + json[r'binary'] = binary; } else { - _json[r'binary'] = null; + json[r'binary'] = null; } - _json[r'date'] = _dateFormatter.format(date.toUtc()); + json[r'date'] = _dateFormatter.format(date.toUtc()); if (dateTime != null) { - _json[r'dateTime'] = dateTime!.toUtc().toIso8601String(); + json[r'dateTime'] = dateTime!.toUtc().toIso8601String(); } else { - _json[r'dateTime'] = null; + json[r'dateTime'] = null; } if (uuid != null) { - _json[r'uuid'] = uuid; + json[r'uuid'] = uuid; } else { - _json[r'uuid'] = null; + json[r'uuid'] = null; } - _json[r'password'] = password; + json[r'password'] = password; if (patternWithDigits != null) { - _json[r'pattern_with_digits'] = patternWithDigits; + json[r'pattern_with_digits'] = patternWithDigits; } else { - _json[r'pattern_with_digits'] = null; + json[r'pattern_with_digits'] = null; } if (patternWithDigitsAndDelimiter != null) { - _json[r'pattern_with_digits_and_delimiter'] = patternWithDigitsAndDelimiter; + json[r'pattern_with_digits_and_delimiter'] = patternWithDigitsAndDelimiter; } else { - _json[r'pattern_with_digits_and_delimiter'] = null; + json[r'pattern_with_digits_and_delimiter'] = null; } - return _json; + return json; } /// Returns a new [FormatTest] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/has_only_read_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/has_only_read_only.dart index cdbc81b89b55..b10dac32bf6e 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/has_only_read_only.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/has_only_read_only.dart @@ -48,18 +48,18 @@ class HasOnlyReadOnly { String toString() => 'HasOnlyReadOnly[bar=$bar, foo=$foo]'; Map toJson() { - final _json = {}; + final json = {}; if (bar != null) { - _json[r'bar'] = bar; + json[r'bar'] = bar; } else { - _json[r'bar'] = null; + json[r'bar'] = null; } if (foo != null) { - _json[r'foo'] = foo; + json[r'foo'] = foo; } else { - _json[r'foo'] = null; + json[r'foo'] = null; } - return _json; + return json; } /// Returns a new [HasOnlyReadOnly] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/health_check_result.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/health_check_result.dart index 05da330f661c..67fe059e10e1 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/health_check_result.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/health_check_result.dart @@ -31,13 +31,13 @@ class HealthCheckResult { String toString() => 'HealthCheckResult[nullableMessage=$nullableMessage]'; Map toJson() { - final _json = {}; + final json = {}; if (nullableMessage != null) { - _json[r'NullableMessage'] = nullableMessage; + json[r'NullableMessage'] = nullableMessage; } else { - _json[r'NullableMessage'] = null; + json[r'NullableMessage'] = null; } - return _json; + return json; } /// Returns a new [HealthCheckResult] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart index b544dc8c6f76..5afcb48e86fa 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart @@ -46,12 +46,12 @@ class MapTest { String toString() => 'MapTest[mapMapOfString=$mapMapOfString, mapOfEnumString=$mapOfEnumString, directMap=$directMap, indirectMap=$indirectMap]'; Map toJson() { - final _json = {}; - _json[r'map_map_of_string'] = mapMapOfString; - _json[r'map_of_enum_string'] = mapOfEnumString; - _json[r'direct_map'] = directMap; - _json[r'indirect_map'] = indirectMap; - return _json; + final json = {}; + json[r'map_map_of_string'] = mapMapOfString; + json[r'map_of_enum_string'] = mapOfEnumString; + json[r'direct_map'] = directMap; + json[r'indirect_map'] = indirectMap; + return json; } /// Returns a new [MapTest] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart index 268c7b3e7277..b2996851b2bc 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart @@ -53,19 +53,19 @@ class MixedPropertiesAndAdditionalPropertiesClass { String toString() => 'MixedPropertiesAndAdditionalPropertiesClass[uuid=$uuid, dateTime=$dateTime, map=$map]'; Map toJson() { - final _json = {}; + final json = {}; if (uuid != null) { - _json[r'uuid'] = uuid; + json[r'uuid'] = uuid; } else { - _json[r'uuid'] = null; + json[r'uuid'] = null; } if (dateTime != null) { - _json[r'dateTime'] = dateTime!.toUtc().toIso8601String(); + json[r'dateTime'] = dateTime!.toUtc().toIso8601String(); } else { - _json[r'dateTime'] = null; + json[r'dateTime'] = null; } - _json[r'map'] = map; - return _json; + json[r'map'] = map; + return json; } /// Returns a new [MixedPropertiesAndAdditionalPropertiesClass] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model200_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model200_response.dart index ab3afaa2bc89..13ede3ded433 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model200_response.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model200_response.dart @@ -48,18 +48,18 @@ class Model200Response { String toString() => 'Model200Response[name=$name, class_=$class_]'; Map toJson() { - final _json = {}; + final json = {}; if (name != null) { - _json[r'name'] = name; + json[r'name'] = name; } else { - _json[r'name'] = null; + json[r'name'] = null; } if (class_ != null) { - _json[r'class'] = class_; + json[r'class'] = class_; } else { - _json[r'class'] = null; + json[r'class'] = null; } - return _json; + return json; } /// Returns a new [Model200Response] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_client.dart index e5602b1733b7..ad83d62c8b6e 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_client.dart @@ -37,13 +37,13 @@ class ModelClient { String toString() => 'ModelClient[client=$client]'; Map toJson() { - final _json = {}; + final json = {}; if (client != null) { - _json[r'client'] = client; + json[r'client'] = client; } else { - _json[r'client'] = null; + json[r'client'] = null; } - return _json; + return json; } /// Returns a new [ModelClient] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_file.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_file.dart index a5c0a44feb3f..7456bbf19f61 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_file.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_file.dart @@ -38,13 +38,13 @@ class ModelFile { String toString() => 'ModelFile[sourceURI=$sourceURI]'; Map toJson() { - final _json = {}; + final json = {}; if (sourceURI != null) { - _json[r'sourceURI'] = sourceURI; + json[r'sourceURI'] = sourceURI; } else { - _json[r'sourceURI'] = null; + json[r'sourceURI'] = null; } - return _json; + return json; } /// Returns a new [ModelFile] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_list.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_list.dart index 1b0780f7c6e7..ebf60ae60004 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_list.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_list.dart @@ -37,13 +37,13 @@ class ModelList { String toString() => 'ModelList[n123list=$n123list]'; Map toJson() { - final _json = {}; + final json = {}; if (n123list != null) { - _json[r'123-list'] = n123list; + json[r'123-list'] = n123list; } else { - _json[r'123-list'] = null; + json[r'123-list'] = null; } - return _json; + return json; } /// Returns a new [ModelList] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_return.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_return.dart index 5b4bfe2703a9..3ff0dca337fb 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_return.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_return.dart @@ -37,13 +37,13 @@ class ModelReturn { String toString() => 'ModelReturn[return_=$return_]'; Map toJson() { - final _json = {}; + final json = {}; if (return_ != null) { - _json[r'return'] = return_; + json[r'return'] = return_; } else { - _json[r'return'] = null; + json[r'return'] = null; } - return _json; + return json; } /// Returns a new [ModelReturn] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/name.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/name.dart index 79e3220d0adb..83f42116cecc 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/name.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/name.dart @@ -64,24 +64,24 @@ class Name { String toString() => 'Name[name=$name, snakeCase=$snakeCase, property=$property, n123number=$n123number]'; Map toJson() { - final _json = {}; - _json[r'name'] = name; + final json = {}; + json[r'name'] = name; if (snakeCase != null) { - _json[r'snake_case'] = snakeCase; + json[r'snake_case'] = snakeCase; } else { - _json[r'snake_case'] = null; + json[r'snake_case'] = null; } if (property != null) { - _json[r'property'] = property; + json[r'property'] = property; } else { - _json[r'property'] = null; + json[r'property'] = null; } if (n123number != null) { - _json[r'123Number'] = n123number; + json[r'123Number'] = n123number; } else { - _json[r'123Number'] = null; + json[r'123Number'] = null; } - return _json; + return json; } /// Returns a new [Name] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/nullable_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/nullable_class.dart index 36133b31427a..b31d012c496c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/nullable_class.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/nullable_class.dart @@ -86,60 +86,60 @@ class NullableClass { String toString() => 'NullableClass[integerProp=$integerProp, numberProp=$numberProp, booleanProp=$booleanProp, stringProp=$stringProp, dateProp=$dateProp, datetimeProp=$datetimeProp, arrayNullableProp=$arrayNullableProp, arrayAndItemsNullableProp=$arrayAndItemsNullableProp, arrayItemsNullable=$arrayItemsNullable, objectNullableProp=$objectNullableProp, objectAndItemsNullableProp=$objectAndItemsNullableProp, objectItemsNullable=$objectItemsNullable]'; Map toJson() { - final _json = {}; + final json = {}; if (integerProp != null) { - _json[r'integer_prop'] = integerProp; + json[r'integer_prop'] = integerProp; } else { - _json[r'integer_prop'] = null; + json[r'integer_prop'] = null; } if (numberProp != null) { - _json[r'number_prop'] = numberProp; + json[r'number_prop'] = numberProp; } else { - _json[r'number_prop'] = null; + json[r'number_prop'] = null; } if (booleanProp != null) { - _json[r'boolean_prop'] = booleanProp; + json[r'boolean_prop'] = booleanProp; } else { - _json[r'boolean_prop'] = null; + json[r'boolean_prop'] = null; } if (stringProp != null) { - _json[r'string_prop'] = stringProp; + json[r'string_prop'] = stringProp; } else { - _json[r'string_prop'] = null; + json[r'string_prop'] = null; } if (dateProp != null) { - _json[r'date_prop'] = _dateFormatter.format(dateProp!.toUtc()); + json[r'date_prop'] = _dateFormatter.format(dateProp!.toUtc()); } else { - _json[r'date_prop'] = null; + json[r'date_prop'] = null; } if (datetimeProp != null) { - _json[r'datetime_prop'] = datetimeProp!.toUtc().toIso8601String(); + json[r'datetime_prop'] = datetimeProp!.toUtc().toIso8601String(); } else { - _json[r'datetime_prop'] = null; + json[r'datetime_prop'] = null; } if (arrayNullableProp != null) { - _json[r'array_nullable_prop'] = arrayNullableProp; + json[r'array_nullable_prop'] = arrayNullableProp; } else { - _json[r'array_nullable_prop'] = null; + json[r'array_nullable_prop'] = null; } if (arrayAndItemsNullableProp != null) { - _json[r'array_and_items_nullable_prop'] = arrayAndItemsNullableProp; + json[r'array_and_items_nullable_prop'] = arrayAndItemsNullableProp; } else { - _json[r'array_and_items_nullable_prop'] = null; + json[r'array_and_items_nullable_prop'] = null; } - _json[r'array_items_nullable'] = arrayItemsNullable; + json[r'array_items_nullable'] = arrayItemsNullable; if (objectNullableProp != null) { - _json[r'object_nullable_prop'] = objectNullableProp; + json[r'object_nullable_prop'] = objectNullableProp; } else { - _json[r'object_nullable_prop'] = null; + json[r'object_nullable_prop'] = null; } if (objectAndItemsNullableProp != null) { - _json[r'object_and_items_nullable_prop'] = objectAndItemsNullableProp; + json[r'object_and_items_nullable_prop'] = objectAndItemsNullableProp; } else { - _json[r'object_and_items_nullable_prop'] = null; + json[r'object_and_items_nullable_prop'] = null; } - _json[r'object_items_nullable'] = objectItemsNullable; - return _json; + json[r'object_items_nullable'] = objectItemsNullable; + return json; } /// Returns a new [NullableClass] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/number_only.dart index 3fce2c78507f..edd811f85ce4 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/number_only.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/number_only.dart @@ -37,13 +37,13 @@ class NumberOnly { String toString() => 'NumberOnly[justNumber=$justNumber]'; Map toJson() { - final _json = {}; + final json = {}; if (justNumber != null) { - _json[r'JustNumber'] = justNumber; + json[r'JustNumber'] = justNumber; } else { - _json[r'JustNumber'] = null; + json[r'JustNumber'] = null; } - return _json; + return json; } /// Returns a new [NumberOnly] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/object_with_deprecated_fields.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/object_with_deprecated_fields.dart index 6c67afbbdd2b..051095df2f3a 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/object_with_deprecated_fields.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/object_with_deprecated_fields.dart @@ -64,24 +64,24 @@ class ObjectWithDeprecatedFields { String toString() => 'ObjectWithDeprecatedFields[uuid=$uuid, id=$id, deprecatedRef=$deprecatedRef, bars=$bars]'; Map toJson() { - final _json = {}; + final json = {}; if (uuid != null) { - _json[r'uuid'] = uuid; + json[r'uuid'] = uuid; } else { - _json[r'uuid'] = null; + json[r'uuid'] = null; } if (id != null) { - _json[r'id'] = id; + json[r'id'] = id; } else { - _json[r'id'] = null; + json[r'id'] = null; } if (deprecatedRef != null) { - _json[r'deprecatedRef'] = deprecatedRef; + json[r'deprecatedRef'] = deprecatedRef; } else { - _json[r'deprecatedRef'] = null; + json[r'deprecatedRef'] = null; } - _json[r'bars'] = bars; - return _json; + json[r'bars'] = bars; + return json; } /// Returns a new [ObjectWithDeprecatedFields] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart index 27db5fd31821..a353e15298c0 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart @@ -81,34 +81,34 @@ class Order { String toString() => 'Order[id=$id, petId=$petId, quantity=$quantity, shipDate=$shipDate, status=$status, complete=$complete]'; Map toJson() { - final _json = {}; + final json = {}; if (id != null) { - _json[r'id'] = id; + json[r'id'] = id; } else { - _json[r'id'] = null; + json[r'id'] = null; } if (petId != null) { - _json[r'petId'] = petId; + json[r'petId'] = petId; } else { - _json[r'petId'] = null; + json[r'petId'] = null; } if (quantity != null) { - _json[r'quantity'] = quantity; + json[r'quantity'] = quantity; } else { - _json[r'quantity'] = null; + json[r'quantity'] = null; } if (shipDate != null) { - _json[r'shipDate'] = shipDate!.toUtc().toIso8601String(); + json[r'shipDate'] = shipDate!.toUtc().toIso8601String(); } else { - _json[r'shipDate'] = null; + json[r'shipDate'] = null; } if (status != null) { - _json[r'status'] = status; + json[r'status'] = status; } else { - _json[r'status'] = null; + json[r'status'] = null; } - _json[r'complete'] = complete; - return _json; + json[r'complete'] = complete; + return json; } /// Returns a new [Order] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_composite.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_composite.dart index f31cf4b0a3b5..8f7a625d4410 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_composite.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_composite.dart @@ -59,23 +59,23 @@ class OuterComposite { String toString() => 'OuterComposite[myNumber=$myNumber, myString=$myString, myBoolean=$myBoolean]'; Map toJson() { - final _json = {}; + final json = {}; if (myNumber != null) { - _json[r'my_number'] = myNumber; + json[r'my_number'] = myNumber; } else { - _json[r'my_number'] = null; + json[r'my_number'] = null; } if (myString != null) { - _json[r'my_string'] = myString; + json[r'my_string'] = myString; } else { - _json[r'my_string'] = null; + json[r'my_string'] = null; } if (myBoolean != null) { - _json[r'my_boolean'] = myBoolean; + json[r'my_boolean'] = myBoolean; } else { - _json[r'my_boolean'] = null; + json[r'my_boolean'] = null; } - return _json; + return json; } /// Returns a new [OuterComposite] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_object_with_enum_property.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_object_with_enum_property.dart index bb346014c77b..8b9b76380e6d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_object_with_enum_property.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_object_with_enum_property.dart @@ -31,9 +31,9 @@ class OuterObjectWithEnumProperty { String toString() => 'OuterObjectWithEnumProperty[value=$value]'; Map toJson() { - final _json = {}; - _json[r'value'] = value; - return _json; + final json = {}; + json[r'value'] = value; + return json; } /// Returns a new [OuterObjectWithEnumProperty] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart index 5944a349b9ba..8b3a32dbd948 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart @@ -69,26 +69,26 @@ class Pet { String toString() => 'Pet[id=$id, category=$category, name=$name, photoUrls=$photoUrls, tags=$tags, status=$status]'; Map toJson() { - final _json = {}; + final json = {}; if (id != null) { - _json[r'id'] = id; + json[r'id'] = id; } else { - _json[r'id'] = null; + json[r'id'] = null; } if (category != null) { - _json[r'category'] = category; + json[r'category'] = category; } else { - _json[r'category'] = null; + json[r'category'] = null; } - _json[r'name'] = name; - _json[r'photoUrls'] = photoUrls; - _json[r'tags'] = tags; + json[r'name'] = name; + json[r'photoUrls'] = photoUrls; + json[r'tags'] = tags; if (status != null) { - _json[r'status'] = status; + json[r'status'] = status; } else { - _json[r'status'] = null; + json[r'status'] = null; } - return _json; + return json; } /// Returns a new [Pet] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/read_only_first.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/read_only_first.dart index 4701b8c575df..5ea12ed6f8db 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/read_only_first.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/read_only_first.dart @@ -48,18 +48,18 @@ class ReadOnlyFirst { String toString() => 'ReadOnlyFirst[bar=$bar, baz=$baz]'; Map toJson() { - final _json = {}; + final json = {}; if (bar != null) { - _json[r'bar'] = bar; + json[r'bar'] = bar; } else { - _json[r'bar'] = null; + json[r'bar'] = null; } if (baz != null) { - _json[r'baz'] = baz; + json[r'baz'] = baz; } else { - _json[r'baz'] = null; + json[r'baz'] = null; } - return _json; + return json; } /// Returns a new [ReadOnlyFirst] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/special_model_name.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/special_model_name.dart index 869667d12547..d334d2c4fb5a 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/special_model_name.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/special_model_name.dart @@ -37,13 +37,13 @@ class SpecialModelName { String toString() => 'SpecialModelName[dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket=$dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket]'; Map toJson() { - final _json = {}; + final json = {}; if (dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket != null) { - _json[r'$special[property.name]'] = dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; + json[r'$special[property.name]'] = dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; } else { - _json[r'$special[property.name]'] = null; + json[r'$special[property.name]'] = null; } - return _json; + return json; } /// Returns a new [SpecialModelName] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/tag.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/tag.dart index 18e86440a168..e718c6690269 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/tag.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/tag.dart @@ -48,18 +48,18 @@ class Tag { String toString() => 'Tag[id=$id, name=$name]'; Map toJson() { - final _json = {}; + final json = {}; if (id != null) { - _json[r'id'] = id; + json[r'id'] = id; } else { - _json[r'id'] = null; + json[r'id'] = null; } if (name != null) { - _json[r'name'] = name; + json[r'name'] = name; } else { - _json[r'name'] = null; + json[r'name'] = null; } - return _json; + return json; } /// Returns a new [Tag] instance and imports its values from diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/user.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/user.dart index 4d3d14508cda..7a14b4426780 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/user.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/user.dart @@ -115,48 +115,48 @@ class User { String toString() => 'User[id=$id, username=$username, firstName=$firstName, lastName=$lastName, email=$email, password=$password, phone=$phone, userStatus=$userStatus]'; Map toJson() { - final _json = {}; + final json = {}; if (id != null) { - _json[r'id'] = id; + json[r'id'] = id; } else { - _json[r'id'] = null; + json[r'id'] = null; } if (username != null) { - _json[r'username'] = username; + json[r'username'] = username; } else { - _json[r'username'] = null; + json[r'username'] = null; } if (firstName != null) { - _json[r'firstName'] = firstName; + json[r'firstName'] = firstName; } else { - _json[r'firstName'] = null; + json[r'firstName'] = null; } if (lastName != null) { - _json[r'lastName'] = lastName; + json[r'lastName'] = lastName; } else { - _json[r'lastName'] = null; + json[r'lastName'] = null; } if (email != null) { - _json[r'email'] = email; + json[r'email'] = email; } else { - _json[r'email'] = null; + json[r'email'] = null; } if (password != null) { - _json[r'password'] = password; + json[r'password'] = password; } else { - _json[r'password'] = null; + json[r'password'] = null; } if (phone != null) { - _json[r'phone'] = phone; + json[r'phone'] = phone; } else { - _json[r'phone'] = null; + json[r'phone'] = null; } if (userStatus != null) { - _json[r'userStatus'] = userStatus; + json[r'userStatus'] = userStatus; } else { - _json[r'userStatus'] = null; + json[r'userStatus'] = null; } - return _json; + return json; } /// Returns a new [User] instance and imports its values from From de50d9032400028c43e1b9df40a1e08e442e58c6 Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Sat, 6 Aug 2022 23:37:54 +0200 Subject: [PATCH 05/11] Allow authentication implementations to apply header and query parameters asynchronously. --- .../src/main/resources/dart2/api_client.mustache | 13 ++----------- .../main/resources/dart2/auth/api_key_auth.mustache | 4 ++-- .../resources/dart2/auth/authentication.mustache | 2 +- .../resources/dart2/auth/http_basic_auth.mustache | 4 ++-- .../resources/dart2/auth/http_bearer_auth.mustache | 4 ++-- .../src/main/resources/dart2/auth/oauth.mustache | 4 ++-- 6 files changed, 11 insertions(+), 20 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache index e1828e800d8d..faea294f8340 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache @@ -24,7 +24,7 @@ class ApiClient { _defaultHeaderMap[key] = value; } - Map get defaultHeaderMap => _defaultHeaderMap; + Map get defaultHeaderMap => _defaultHeaderMap; // We don't use a Map for queryParams. // If collectionFormat is 'multi', a key might appear multiple times. @@ -38,7 +38,7 @@ class ApiClient { String? contentType, List authNames, ) async { - _updateParamsForAuth(authNames, queryParams, headerParams); + await authentication?.applyToParams(authNames, queryParams, headerParams); headerParams.addAll(_defaultHeaderMap); if (contentType != null) { @@ -158,15 +158,6 @@ class ApiClient { @Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use serializeAsync() instead.') String serialize(Object? value) => value == null ? '' : json.encode(value); - /// Update query and header parameters based on authentication settings. - void _updateParamsForAuth( - List authNames, - List queryParams, - Map headerParams, - ) { - authentication?.applyToParams(authNames, queryParams, headerParams); - } - {{#native_serialization}} static dynamic _deserialize(dynamic value, String targetType, {bool growable = false}) { try { diff --git a/modules/openapi-generator/src/main/resources/dart2/auth/api_key_auth.mustache b/modules/openapi-generator/src/main/resources/dart2/auth/api_key_auth.mustache index 138a6d08742d..95ffc22fd732 100644 --- a/modules/openapi-generator/src/main/resources/dart2/auth/api_key_auth.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/auth/api_key_auth.mustache @@ -10,11 +10,11 @@ class ApiKeyAuth implements Authentication { String apiKey = ''; @override - void applyToParams( + Future applyToParams( List authNames, List queryParams, Map headerParams, - ) { + ) async { final paramValue = apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey'; if (paramValue.isNotEmpty) { diff --git a/modules/openapi-generator/src/main/resources/dart2/auth/authentication.mustache b/modules/openapi-generator/src/main/resources/dart2/auth/authentication.mustache index 7d4e1c350219..da39c6a7cc2d 100644 --- a/modules/openapi-generator/src/main/resources/dart2/auth/authentication.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/auth/authentication.mustache @@ -3,7 +3,7 @@ // ignore: one_member_abstracts abstract class Authentication { /// Apply authentication settings to header and query params. - void applyToParams( + Future applyToParams( List authNames, List queryParams, Map headerParams, diff --git a/modules/openapi-generator/src/main/resources/dart2/auth/http_basic_auth.mustache b/modules/openapi-generator/src/main/resources/dart2/auth/http_basic_auth.mustache index 8ba6613cfd11..44ab21e712ac 100644 --- a/modules/openapi-generator/src/main/resources/dart2/auth/http_basic_auth.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/auth/http_basic_auth.mustache @@ -7,11 +7,11 @@ class HttpBasicAuth implements Authentication { String password; @override - void applyToParams( + Future applyToParams( List authNames, List queryParams, Map headerParams, - ) { + ) async { if (username.isNotEmpty && password.isNotEmpty) { final credentials = '$username:$password'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; diff --git a/modules/openapi-generator/src/main/resources/dart2/auth/http_bearer_auth.mustache b/modules/openapi-generator/src/main/resources/dart2/auth/http_bearer_auth.mustache index 380867cccc4c..603eb92fe26a 100644 --- a/modules/openapi-generator/src/main/resources/dart2/auth/http_bearer_auth.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/auth/http_bearer_auth.mustache @@ -17,11 +17,11 @@ class HttpBearerAuth implements Authentication { } @override - void applyToParams( + Future applyToParams( List authNames, List queryParams, Map headerParams, - ) { + ) async { if (_accessToken == null) { return; } diff --git a/modules/openapi-generator/src/main/resources/dart2/auth/oauth.mustache b/modules/openapi-generator/src/main/resources/dart2/auth/oauth.mustache index cd2f487409c2..70eb1c1a9141 100644 --- a/modules/openapi-generator/src/main/resources/dart2/auth/oauth.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/auth/oauth.mustache @@ -6,11 +6,11 @@ class OAuth implements Authentication { String accessToken; @override - void applyToParams( + Future applyToParams( List authNames, List queryParams, Map headerParams, - ) { + ) async { if (accessToken.isNotEmpty) { headerParams['Authorization'] = 'Bearer $accessToken'; } From 4ba0c2b763b704f0d2544d98554d6c8d58bbef85 Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Sat, 6 Aug 2022 23:50:50 +0200 Subject: [PATCH 06/11] Allow inherited implementations to define a type for authentication class. --- .../src/main/resources/dart2/api_client.mustache | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache index faea294f8340..81b255cfe212 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache @@ -1,11 +1,13 @@ {{>header}} {{>part_of}} -class ApiClient { +class ApiClient { ApiClient({this.basePath = '{{{basePath}}}', this.authentication,}); final String basePath; + final T? authentication; var _client = Client(); + final _defaultHeaderMap = {}; /// Returns the current HTTP [Client] instance to use in this class. /// @@ -17,15 +19,12 @@ class ApiClient { _client = newClient; } - final _defaultHeaderMap = {}; - final Authentication? authentication; + Map get defaultHeaderMap => _defaultHeaderMap; void addDefaultHeader(String key, String value) { _defaultHeaderMap[key] = value; } - Map get defaultHeaderMap => _defaultHeaderMap; - // We don't use a Map for queryParams. // If collectionFormat is 'multi', a key might appear multiple times. Future invokeAPI( From 7e20d08f59ee1ee360ca168430374eaaf83f4e06 Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Sat, 6 Aug 2022 23:59:18 +0200 Subject: [PATCH 07/11] Generate Petstore sources. --- .../petstore_client_lib/lib/api_client.dart | 20 +++++-------------- .../lib/auth/api_key_auth.dart | 4 ++-- .../lib/auth/authentication.dart | 2 +- .../lib/auth/http_basic_auth.dart | 4 ++-- .../lib/auth/http_bearer_auth.dart | 4 ++-- .../petstore_client_lib/lib/auth/oauth.dart | 4 ++-- .../lib/api_client.dart | 20 +++++-------------- .../lib/auth/api_key_auth.dart | 4 ++-- .../lib/auth/authentication.dart | 2 +- .../lib/auth/http_basic_auth.dart | 4 ++-- .../lib/auth/http_bearer_auth.dart | 4 ++-- .../lib/auth/oauth.dart | 4 ++-- 12 files changed, 28 insertions(+), 48 deletions(-) diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart index cc93bf3d40f0..89dfd40b7052 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart @@ -10,12 +10,14 @@ part of openapi.api; -class ApiClient { +class ApiClient { ApiClient({this.basePath = 'http://petstore.swagger.io/v2', this.authentication,}); final String basePath; + final T? authentication; var _client = Client(); + final _defaultHeaderMap = {}; /// Returns the current HTTP [Client] instance to use in this class. /// @@ -27,15 +29,12 @@ class ApiClient { _client = newClient; } - final _defaultHeaderMap = {}; - final Authentication? authentication; + Map get defaultHeaderMap => _defaultHeaderMap; void addDefaultHeader(String key, String value) { _defaultHeaderMap[key] = value; } - Map get defaultHeaderMap => _defaultHeaderMap; - // We don't use a Map for queryParams. // If collectionFormat is 'multi', a key might appear multiple times. Future invokeAPI( @@ -48,7 +47,7 @@ class ApiClient { String? contentType, List authNames, ) async { - _updateParamsForAuth(authNames, queryParams, headerParams); + await authentication?.applyToParams(authNames, queryParams, headerParams); headerParams.addAll(_defaultHeaderMap); if (contentType != null) { @@ -166,15 +165,6 @@ class ApiClient { @Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use serializeAsync() instead.') String serialize(Object? value) => value == null ? '' : json.encode(value); - /// Update query and header parameters based on authentication settings. - void _updateParamsForAuth( - List authNames, - List queryParams, - Map headerParams, - ) { - authentication?.applyToParams(authNames, queryParams, headerParams); - } - static dynamic _deserialize(dynamic value, String targetType, {bool growable = false}) { try { switch (targetType) { diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart index c3729546eca6..3e2bb7d37ceb 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart @@ -20,11 +20,11 @@ class ApiKeyAuth implements Authentication { String apiKey = ''; @override - void applyToParams( + Future applyToParams( List authNames, List queryParams, Map headerParams, - ) { + ) async { final paramValue = apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey'; if (paramValue.isNotEmpty) { diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart index d1de54235e51..a030b0bb3740 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart @@ -13,7 +13,7 @@ part of openapi.api; // ignore: one_member_abstracts abstract class Authentication { /// Apply authentication settings to header and query params. - void applyToParams( + Future applyToParams( List authNames, List queryParams, Map headerParams, diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart index 5c5d2069d533..bae7cde828e6 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart @@ -17,11 +17,11 @@ class HttpBasicAuth implements Authentication { String password; @override - void applyToParams( + Future applyToParams( List authNames, List queryParams, Map headerParams, - ) { + ) async { if (username.isNotEmpty && password.isNotEmpty) { final credentials = '$username:$password'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart index c7e9fd1fea89..f3059ea98cf5 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart @@ -27,11 +27,11 @@ class HttpBearerAuth implements Authentication { } @override - void applyToParams( + Future applyToParams( List authNames, List queryParams, Map headerParams, - ) { + ) async { if (_accessToken == null) { return; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart index e90331d79c9c..4158650429c8 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart @@ -16,11 +16,11 @@ class OAuth implements Authentication { String accessToken; @override - void applyToParams( + Future applyToParams( List authNames, List queryParams, Map headerParams, - ) { + ) async { if (accessToken.isNotEmpty) { headerParams['Authorization'] = 'Bearer $accessToken'; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart index ce14a4b9c1d5..4964e20dd703 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart @@ -10,12 +10,14 @@ part of openapi.api; -class ApiClient { +class ApiClient { ApiClient({this.basePath = 'http://petstore.swagger.io:80/v2', this.authentication,}); final String basePath; + final T? authentication; var _client = Client(); + final _defaultHeaderMap = {}; /// Returns the current HTTP [Client] instance to use in this class. /// @@ -27,15 +29,12 @@ class ApiClient { _client = newClient; } - final _defaultHeaderMap = {}; - final Authentication? authentication; + Map get defaultHeaderMap => _defaultHeaderMap; void addDefaultHeader(String key, String value) { _defaultHeaderMap[key] = value; } - Map get defaultHeaderMap => _defaultHeaderMap; - // We don't use a Map for queryParams. // If collectionFormat is 'multi', a key might appear multiple times. Future invokeAPI( @@ -48,7 +47,7 @@ class ApiClient { String? contentType, List authNames, ) async { - _updateParamsForAuth(authNames, queryParams, headerParams); + await authentication?.applyToParams(authNames, queryParams, headerParams); headerParams.addAll(_defaultHeaderMap); if (contentType != null) { @@ -166,15 +165,6 @@ class ApiClient { @Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use serializeAsync() instead.') String serialize(Object? value) => value == null ? '' : json.encode(value); - /// Update query and header parameters based on authentication settings. - void _updateParamsForAuth( - List authNames, - List queryParams, - Map headerParams, - ) { - authentication?.applyToParams(authNames, queryParams, headerParams); - } - static dynamic _deserialize(dynamic value, String targetType, {bool growable = false}) { try { switch (targetType) { diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/api_key_auth.dart index c3729546eca6..3e2bb7d37ceb 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/api_key_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/api_key_auth.dart @@ -20,11 +20,11 @@ class ApiKeyAuth implements Authentication { String apiKey = ''; @override - void applyToParams( + Future applyToParams( List authNames, List queryParams, Map headerParams, - ) { + ) async { final paramValue = apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey'; if (paramValue.isNotEmpty) { diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/authentication.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/authentication.dart index d1de54235e51..a030b0bb3740 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/authentication.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/authentication.dart @@ -13,7 +13,7 @@ part of openapi.api; // ignore: one_member_abstracts abstract class Authentication { /// Apply authentication settings to header and query params. - void applyToParams( + Future applyToParams( List authNames, List queryParams, Map headerParams, diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_basic_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_basic_auth.dart index 5c5d2069d533..bae7cde828e6 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_basic_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_basic_auth.dart @@ -17,11 +17,11 @@ class HttpBasicAuth implements Authentication { String password; @override - void applyToParams( + Future applyToParams( List authNames, List queryParams, Map headerParams, - ) { + ) async { if (username.isNotEmpty && password.isNotEmpty) { final credentials = '$username:$password'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_bearer_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_bearer_auth.dart index c7e9fd1fea89..f3059ea98cf5 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_bearer_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_bearer_auth.dart @@ -27,11 +27,11 @@ class HttpBearerAuth implements Authentication { } @override - void applyToParams( + Future applyToParams( List authNames, List queryParams, Map headerParams, - ) { + ) async { if (_accessToken == null) { return; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/oauth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/oauth.dart index e90331d79c9c..4158650429c8 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/oauth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/oauth.dart @@ -16,11 +16,11 @@ class OAuth implements Authentication { String accessToken; @override - void applyToParams( + Future applyToParams( List authNames, List queryParams, Map headerParams, - ) { + ) async { if (accessToken.isNotEmpty) { headerParams['Authorization'] = 'Bearer $accessToken'; } From e9611adc81562fb1afab9b7f874a88ac456e8c25 Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Sun, 7 Aug 2022 16:51:59 +0200 Subject: [PATCH 08/11] Remove `authNames` from API client and authentication classes. --- .../openapi-generator/src/main/resources/dart2/api.mustache | 2 -- .../src/main/resources/dart2/api_client.mustache | 3 +-- .../src/main/resources/dart2/auth/api_key_auth.mustache | 6 +----- .../src/main/resources/dart2/auth/authentication.mustache | 6 +----- .../src/main/resources/dart2/auth/http_basic_auth.mustache | 6 +----- .../src/main/resources/dart2/auth/http_bearer_auth.mustache | 6 +----- .../src/main/resources/dart2/auth/oauth.mustache | 6 +----- 7 files changed, 6 insertions(+), 29 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/dart2/api.mustache b/modules/openapi-generator/src/main/resources/dart2/api.mustache index 2ce04e81f0eb..e40ebac39408 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api.mustache @@ -86,7 +86,6 @@ class {{{classname}}} { {{/headerParams}} {{/hasHeaderParams}} - const authNames = [{{#authMethods}}'{{{name}}}'{{^-last}}, {{/-last}}{{/authMethods}}]; const contentTypes = [{{#prioritizedContentTypes}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/prioritizedContentTypes}}]; {{#isMultipart}} @@ -129,7 +128,6 @@ class {{{classname}}} { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } diff --git a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache index 81b255cfe212..ff1ba61a4754 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache @@ -35,9 +35,8 @@ class ApiClient { Map headerParams, Map formParams, String? contentType, - List authNames, ) async { - await authentication?.applyToParams(authNames, queryParams, headerParams); + await authentication?.applyToParams(queryParams, headerParams); headerParams.addAll(_defaultHeaderMap); if (contentType != null) { diff --git a/modules/openapi-generator/src/main/resources/dart2/auth/api_key_auth.mustache b/modules/openapi-generator/src/main/resources/dart2/auth/api_key_auth.mustache index 95ffc22fd732..4b8f707eeb5f 100644 --- a/modules/openapi-generator/src/main/resources/dart2/auth/api_key_auth.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/auth/api_key_auth.mustache @@ -10,11 +10,7 @@ class ApiKeyAuth implements Authentication { String apiKey = ''; @override - Future applyToParams( - List authNames, - List queryParams, - Map headerParams, - ) async { + Future applyToParams(List queryParams, Map headerParams,) async { final paramValue = apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey'; if (paramValue.isNotEmpty) { diff --git a/modules/openapi-generator/src/main/resources/dart2/auth/authentication.mustache b/modules/openapi-generator/src/main/resources/dart2/auth/authentication.mustache index da39c6a7cc2d..6eff61ede0ec 100644 --- a/modules/openapi-generator/src/main/resources/dart2/auth/authentication.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/auth/authentication.mustache @@ -3,9 +3,5 @@ // ignore: one_member_abstracts abstract class Authentication { /// Apply authentication settings to header and query params. - Future applyToParams( - List authNames, - List queryParams, - Map headerParams, - ); + Future applyToParams(List queryParams, Map headerParams); } diff --git a/modules/openapi-generator/src/main/resources/dart2/auth/http_basic_auth.mustache b/modules/openapi-generator/src/main/resources/dart2/auth/http_basic_auth.mustache index 44ab21e712ac..c83d037c7991 100644 --- a/modules/openapi-generator/src/main/resources/dart2/auth/http_basic_auth.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/auth/http_basic_auth.mustache @@ -7,11 +7,7 @@ class HttpBasicAuth implements Authentication { String password; @override - Future applyToParams( - List authNames, - List queryParams, - Map headerParams, - ) async { + Future applyToParams(List queryParams, Map headerParams,) async { if (username.isNotEmpty && password.isNotEmpty) { final credentials = '$username:$password'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; diff --git a/modules/openapi-generator/src/main/resources/dart2/auth/http_bearer_auth.mustache b/modules/openapi-generator/src/main/resources/dart2/auth/http_bearer_auth.mustache index 603eb92fe26a..6c1d3c0e843d 100644 --- a/modules/openapi-generator/src/main/resources/dart2/auth/http_bearer_auth.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/auth/http_bearer_auth.mustache @@ -17,11 +17,7 @@ class HttpBearerAuth implements Authentication { } @override - Future applyToParams( - List authNames, - List queryParams, - Map headerParams, - ) async { + Future applyToParams(List queryParams, Map headerParams,) async { if (_accessToken == null) { return; } diff --git a/modules/openapi-generator/src/main/resources/dart2/auth/oauth.mustache b/modules/openapi-generator/src/main/resources/dart2/auth/oauth.mustache index 70eb1c1a9141..0e65baa4c637 100644 --- a/modules/openapi-generator/src/main/resources/dart2/auth/oauth.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/auth/oauth.mustache @@ -6,11 +6,7 @@ class OAuth implements Authentication { String accessToken; @override - Future applyToParams( - List authNames, - List queryParams, - Map headerParams, - ) async { + Future applyToParams(List queryParams, Map headerParams,) async { if (accessToken.isNotEmpty) { headerParams['Authorization'] = 'Bearer $accessToken'; } From dd7fe23b9051c8a8f0c8ac27de3c4b8055338d15 Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Sun, 7 Aug 2022 16:52:33 +0200 Subject: [PATCH 09/11] Reference properties with `this.` in case one of them has the same name as a local variable. --- .../serialization/native/native_class.mustache | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_class.mustache b/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_class.mustache index 2d55a19810c4..dd656c53e709 100644 --- a/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_class.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_class.mustache @@ -55,38 +55,38 @@ class {{{classname}}} { final json = {}; {{#vars}} {{#isNullable}} - if ({{{name}}} != null) { + if (this.{{{name}}} != null) { {{/isNullable}} {{^isNullable}} {{^required}} {{^defaultValue}} - if ({{{name}}} != null) { + if (this.{{{name}}} != null) { {{/defaultValue}} {{/required}} {{/isNullable}} {{#isDateTime}} {{#pattern}} json[r'{{{baseName}}}'] = _dateEpochMarker == '{{{pattern}}}' - ? {{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.millisecondsSinceEpoch - : {{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc().toIso8601String(); + ? this.{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.millisecondsSinceEpoch + : this.{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc().toIso8601String(); {{/pattern}} {{^pattern}} - json[r'{{{baseName}}}'] = {{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc().toIso8601String(); + json[r'{{{baseName}}}'] = this.{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc().toIso8601String(); {{/pattern}} {{/isDateTime}} {{#isDate}} {{#pattern}} json[r'{{{baseName}}}'] = _dateEpochMarker == '{{{pattern}}}' - ? {{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.millisecondsSinceEpoch - : _dateFormatter.format({{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc()); + ? this.{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.millisecondsSinceEpoch + : _dateFormatter.format(this.{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc()); {{/pattern}} {{^pattern}} - json[r'{{{baseName}}}'] = _dateFormatter.format({{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc()); + json[r'{{{baseName}}}'] = _dateFormatter.format(this.{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc()); {{/pattern}} {{/isDate}} {{^isDateTime}} {{^isDate}} - json[r'{{{baseName}}}'] = {{{name}}}; + json[r'{{{baseName}}}'] = this.{{{name}}}; {{/isDate}} {{/isDateTime}} {{#isNullable}} From ac17cb5ed034b0b97c80ed49dd4c29234fb6d630 Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Sun, 7 Aug 2022 16:52:58 +0200 Subject: [PATCH 10/11] Regenerate Petstore source code. --- .../petstore_client_lib/lib/api/pet_api.dart | 16 ------ .../lib/api/store_api.dart | 8 --- .../petstore_client_lib/lib/api/user_api.dart | 16 ------ .../petstore_client_lib/lib/api_client.dart | 3 +- .../lib/auth/api_key_auth.dart | 6 +- .../lib/auth/authentication.dart | 6 +- .../lib/auth/http_basic_auth.dart | 6 +- .../lib/auth/http_bearer_auth.dart | 6 +- .../petstore_client_lib/lib/auth/oauth.dart | 6 +- .../lib/model/api_response.dart | 12 ++-- .../lib/model/category.dart | 8 +-- .../petstore_client_lib/lib/model/order.dart | 22 ++++---- .../petstore_client_lib/lib/model/pet.dart | 18 +++--- .../petstore_client_lib/lib/model/tag.dart | 8 +-- .../petstore_client_lib/lib/model/user.dart | 32 +++++------ .../lib/api/another_fake_api.dart | 2 - .../lib/api/default_api.dart | 2 - .../lib/api/fake_api.dart | 34 ----------- .../lib/api/fake_classname_tags123_api.dart | 2 - .../lib/api/pet_api.dart | 18 ------ .../lib/api/store_api.dart | 8 --- .../lib/api/user_api.dart | 16 ------ .../lib/api_client.dart | 3 +- .../lib/auth/api_key_auth.dart | 6 +- .../lib/auth/authentication.dart | 6 +- .../lib/auth/http_basic_auth.dart | 6 +- .../lib/auth/http_bearer_auth.dart | 6 +- .../lib/auth/oauth.dart | 6 +- .../model/additional_properties_class.dart | 4 +- .../lib/model/all_of_with_single_ref.dart | 8 +-- .../lib/model/animal.dart | 4 +- .../lib/model/api_response.dart | 12 ++-- .../model/array_of_array_of_number_only.dart | 2 +- .../lib/model/array_of_number_only.dart | 2 +- .../lib/model/array_test.dart | 6 +- .../lib/model/capitalization.dart | 24 ++++---- .../lib/model/cat.dart | 8 +-- .../lib/model/cat_all_of.dart | 4 +- .../lib/model/category.dart | 6 +- .../lib/model/class_model.dart | 4 +- .../lib/model/deprecated_object.dart | 4 +- .../lib/model/dog.dart | 8 +-- .../lib/model/dog_all_of.dart | 4 +- .../lib/model/enum_arrays.dart | 6 +- .../lib/model/enum_test.dart | 30 +++++----- .../lib/model/file_schema_test_class.dart | 6 +- .../lib/model/foo.dart | 2 +- .../lib/model/foo_get_default_response.dart | 4 +- .../lib/model/format_test.dart | 56 +++++++++---------- .../lib/model/has_only_read_only.dart | 8 +-- .../lib/model/health_check_result.dart | 4 +- .../lib/model/map_test.dart | 8 +-- ...rties_and_additional_properties_class.dart | 10 ++-- .../lib/model/model200_response.dart | 8 +-- .../lib/model/model_client.dart | 4 +- .../lib/model/model_file.dart | 4 +- .../lib/model/model_list.dart | 4 +- .../lib/model/model_return.dart | 4 +- .../lib/model/name.dart | 14 ++--- .../lib/model/nullable_class.dart | 44 +++++++-------- .../lib/model/number_only.dart | 4 +- .../model/object_with_deprecated_fields.dart | 14 ++--- .../lib/model/order.dart | 22 ++++---- .../lib/model/outer_composite.dart | 12 ++-- .../outer_object_with_enum_property.dart | 2 +- .../lib/model/pet.dart | 18 +++--- .../lib/model/read_only_first.dart | 8 +-- .../lib/model/special_model_name.dart | 4 +- .../lib/model/tag.dart | 8 +-- .../lib/model/user.dart | 32 +++++------ 70 files changed, 282 insertions(+), 446 deletions(-) diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart index 22858e953afa..d0354de38dbb 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart @@ -37,7 +37,6 @@ class PetApi { final headerParams = {}; final formParams = {}; - const authNames = ['petstore_auth']; const contentTypes = ['application/json', 'application/xml']; @@ -49,7 +48,6 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -104,7 +102,6 @@ class PetApi { headerParams[r'api_key'] = parameterToString(apiKey); } - const authNames = ['petstore_auth']; const contentTypes = []; @@ -116,7 +113,6 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -160,7 +156,6 @@ class PetApi { queryParams.addAll(_queryParams('csv', 'status', status)); - const authNames = ['petstore_auth']; const contentTypes = []; @@ -172,7 +167,6 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -225,7 +219,6 @@ class PetApi { queryParams.addAll(_queryParams('csv', 'tags', tags)); - const authNames = ['petstore_auth']; const contentTypes = []; @@ -237,7 +230,6 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -289,7 +281,6 @@ class PetApi { final headerParams = {}; final formParams = {}; - const authNames = ['api_key']; const contentTypes = []; @@ -301,7 +292,6 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -349,7 +339,6 @@ class PetApi { final headerParams = {}; final formParams = {}; - const authNames = ['petstore_auth']; const contentTypes = ['application/json', 'application/xml']; @@ -361,7 +350,6 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -416,7 +404,6 @@ class PetApi { final headerParams = {}; final formParams = {}; - const authNames = ['petstore_auth']; const contentTypes = ['application/x-www-form-urlencoded']; if (name != null) { @@ -434,7 +421,6 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -487,7 +473,6 @@ class PetApi { final headerParams = {}; final formParams = {}; - const authNames = ['petstore_auth']; const contentTypes = ['multipart/form-data']; bool hasFields = false; @@ -513,7 +498,6 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart index 51b4b81fb0f5..db1ac1f010bf 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart @@ -38,7 +38,6 @@ class StoreApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = []; @@ -50,7 +49,6 @@ class StoreApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -85,7 +83,6 @@ class StoreApi { final headerParams = {}; final formParams = {}; - const authNames = ['api_key']; const contentTypes = []; @@ -97,7 +94,6 @@ class StoreApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -141,7 +137,6 @@ class StoreApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = []; @@ -153,7 +148,6 @@ class StoreApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -201,7 +195,6 @@ class StoreApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = ['application/json']; @@ -213,7 +206,6 @@ class StoreApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart index 46eef79d505a..a44252a6130b 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart @@ -37,7 +37,6 @@ class UserApi { final headerParams = {}; final formParams = {}; - const authNames = ['api_key']; const contentTypes = ['application/json']; @@ -49,7 +48,6 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -89,7 +87,6 @@ class UserApi { final headerParams = {}; final formParams = {}; - const authNames = ['api_key']; const contentTypes = ['application/json']; @@ -101,7 +98,6 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -141,7 +137,6 @@ class UserApi { final headerParams = {}; final formParams = {}; - const authNames = ['api_key']; const contentTypes = ['application/json']; @@ -153,7 +148,6 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -194,7 +188,6 @@ class UserApi { final headerParams = {}; final formParams = {}; - const authNames = ['api_key']; const contentTypes = []; @@ -206,7 +199,6 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -247,7 +239,6 @@ class UserApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = []; @@ -259,7 +250,6 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -313,7 +303,6 @@ class UserApi { queryParams.addAll(_queryParams('', 'username', username)); queryParams.addAll(_queryParams('', 'password', password)); - const authNames = []; const contentTypes = []; @@ -325,7 +314,6 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -371,7 +359,6 @@ class UserApi { final headerParams = {}; final formParams = {}; - const authNames = ['api_key']; const contentTypes = []; @@ -383,7 +370,6 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -422,7 +408,6 @@ class UserApi { final headerParams = {}; final formParams = {}; - const authNames = ['api_key']; const contentTypes = ['application/json']; @@ -434,7 +419,6 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart index 89dfd40b7052..1daa4bc260a4 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart @@ -45,9 +45,8 @@ class ApiClient { Map headerParams, Map formParams, String? contentType, - List authNames, ) async { - await authentication?.applyToParams(authNames, queryParams, headerParams); + await authentication?.applyToParams(queryParams, headerParams); headerParams.addAll(_defaultHeaderMap); if (contentType != null) { diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart index 3e2bb7d37ceb..84dc2955c22c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart @@ -20,11 +20,7 @@ class ApiKeyAuth implements Authentication { String apiKey = ''; @override - Future applyToParams( - List authNames, - List queryParams, - Map headerParams, - ) async { + Future applyToParams(List queryParams, Map headerParams,) async { final paramValue = apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey'; if (paramValue.isNotEmpty) { diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart index a030b0bb3740..1b1b8ae11e20 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart @@ -13,9 +13,5 @@ part of openapi.api; // ignore: one_member_abstracts abstract class Authentication { /// Apply authentication settings to header and query params. - Future applyToParams( - List authNames, - List queryParams, - Map headerParams, - ); + Future applyToParams(List queryParams, Map headerParams); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart index bae7cde828e6..dfedaa50d090 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart @@ -17,11 +17,7 @@ class HttpBasicAuth implements Authentication { String password; @override - Future applyToParams( - List authNames, - List queryParams, - Map headerParams, - ) async { + Future applyToParams(List queryParams, Map headerParams,) async { if (username.isNotEmpty && password.isNotEmpty) { final credentials = '$username:$password'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart index f3059ea98cf5..eddf3a59cbf3 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart @@ -27,11 +27,7 @@ class HttpBearerAuth implements Authentication { } @override - Future applyToParams( - List authNames, - List queryParams, - Map headerParams, - ) async { + Future applyToParams(List queryParams, Map headerParams,) async { if (_accessToken == null) { return; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart index 4158650429c8..e9e7d784c3b6 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart @@ -16,11 +16,7 @@ class OAuth implements Authentication { String accessToken; @override - Future applyToParams( - List authNames, - List queryParams, - Map headerParams, - ) async { + Future applyToParams(List queryParams, Map headerParams,) async { if (accessToken.isNotEmpty) { headerParams['Authorization'] = 'Bearer $accessToken'; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart index 38df202ce9b0..666778ab612d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart @@ -60,18 +60,18 @@ class ApiResponse { Map toJson() { final json = {}; - if (code != null) { - json[r'code'] = code; + if (this.code != null) { + json[r'code'] = this.code; } else { json[r'code'] = null; } - if (type != null) { - json[r'type'] = type; + if (this.type != null) { + json[r'type'] = this.type; } else { json[r'type'] = null; } - if (message != null) { - json[r'message'] = message; + if (this.message != null) { + json[r'message'] = this.message; } else { json[r'message'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/category.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/category.dart index 3f424dfb4eb9..06f01cc120ab 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/category.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/category.dart @@ -49,13 +49,13 @@ class Category { Map toJson() { final json = {}; - if (id != null) { - json[r'id'] = id; + if (this.id != null) { + json[r'id'] = this.id; } else { json[r'id'] = null; } - if (name != null) { - json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; } else { json[r'name'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart index a353e15298c0..456b26277819 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart @@ -82,32 +82,32 @@ class Order { Map toJson() { final json = {}; - if (id != null) { - json[r'id'] = id; + if (this.id != null) { + json[r'id'] = this.id; } else { json[r'id'] = null; } - if (petId != null) { - json[r'petId'] = petId; + if (this.petId != null) { + json[r'petId'] = this.petId; } else { json[r'petId'] = null; } - if (quantity != null) { - json[r'quantity'] = quantity; + if (this.quantity != null) { + json[r'quantity'] = this.quantity; } else { json[r'quantity'] = null; } - if (shipDate != null) { - json[r'shipDate'] = shipDate!.toUtc().toIso8601String(); + if (this.shipDate != null) { + json[r'shipDate'] = this.shipDate!.toUtc().toIso8601String(); } else { json[r'shipDate'] = null; } - if (status != null) { - json[r'status'] = status; + if (this.status != null) { + json[r'status'] = this.status; } else { json[r'status'] = null; } - json[r'complete'] = complete; + json[r'complete'] = this.complete; return json; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart index c97f8a710575..b458d5b20f11 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart @@ -70,21 +70,21 @@ class Pet { Map toJson() { final json = {}; - if (id != null) { - json[r'id'] = id; + if (this.id != null) { + json[r'id'] = this.id; } else { json[r'id'] = null; } - if (category != null) { - json[r'category'] = category; + if (this.category != null) { + json[r'category'] = this.category; } else { json[r'category'] = null; } - json[r'name'] = name; - json[r'photoUrls'] = photoUrls; - json[r'tags'] = tags; - if (status != null) { - json[r'status'] = status; + json[r'name'] = this.name; + json[r'photoUrls'] = this.photoUrls; + json[r'tags'] = this.tags; + if (this.status != null) { + json[r'status'] = this.status; } else { json[r'status'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart index e718c6690269..1fd6d01f16dc 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart @@ -49,13 +49,13 @@ class Tag { Map toJson() { final json = {}; - if (id != null) { - json[r'id'] = id; + if (this.id != null) { + json[r'id'] = this.id; } else { json[r'id'] = null; } - if (name != null) { - json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; } else { json[r'name'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/user.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/user.dart index 7a14b4426780..63fc8e528159 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/user.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/user.dart @@ -116,43 +116,43 @@ class User { Map toJson() { final json = {}; - if (id != null) { - json[r'id'] = id; + if (this.id != null) { + json[r'id'] = this.id; } else { json[r'id'] = null; } - if (username != null) { - json[r'username'] = username; + if (this.username != null) { + json[r'username'] = this.username; } else { json[r'username'] = null; } - if (firstName != null) { - json[r'firstName'] = firstName; + if (this.firstName != null) { + json[r'firstName'] = this.firstName; } else { json[r'firstName'] = null; } - if (lastName != null) { - json[r'lastName'] = lastName; + if (this.lastName != null) { + json[r'lastName'] = this.lastName; } else { json[r'lastName'] = null; } - if (email != null) { - json[r'email'] = email; + if (this.email != null) { + json[r'email'] = this.email; } else { json[r'email'] = null; } - if (password != null) { - json[r'password'] = password; + if (this.password != null) { + json[r'password'] = this.password; } else { json[r'password'] = null; } - if (phone != null) { - json[r'phone'] = phone; + if (this.phone != null) { + json[r'phone'] = this.phone; } else { json[r'phone'] = null; } - if (userStatus != null) { - json[r'userStatus'] = userStatus; + if (this.userStatus != null) { + json[r'userStatus'] = this.userStatus; } else { json[r'userStatus'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/another_fake_api.dart index f03350c4dfff..689eafbd8ed7 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/another_fake_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/another_fake_api.dart @@ -37,7 +37,6 @@ class AnotherFakeApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = ['application/json']; @@ -49,7 +48,6 @@ class AnotherFakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart index 6ac6f276ffe9..c62615343015 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart @@ -28,7 +28,6 @@ class DefaultApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = []; @@ -40,7 +39,6 @@ class DefaultApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart index d4bd12ec939b..6cfbfb4e6c93 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart @@ -30,7 +30,6 @@ class FakeApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = []; @@ -42,7 +41,6 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -95,7 +93,6 @@ class FakeApi { headerParams[r'header_1'] = parameterToString(header1); } - const authNames = ['http_signature_test']; const contentTypes = ['application/json', 'application/xml']; @@ -107,7 +104,6 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -149,7 +145,6 @@ class FakeApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = ['application/json']; @@ -161,7 +156,6 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -205,7 +199,6 @@ class FakeApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = ['application/json']; @@ -217,7 +210,6 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -261,7 +253,6 @@ class FakeApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = ['application/json']; @@ -273,7 +264,6 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -317,7 +307,6 @@ class FakeApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = ['application/json']; @@ -329,7 +318,6 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -373,7 +361,6 @@ class FakeApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = ['application/json']; @@ -385,7 +372,6 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -429,7 +415,6 @@ class FakeApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = ['image/png']; @@ -441,7 +426,6 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -476,7 +460,6 @@ class FakeApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = ['application/json']; @@ -488,7 +471,6 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -523,7 +505,6 @@ class FakeApi { queryParams.addAll(_queryParams('', 'query', query)); - const authNames = []; const contentTypes = ['application/json']; @@ -535,7 +516,6 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -572,7 +552,6 @@ class FakeApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = ['application/json']; @@ -584,7 +563,6 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -671,7 +649,6 @@ class FakeApi { final headerParams = {}; final formParams = {}; - const authNames = ['http_basic_test']; const contentTypes = ['application/x-www-form-urlencoded']; if (integer != null) { @@ -722,7 +699,6 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -847,7 +823,6 @@ class FakeApi { headerParams[r'enum_header_string'] = parameterToString(enumHeaderString); } - const authNames = []; const contentTypes = ['application/x-www-form-urlencoded']; if (enumFormStringArray != null) { @@ -865,7 +840,6 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -957,7 +931,6 @@ class FakeApi { headerParams[r'boolean_group'] = parameterToString(booleanGroup); } - const authNames = ['bearer_test']; const contentTypes = []; @@ -969,7 +942,6 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -1024,7 +996,6 @@ class FakeApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = ['application/json']; @@ -1036,7 +1007,6 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -1079,7 +1049,6 @@ class FakeApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = ['application/x-www-form-urlencoded']; if (param != null) { @@ -1097,7 +1066,6 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -1159,7 +1127,6 @@ class FakeApi { } queryParams.addAll(_queryParams('', 'allowEmpty', allowEmpty)); - const authNames = []; const contentTypes = []; @@ -1171,7 +1138,6 @@ class FakeApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart index 158c127195bf..2782357efb9b 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart @@ -37,7 +37,6 @@ class FakeClassnameTags123Api { final headerParams = {}; final formParams = {}; - const authNames = ['api_key_query']; const contentTypes = ['application/json']; @@ -49,7 +48,6 @@ class FakeClassnameTags123Api { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart index 74d8ab2b059d..371afa625cfc 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart @@ -37,7 +37,6 @@ class PetApi { final headerParams = {}; final formParams = {}; - const authNames = ['petstore_auth']; const contentTypes = ['application/json', 'application/xml']; @@ -49,7 +48,6 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -96,7 +94,6 @@ class PetApi { headerParams[r'api_key'] = parameterToString(apiKey); } - const authNames = ['petstore_auth']; const contentTypes = []; @@ -108,7 +105,6 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -152,7 +148,6 @@ class PetApi { queryParams.addAll(_queryParams('csv', 'status', status)); - const authNames = ['petstore_auth']; const contentTypes = []; @@ -164,7 +159,6 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -217,7 +211,6 @@ class PetApi { queryParams.addAll(_queryParams('csv', 'tags', tags)); - const authNames = ['petstore_auth']; const contentTypes = []; @@ -229,7 +222,6 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -281,7 +273,6 @@ class PetApi { final headerParams = {}; final formParams = {}; - const authNames = ['api_key']; const contentTypes = []; @@ -293,7 +284,6 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -341,7 +331,6 @@ class PetApi { final headerParams = {}; final formParams = {}; - const authNames = ['petstore_auth']; const contentTypes = ['application/json', 'application/xml']; @@ -353,7 +342,6 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -400,7 +388,6 @@ class PetApi { final headerParams = {}; final formParams = {}; - const authNames = ['petstore_auth']; const contentTypes = ['application/x-www-form-urlencoded']; if (name != null) { @@ -418,7 +405,6 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -471,7 +457,6 @@ class PetApi { final headerParams = {}; final formParams = {}; - const authNames = ['petstore_auth']; const contentTypes = ['multipart/form-data']; bool hasFields = false; @@ -497,7 +482,6 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -558,7 +542,6 @@ class PetApi { final headerParams = {}; final formParams = {}; - const authNames = ['petstore_auth']; const contentTypes = ['multipart/form-data']; bool hasFields = false; @@ -584,7 +567,6 @@ class PetApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/store_api.dart index ee1756bea39b..68c1c9fdccb9 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/store_api.dart @@ -38,7 +38,6 @@ class StoreApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = []; @@ -50,7 +49,6 @@ class StoreApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -85,7 +83,6 @@ class StoreApi { final headerParams = {}; final formParams = {}; - const authNames = ['api_key']; const contentTypes = []; @@ -97,7 +94,6 @@ class StoreApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -141,7 +137,6 @@ class StoreApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = []; @@ -153,7 +148,6 @@ class StoreApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -201,7 +195,6 @@ class StoreApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = ['application/json']; @@ -213,7 +206,6 @@ class StoreApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/user_api.dart index dec46b87bd84..a44252a6130b 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/user_api.dart @@ -37,7 +37,6 @@ class UserApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = ['application/json']; @@ -49,7 +48,6 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -89,7 +87,6 @@ class UserApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = ['application/json']; @@ -101,7 +98,6 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -141,7 +137,6 @@ class UserApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = ['application/json']; @@ -153,7 +148,6 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -194,7 +188,6 @@ class UserApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = []; @@ -206,7 +199,6 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -247,7 +239,6 @@ class UserApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = []; @@ -259,7 +250,6 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -313,7 +303,6 @@ class UserApi { queryParams.addAll(_queryParams('', 'username', username)); queryParams.addAll(_queryParams('', 'password', password)); - const authNames = []; const contentTypes = []; @@ -325,7 +314,6 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -371,7 +359,6 @@ class UserApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = []; @@ -383,7 +370,6 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } @@ -422,7 +408,6 @@ class UserApi { final headerParams = {}; final formParams = {}; - const authNames = []; const contentTypes = ['application/json']; @@ -434,7 +419,6 @@ class UserApi { headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, - authNames, ); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart index 4964e20dd703..536cdf44c5f0 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart @@ -45,9 +45,8 @@ class ApiClient { Map headerParams, Map formParams, String? contentType, - List authNames, ) async { - await authentication?.applyToParams(authNames, queryParams, headerParams); + await authentication?.applyToParams(queryParams, headerParams); headerParams.addAll(_defaultHeaderMap); if (contentType != null) { diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/api_key_auth.dart index 3e2bb7d37ceb..84dc2955c22c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/api_key_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/api_key_auth.dart @@ -20,11 +20,7 @@ class ApiKeyAuth implements Authentication { String apiKey = ''; @override - Future applyToParams( - List authNames, - List queryParams, - Map headerParams, - ) async { + Future applyToParams(List queryParams, Map headerParams,) async { final paramValue = apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey'; if (paramValue.isNotEmpty) { diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/authentication.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/authentication.dart index a030b0bb3740..1b1b8ae11e20 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/authentication.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/authentication.dart @@ -13,9 +13,5 @@ part of openapi.api; // ignore: one_member_abstracts abstract class Authentication { /// Apply authentication settings to header and query params. - Future applyToParams( - List authNames, - List queryParams, - Map headerParams, - ); + Future applyToParams(List queryParams, Map headerParams); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_basic_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_basic_auth.dart index bae7cde828e6..dfedaa50d090 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_basic_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_basic_auth.dart @@ -17,11 +17,7 @@ class HttpBasicAuth implements Authentication { String password; @override - Future applyToParams( - List authNames, - List queryParams, - Map headerParams, - ) async { + Future applyToParams(List queryParams, Map headerParams,) async { if (username.isNotEmpty && password.isNotEmpty) { final credentials = '$username:$password'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_bearer_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_bearer_auth.dart index f3059ea98cf5..eddf3a59cbf3 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_bearer_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_bearer_auth.dart @@ -27,11 +27,7 @@ class HttpBearerAuth implements Authentication { } @override - Future applyToParams( - List authNames, - List queryParams, - Map headerParams, - ) async { + Future applyToParams(List queryParams, Map headerParams,) async { if (_accessToken == null) { return; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/oauth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/oauth.dart index 4158650429c8..e9e7d784c3b6 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/oauth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/oauth.dart @@ -16,11 +16,7 @@ class OAuth implements Authentication { String accessToken; @override - Future applyToParams( - List authNames, - List queryParams, - Map headerParams, - ) async { + Future applyToParams(List queryParams, Map headerParams,) async { if (accessToken.isNotEmpty) { headerParams['Authorization'] = 'Bearer $accessToken'; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/additional_properties_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/additional_properties_class.dart index e82b8265bf59..68e479ee4f5c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/additional_properties_class.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/additional_properties_class.dart @@ -37,8 +37,8 @@ class AdditionalPropertiesClass { Map toJson() { final json = {}; - json[r'map_property'] = mapProperty; - json[r'map_of_map_property'] = mapOfMapProperty; + json[r'map_property'] = this.mapProperty; + json[r'map_of_map_property'] = this.mapOfMapProperty; return json; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/all_of_with_single_ref.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/all_of_with_single_ref.dart index 531853431976..e98860d25a8d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/all_of_with_single_ref.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/all_of_with_single_ref.dart @@ -43,13 +43,13 @@ class AllOfWithSingleRef { Map toJson() { final json = {}; - if (username != null) { - json[r'username'] = username; + if (this.username != null) { + json[r'username'] = this.username; } else { json[r'username'] = null; } - if (singleRefType != null) { - json[r'SingleRefType'] = singleRefType; + if (this.singleRefType != null) { + json[r'SingleRefType'] = this.singleRefType; } else { json[r'SingleRefType'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart index 2d279e07c494..2329953a7085 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart @@ -37,8 +37,8 @@ class Animal { Map toJson() { final json = {}; - json[r'className'] = className; - json[r'color'] = color; + json[r'className'] = this.className; + json[r'color'] = this.color; return json; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/api_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/api_response.dart index 38df202ce9b0..666778ab612d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/api_response.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/api_response.dart @@ -60,18 +60,18 @@ class ApiResponse { Map toJson() { final json = {}; - if (code != null) { - json[r'code'] = code; + if (this.code != null) { + json[r'code'] = this.code; } else { json[r'code'] = null; } - if (type != null) { - json[r'type'] = type; + if (this.type != null) { + json[r'type'] = this.type; } else { json[r'type'] = null; } - if (message != null) { - json[r'message'] = message; + if (this.message != null) { + json[r'message'] = this.message; } else { json[r'message'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_array_of_number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_array_of_number_only.dart index 4314803a3ba5..99f89a1ee20d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_array_of_number_only.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_array_of_number_only.dart @@ -32,7 +32,7 @@ class ArrayOfArrayOfNumberOnly { Map toJson() { final json = {}; - json[r'ArrayArrayNumber'] = arrayArrayNumber; + json[r'ArrayArrayNumber'] = this.arrayArrayNumber; return json; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_number_only.dart index 8e9d6784f804..321f7c4f40c9 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_number_only.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_number_only.dart @@ -32,7 +32,7 @@ class ArrayOfNumberOnly { Map toJson() { final json = {}; - json[r'ArrayNumber'] = arrayNumber; + json[r'ArrayNumber'] = this.arrayNumber; return json; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_test.dart index a914c04ee52a..c0b262e7d2d0 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_test.dart @@ -42,9 +42,9 @@ class ArrayTest { Map toJson() { final json = {}; - json[r'array_of_string'] = arrayOfString; - json[r'array_array_of_integer'] = arrayArrayOfInteger; - json[r'array_array_of_model'] = arrayArrayOfModel; + json[r'array_of_string'] = this.arrayOfString; + json[r'array_array_of_integer'] = this.arrayArrayOfInteger; + json[r'array_array_of_model'] = this.arrayArrayOfModel; return json; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/capitalization.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/capitalization.dart index 024d0edcc4be..838c767d3e95 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/capitalization.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/capitalization.dart @@ -94,33 +94,33 @@ class Capitalization { Map toJson() { final json = {}; - if (smallCamel != null) { - json[r'smallCamel'] = smallCamel; + if (this.smallCamel != null) { + json[r'smallCamel'] = this.smallCamel; } else { json[r'smallCamel'] = null; } - if (capitalCamel != null) { - json[r'CapitalCamel'] = capitalCamel; + if (this.capitalCamel != null) { + json[r'CapitalCamel'] = this.capitalCamel; } else { json[r'CapitalCamel'] = null; } - if (smallSnake != null) { - json[r'small_Snake'] = smallSnake; + if (this.smallSnake != null) { + json[r'small_Snake'] = this.smallSnake; } else { json[r'small_Snake'] = null; } - if (capitalSnake != null) { - json[r'Capital_Snake'] = capitalSnake; + if (this.capitalSnake != null) { + json[r'Capital_Snake'] = this.capitalSnake; } else { json[r'Capital_Snake'] = null; } - if (sCAETHFlowPoints != null) { - json[r'SCA_ETH_Flow_Points'] = sCAETHFlowPoints; + if (this.sCAETHFlowPoints != null) { + json[r'SCA_ETH_Flow_Points'] = this.sCAETHFlowPoints; } else { json[r'SCA_ETH_Flow_Points'] = null; } - if (ATT_NAME != null) { - json[r'ATT_NAME'] = ATT_NAME; + if (this.ATT_NAME != null) { + json[r'ATT_NAME'] = this.ATT_NAME; } else { json[r'ATT_NAME'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart index 5da9cf9a2a8c..6bfb040ad1cc 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart @@ -48,10 +48,10 @@ class Cat { Map toJson() { final json = {}; - json[r'className'] = className; - json[r'color'] = color; - if (declawed != null) { - json[r'declawed'] = declawed; + json[r'className'] = this.className; + json[r'color'] = this.color; + if (this.declawed != null) { + json[r'declawed'] = this.declawed; } else { json[r'declawed'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat_all_of.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat_all_of.dart index 7dfc68e8ff2f..63ed47e43f2d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat_all_of.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat_all_of.dart @@ -38,8 +38,8 @@ class CatAllOf { Map toJson() { final json = {}; - if (declawed != null) { - json[r'declawed'] = declawed; + if (this.declawed != null) { + json[r'declawed'] = this.declawed; } else { json[r'declawed'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/category.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/category.dart index f4695bed5dc3..f0cb75c98eaf 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/category.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/category.dart @@ -43,12 +43,12 @@ class Category { Map toJson() { final json = {}; - if (id != null) { - json[r'id'] = id; + if (this.id != null) { + json[r'id'] = this.id; } else { json[r'id'] = null; } - json[r'name'] = name; + json[r'name'] = this.name; return json; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/class_model.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/class_model.dart index 8c4c060fb60d..b4398348c586 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/class_model.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/class_model.dart @@ -38,8 +38,8 @@ class ClassModel { Map toJson() { final json = {}; - if (class_ != null) { - json[r'_class'] = class_; + if (this.class_ != null) { + json[r'_class'] = this.class_; } else { json[r'_class'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/deprecated_object.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/deprecated_object.dart index 4d3b15c7706d..6f3ff3dc5f41 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/deprecated_object.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/deprecated_object.dart @@ -38,8 +38,8 @@ class DeprecatedObject { Map toJson() { final json = {}; - if (name != null) { - json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; } else { json[r'name'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart index d07298479309..0375767475ab 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart @@ -48,10 +48,10 @@ class Dog { Map toJson() { final json = {}; - json[r'className'] = className; - json[r'color'] = color; - if (breed != null) { - json[r'breed'] = breed; + json[r'className'] = this.className; + json[r'color'] = this.color; + if (this.breed != null) { + json[r'breed'] = this.breed; } else { json[r'breed'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog_all_of.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog_all_of.dart index 7830a1f1c266..ae05b515cfa8 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog_all_of.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog_all_of.dart @@ -38,8 +38,8 @@ class DogAllOf { Map toJson() { final json = {}; - if (breed != null) { - json[r'breed'] = breed; + if (this.breed != null) { + json[r'breed'] = this.breed; } else { json[r'breed'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart index 7217c169ec99..7cdf6fae1fbc 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart @@ -37,12 +37,12 @@ class EnumArrays { Map toJson() { final json = {}; - if (justSymbol != null) { - json[r'just_symbol'] = justSymbol; + if (this.justSymbol != null) { + json[r'just_symbol'] = this.justSymbol; } else { json[r'just_symbol'] = null; } - json[r'array_enum'] = arrayEnum; + json[r'array_enum'] = this.arrayEnum; return json; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart index 0a8ab56327b0..c2a5723783b9 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart @@ -85,39 +85,39 @@ class EnumTest { Map toJson() { final json = {}; - if (enumString != null) { - json[r'enum_string'] = enumString; + if (this.enumString != null) { + json[r'enum_string'] = this.enumString; } else { json[r'enum_string'] = null; } - json[r'enum_string_required'] = enumStringRequired; - if (enumInteger != null) { - json[r'enum_integer'] = enumInteger; + json[r'enum_string_required'] = this.enumStringRequired; + if (this.enumInteger != null) { + json[r'enum_integer'] = this.enumInteger; } else { json[r'enum_integer'] = null; } - if (enumNumber != null) { - json[r'enum_number'] = enumNumber; + if (this.enumNumber != null) { + json[r'enum_number'] = this.enumNumber; } else { json[r'enum_number'] = null; } - if (outerEnum != null) { - json[r'outerEnum'] = outerEnum; + if (this.outerEnum != null) { + json[r'outerEnum'] = this.outerEnum; } else { json[r'outerEnum'] = null; } - if (outerEnumInteger != null) { - json[r'outerEnumInteger'] = outerEnumInteger; + if (this.outerEnumInteger != null) { + json[r'outerEnumInteger'] = this.outerEnumInteger; } else { json[r'outerEnumInteger'] = null; } - if (outerEnumDefaultValue != null) { - json[r'outerEnumDefaultValue'] = outerEnumDefaultValue; + if (this.outerEnumDefaultValue != null) { + json[r'outerEnumDefaultValue'] = this.outerEnumDefaultValue; } else { json[r'outerEnumDefaultValue'] = null; } - if (outerEnumIntegerDefaultValue != null) { - json[r'outerEnumIntegerDefaultValue'] = outerEnumIntegerDefaultValue; + if (this.outerEnumIntegerDefaultValue != null) { + json[r'outerEnumIntegerDefaultValue'] = this.outerEnumIntegerDefaultValue; } else { json[r'outerEnumIntegerDefaultValue'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/file_schema_test_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/file_schema_test_class.dart index 21d819ce73be..8fe78c1a8f1d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/file_schema_test_class.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/file_schema_test_class.dart @@ -43,12 +43,12 @@ class FileSchemaTestClass { Map toJson() { final json = {}; - if (file != null) { - json[r'file'] = file; + if (this.file != null) { + json[r'file'] = this.file; } else { json[r'file'] = null; } - json[r'files'] = files; + json[r'files'] = this.files; return json; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo.dart index 4fd3f08d59a8..758f13c778a4 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo.dart @@ -32,7 +32,7 @@ class Foo { Map toJson() { final json = {}; - json[r'bar'] = bar; + json[r'bar'] = this.bar; return json; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo_get_default_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo_get_default_response.dart index a4ce441dfbed..dcdcf7220ac5 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo_get_default_response.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo_get_default_response.dart @@ -38,8 +38,8 @@ class FooGetDefaultResponse { Map toJson() { final json = {}; - if (string != null) { - json[r'string'] = string; + if (this.string != null) { + json[r'string'] = this.string; } else { json[r'string'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/format_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/format_test.dart index 3e0d9737e3ac..9a184cb39127 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/format_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/format_test.dart @@ -191,67 +191,67 @@ class FormatTest { Map toJson() { final json = {}; - if (integer != null) { - json[r'integer'] = integer; + if (this.integer != null) { + json[r'integer'] = this.integer; } else { json[r'integer'] = null; } - if (int32 != null) { - json[r'int32'] = int32; + if (this.int32 != null) { + json[r'int32'] = this.int32; } else { json[r'int32'] = null; } - if (int64 != null) { - json[r'int64'] = int64; + if (this.int64 != null) { + json[r'int64'] = this.int64; } else { json[r'int64'] = null; } - json[r'number'] = number; - if (float != null) { - json[r'float'] = float; + json[r'number'] = this.number; + if (this.float != null) { + json[r'float'] = this.float; } else { json[r'float'] = null; } - if (double_ != null) { - json[r'double'] = double_; + if (this.double_ != null) { + json[r'double'] = this.double_; } else { json[r'double'] = null; } - if (decimal != null) { - json[r'decimal'] = decimal; + if (this.decimal != null) { + json[r'decimal'] = this.decimal; } else { json[r'decimal'] = null; } - if (string != null) { - json[r'string'] = string; + if (this.string != null) { + json[r'string'] = this.string; } else { json[r'string'] = null; } - json[r'byte'] = byte; - if (binary != null) { - json[r'binary'] = binary; + json[r'byte'] = this.byte; + if (this.binary != null) { + json[r'binary'] = this.binary; } else { json[r'binary'] = null; } - json[r'date'] = _dateFormatter.format(date.toUtc()); - if (dateTime != null) { - json[r'dateTime'] = dateTime!.toUtc().toIso8601String(); + json[r'date'] = _dateFormatter.format(this.date.toUtc()); + if (this.dateTime != null) { + json[r'dateTime'] = this.dateTime!.toUtc().toIso8601String(); } else { json[r'dateTime'] = null; } - if (uuid != null) { - json[r'uuid'] = uuid; + if (this.uuid != null) { + json[r'uuid'] = this.uuid; } else { json[r'uuid'] = null; } - json[r'password'] = password; - if (patternWithDigits != null) { - json[r'pattern_with_digits'] = patternWithDigits; + json[r'password'] = this.password; + if (this.patternWithDigits != null) { + json[r'pattern_with_digits'] = this.patternWithDigits; } else { json[r'pattern_with_digits'] = null; } - if (patternWithDigitsAndDelimiter != null) { - json[r'pattern_with_digits_and_delimiter'] = patternWithDigitsAndDelimiter; + if (this.patternWithDigitsAndDelimiter != null) { + json[r'pattern_with_digits_and_delimiter'] = this.patternWithDigitsAndDelimiter; } else { json[r'pattern_with_digits_and_delimiter'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/has_only_read_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/has_only_read_only.dart index b10dac32bf6e..0950c83518b1 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/has_only_read_only.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/has_only_read_only.dart @@ -49,13 +49,13 @@ class HasOnlyReadOnly { Map toJson() { final json = {}; - if (bar != null) { - json[r'bar'] = bar; + if (this.bar != null) { + json[r'bar'] = this.bar; } else { json[r'bar'] = null; } - if (foo != null) { - json[r'foo'] = foo; + if (this.foo != null) { + json[r'foo'] = this.foo; } else { json[r'foo'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/health_check_result.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/health_check_result.dart index 67fe059e10e1..4d0075393393 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/health_check_result.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/health_check_result.dart @@ -32,8 +32,8 @@ class HealthCheckResult { Map toJson() { final json = {}; - if (nullableMessage != null) { - json[r'NullableMessage'] = nullableMessage; + if (this.nullableMessage != null) { + json[r'NullableMessage'] = this.nullableMessage; } else { json[r'NullableMessage'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart index 5afcb48e86fa..bc22fa81499c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart @@ -47,10 +47,10 @@ class MapTest { Map toJson() { final json = {}; - json[r'map_map_of_string'] = mapMapOfString; - json[r'map_of_enum_string'] = mapOfEnumString; - json[r'direct_map'] = directMap; - json[r'indirect_map'] = indirectMap; + json[r'map_map_of_string'] = this.mapMapOfString; + json[r'map_of_enum_string'] = this.mapOfEnumString; + json[r'direct_map'] = this.directMap; + json[r'indirect_map'] = this.indirectMap; return json; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart index b2996851b2bc..2e938ae1943c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart @@ -54,17 +54,17 @@ class MixedPropertiesAndAdditionalPropertiesClass { Map toJson() { final json = {}; - if (uuid != null) { - json[r'uuid'] = uuid; + if (this.uuid != null) { + json[r'uuid'] = this.uuid; } else { json[r'uuid'] = null; } - if (dateTime != null) { - json[r'dateTime'] = dateTime!.toUtc().toIso8601String(); + if (this.dateTime != null) { + json[r'dateTime'] = this.dateTime!.toUtc().toIso8601String(); } else { json[r'dateTime'] = null; } - json[r'map'] = map; + json[r'map'] = this.map; return json; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model200_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model200_response.dart index 13ede3ded433..1019d663db27 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model200_response.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model200_response.dart @@ -49,13 +49,13 @@ class Model200Response { Map toJson() { final json = {}; - if (name != null) { - json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; } else { json[r'name'] = null; } - if (class_ != null) { - json[r'class'] = class_; + if (this.class_ != null) { + json[r'class'] = this.class_; } else { json[r'class'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_client.dart index ad83d62c8b6e..aaf943cfc090 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_client.dart @@ -38,8 +38,8 @@ class ModelClient { Map toJson() { final json = {}; - if (client != null) { - json[r'client'] = client; + if (this.client != null) { + json[r'client'] = this.client; } else { json[r'client'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_file.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_file.dart index 7456bbf19f61..1d9ea9ddde3e 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_file.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_file.dart @@ -39,8 +39,8 @@ class ModelFile { Map toJson() { final json = {}; - if (sourceURI != null) { - json[r'sourceURI'] = sourceURI; + if (this.sourceURI != null) { + json[r'sourceURI'] = this.sourceURI; } else { json[r'sourceURI'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_list.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_list.dart index ebf60ae60004..4883a0490585 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_list.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_list.dart @@ -38,8 +38,8 @@ class ModelList { Map toJson() { final json = {}; - if (n123list != null) { - json[r'123-list'] = n123list; + if (this.n123list != null) { + json[r'123-list'] = this.n123list; } else { json[r'123-list'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_return.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_return.dart index 3ff0dca337fb..faf127da4bd2 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_return.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_return.dart @@ -38,8 +38,8 @@ class ModelReturn { Map toJson() { final json = {}; - if (return_ != null) { - json[r'return'] = return_; + if (this.return_ != null) { + json[r'return'] = this.return_; } else { json[r'return'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/name.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/name.dart index 83f42116cecc..e41090c54ca4 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/name.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/name.dart @@ -65,19 +65,19 @@ class Name { Map toJson() { final json = {}; - json[r'name'] = name; - if (snakeCase != null) { - json[r'snake_case'] = snakeCase; + json[r'name'] = this.name; + if (this.snakeCase != null) { + json[r'snake_case'] = this.snakeCase; } else { json[r'snake_case'] = null; } - if (property != null) { - json[r'property'] = property; + if (this.property != null) { + json[r'property'] = this.property; } else { json[r'property'] = null; } - if (n123number != null) { - json[r'123Number'] = n123number; + if (this.n123number != null) { + json[r'123Number'] = this.n123number; } else { json[r'123Number'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/nullable_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/nullable_class.dart index b31d012c496c..631f60ab09e8 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/nullable_class.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/nullable_class.dart @@ -87,58 +87,58 @@ class NullableClass { Map toJson() { final json = {}; - if (integerProp != null) { - json[r'integer_prop'] = integerProp; + if (this.integerProp != null) { + json[r'integer_prop'] = this.integerProp; } else { json[r'integer_prop'] = null; } - if (numberProp != null) { - json[r'number_prop'] = numberProp; + if (this.numberProp != null) { + json[r'number_prop'] = this.numberProp; } else { json[r'number_prop'] = null; } - if (booleanProp != null) { - json[r'boolean_prop'] = booleanProp; + if (this.booleanProp != null) { + json[r'boolean_prop'] = this.booleanProp; } else { json[r'boolean_prop'] = null; } - if (stringProp != null) { - json[r'string_prop'] = stringProp; + if (this.stringProp != null) { + json[r'string_prop'] = this.stringProp; } else { json[r'string_prop'] = null; } - if (dateProp != null) { - json[r'date_prop'] = _dateFormatter.format(dateProp!.toUtc()); + if (this.dateProp != null) { + json[r'date_prop'] = _dateFormatter.format(this.dateProp!.toUtc()); } else { json[r'date_prop'] = null; } - if (datetimeProp != null) { - json[r'datetime_prop'] = datetimeProp!.toUtc().toIso8601String(); + if (this.datetimeProp != null) { + json[r'datetime_prop'] = this.datetimeProp!.toUtc().toIso8601String(); } else { json[r'datetime_prop'] = null; } - if (arrayNullableProp != null) { - json[r'array_nullable_prop'] = arrayNullableProp; + if (this.arrayNullableProp != null) { + json[r'array_nullable_prop'] = this.arrayNullableProp; } else { json[r'array_nullable_prop'] = null; } - if (arrayAndItemsNullableProp != null) { - json[r'array_and_items_nullable_prop'] = arrayAndItemsNullableProp; + if (this.arrayAndItemsNullableProp != null) { + json[r'array_and_items_nullable_prop'] = this.arrayAndItemsNullableProp; } else { json[r'array_and_items_nullable_prop'] = null; } - json[r'array_items_nullable'] = arrayItemsNullable; - if (objectNullableProp != null) { - json[r'object_nullable_prop'] = objectNullableProp; + json[r'array_items_nullable'] = this.arrayItemsNullable; + if (this.objectNullableProp != null) { + json[r'object_nullable_prop'] = this.objectNullableProp; } else { json[r'object_nullable_prop'] = null; } - if (objectAndItemsNullableProp != null) { - json[r'object_and_items_nullable_prop'] = objectAndItemsNullableProp; + if (this.objectAndItemsNullableProp != null) { + json[r'object_and_items_nullable_prop'] = this.objectAndItemsNullableProp; } else { json[r'object_and_items_nullable_prop'] = null; } - json[r'object_items_nullable'] = objectItemsNullable; + json[r'object_items_nullable'] = this.objectItemsNullable; return json; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/number_only.dart index edd811f85ce4..387397e6e4e3 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/number_only.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/number_only.dart @@ -38,8 +38,8 @@ class NumberOnly { Map toJson() { final json = {}; - if (justNumber != null) { - json[r'JustNumber'] = justNumber; + if (this.justNumber != null) { + json[r'JustNumber'] = this.justNumber; } else { json[r'JustNumber'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/object_with_deprecated_fields.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/object_with_deprecated_fields.dart index 051095df2f3a..36b0fee3d78f 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/object_with_deprecated_fields.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/object_with_deprecated_fields.dart @@ -65,22 +65,22 @@ class ObjectWithDeprecatedFields { Map toJson() { final json = {}; - if (uuid != null) { - json[r'uuid'] = uuid; + if (this.uuid != null) { + json[r'uuid'] = this.uuid; } else { json[r'uuid'] = null; } - if (id != null) { - json[r'id'] = id; + if (this.id != null) { + json[r'id'] = this.id; } else { json[r'id'] = null; } - if (deprecatedRef != null) { - json[r'deprecatedRef'] = deprecatedRef; + if (this.deprecatedRef != null) { + json[r'deprecatedRef'] = this.deprecatedRef; } else { json[r'deprecatedRef'] = null; } - json[r'bars'] = bars; + json[r'bars'] = this.bars; return json; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart index a353e15298c0..456b26277819 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart @@ -82,32 +82,32 @@ class Order { Map toJson() { final json = {}; - if (id != null) { - json[r'id'] = id; + if (this.id != null) { + json[r'id'] = this.id; } else { json[r'id'] = null; } - if (petId != null) { - json[r'petId'] = petId; + if (this.petId != null) { + json[r'petId'] = this.petId; } else { json[r'petId'] = null; } - if (quantity != null) { - json[r'quantity'] = quantity; + if (this.quantity != null) { + json[r'quantity'] = this.quantity; } else { json[r'quantity'] = null; } - if (shipDate != null) { - json[r'shipDate'] = shipDate!.toUtc().toIso8601String(); + if (this.shipDate != null) { + json[r'shipDate'] = this.shipDate!.toUtc().toIso8601String(); } else { json[r'shipDate'] = null; } - if (status != null) { - json[r'status'] = status; + if (this.status != null) { + json[r'status'] = this.status; } else { json[r'status'] = null; } - json[r'complete'] = complete; + json[r'complete'] = this.complete; return json; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_composite.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_composite.dart index 8f7a625d4410..6898564d6fde 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_composite.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_composite.dart @@ -60,18 +60,18 @@ class OuterComposite { Map toJson() { final json = {}; - if (myNumber != null) { - json[r'my_number'] = myNumber; + if (this.myNumber != null) { + json[r'my_number'] = this.myNumber; } else { json[r'my_number'] = null; } - if (myString != null) { - json[r'my_string'] = myString; + if (this.myString != null) { + json[r'my_string'] = this.myString; } else { json[r'my_string'] = null; } - if (myBoolean != null) { - json[r'my_boolean'] = myBoolean; + if (this.myBoolean != null) { + json[r'my_boolean'] = this.myBoolean; } else { json[r'my_boolean'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_object_with_enum_property.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_object_with_enum_property.dart index 8b9b76380e6d..04177475ea3f 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_object_with_enum_property.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_object_with_enum_property.dart @@ -32,7 +32,7 @@ class OuterObjectWithEnumProperty { Map toJson() { final json = {}; - json[r'value'] = value; + json[r'value'] = this.value; return json; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart index 8b3a32dbd948..dee320d8bd9b 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart @@ -70,21 +70,21 @@ class Pet { Map toJson() { final json = {}; - if (id != null) { - json[r'id'] = id; + if (this.id != null) { + json[r'id'] = this.id; } else { json[r'id'] = null; } - if (category != null) { - json[r'category'] = category; + if (this.category != null) { + json[r'category'] = this.category; } else { json[r'category'] = null; } - json[r'name'] = name; - json[r'photoUrls'] = photoUrls; - json[r'tags'] = tags; - if (status != null) { - json[r'status'] = status; + json[r'name'] = this.name; + json[r'photoUrls'] = this.photoUrls; + json[r'tags'] = this.tags; + if (this.status != null) { + json[r'status'] = this.status; } else { json[r'status'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/read_only_first.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/read_only_first.dart index 5ea12ed6f8db..3599aff10a80 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/read_only_first.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/read_only_first.dart @@ -49,13 +49,13 @@ class ReadOnlyFirst { Map toJson() { final json = {}; - if (bar != null) { - json[r'bar'] = bar; + if (this.bar != null) { + json[r'bar'] = this.bar; } else { json[r'bar'] = null; } - if (baz != null) { - json[r'baz'] = baz; + if (this.baz != null) { + json[r'baz'] = this.baz; } else { json[r'baz'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/special_model_name.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/special_model_name.dart index d334d2c4fb5a..f92b8d67d7a0 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/special_model_name.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/special_model_name.dart @@ -38,8 +38,8 @@ class SpecialModelName { Map toJson() { final json = {}; - if (dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket != null) { - json[r'$special[property.name]'] = dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; + if (this.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket != null) { + json[r'$special[property.name]'] = this.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; } else { json[r'$special[property.name]'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/tag.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/tag.dart index e718c6690269..1fd6d01f16dc 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/tag.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/tag.dart @@ -49,13 +49,13 @@ class Tag { Map toJson() { final json = {}; - if (id != null) { - json[r'id'] = id; + if (this.id != null) { + json[r'id'] = this.id; } else { json[r'id'] = null; } - if (name != null) { - json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; } else { json[r'name'] = null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/user.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/user.dart index 7a14b4426780..63fc8e528159 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/user.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/user.dart @@ -116,43 +116,43 @@ class User { Map toJson() { final json = {}; - if (id != null) { - json[r'id'] = id; + if (this.id != null) { + json[r'id'] = this.id; } else { json[r'id'] = null; } - if (username != null) { - json[r'username'] = username; + if (this.username != null) { + json[r'username'] = this.username; } else { json[r'username'] = null; } - if (firstName != null) { - json[r'firstName'] = firstName; + if (this.firstName != null) { + json[r'firstName'] = this.firstName; } else { json[r'firstName'] = null; } - if (lastName != null) { - json[r'lastName'] = lastName; + if (this.lastName != null) { + json[r'lastName'] = this.lastName; } else { json[r'lastName'] = null; } - if (email != null) { - json[r'email'] = email; + if (this.email != null) { + json[r'email'] = this.email; } else { json[r'email'] = null; } - if (password != null) { - json[r'password'] = password; + if (this.password != null) { + json[r'password'] = this.password; } else { json[r'password'] = null; } - if (phone != null) { - json[r'phone'] = phone; + if (this.phone != null) { + json[r'phone'] = this.phone; } else { json[r'phone'] = null; } - if (userStatus != null) { - json[r'userStatus'] = userStatus; + if (this.userStatus != null) { + json[r'userStatus'] = this.userStatus; } else { json[r'userStatus'] = null; } From 454ad96bd884c6672022fac46fe1f7806b06ef3e Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Sun, 7 Aug 2022 19:52:10 +0200 Subject: [PATCH 11/11] Revert adding a generic T in `ApiClient`. --- .../src/main/resources/dart2/api_client.mustache | 4 ++-- .../petstore/dart2/petstore_client_lib/lib/api_client.dart | 4 ++-- .../dart2/petstore_client_lib_fake/lib/api_client.dart | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache index ff1ba61a4754..b340a9745757 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache @@ -1,10 +1,10 @@ {{>header}} {{>part_of}} -class ApiClient { +class ApiClient { ApiClient({this.basePath = '{{{basePath}}}', this.authentication,}); final String basePath; - final T? authentication; + final Authentication? authentication; var _client = Client(); final _defaultHeaderMap = {}; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart index 1daa4bc260a4..00b9e81f7ea9 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart @@ -10,11 +10,11 @@ part of openapi.api; -class ApiClient { +class ApiClient { ApiClient({this.basePath = 'http://petstore.swagger.io/v2', this.authentication,}); final String basePath; - final T? authentication; + final Authentication? authentication; var _client = Client(); final _defaultHeaderMap = {}; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart index 536cdf44c5f0..22839ae04f0b 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart @@ -10,11 +10,11 @@ part of openapi.api; -class ApiClient { +class ApiClient { ApiClient({this.basePath = 'http://petstore.swagger.io:80/v2', this.authentication,}); final String basePath; - final T? authentication; + final Authentication? authentication; var _client = Client(); final _defaultHeaderMap = {};