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..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,11 +1,13 @@ {{>header}} {{>part_of}} class ApiClient { - ApiClient({this.basePath = '{{{basePath}}}', this.authentication}); + ApiClient({this.basePath = '{{{basePath}}}', this.authentication,}); final String basePath; + final Authentication? 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( @@ -37,7 +36,7 @@ class ApiClient { Map formParams, String? contentType, ) async { - _updateParamsForAuth(queryParams, headerParams); + await authentication?.applyToParams(queryParams, headerParams); headerParams.addAll(_defaultHeaderMap); if (contentType != null) { @@ -157,16 +156,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 queryParams, - Map headerParams, - ) { - if (authentication != null) { - authentication!.applyToParams(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 b4f5a4587246..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,7 +10,7 @@ class ApiKeyAuth implements Authentication { String apiKey = ''; @override - void applyToParams(List queryParams, Map headerParams) { + 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 e8aaaa4d5411..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,5 +3,5 @@ // ignore: one_member_abstracts abstract class Authentication { /// Apply authentication settings to header and query params. - void applyToParams(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 544219733921..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,7 +7,7 @@ class HttpBasicAuth implements Authentication { String password; @override - void applyToParams(List queryParams, Map headerParams) { + 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 7c480c5e81d3..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,7 +17,7 @@ class HttpBearerAuth implements Authentication { } @override - void applyToParams(List queryParams, Map headerParams) { + 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 c5c64d522184..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,7 +6,7 @@ class OAuth implements Authentication { String accessToken; @override - void applyToParams(List queryParams, Map headerParams) { + Future applyToParams(List queryParams, Map headerParams,) async { if (accessToken.isNotEmpty) { headerParams['Authorization'] = 'Bearer $accessToken'; } 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..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 @@ -52,59 +52,59 @@ class {{{classname}}} { String toString() => '{{{classname}}}[{{#vars}}{{{name}}}=${{{name}}}{{^-last}}, {{/-last}}{{/vars}}]'; Map toJson() { - final _json = {}; + 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(); + json[r'{{{baseName}}}'] = _dateEpochMarker == '{{{pattern}}}' + ? 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()); + json[r'{{{baseName}}}'] = _dateEpochMarker == '{{{pattern}}}' + ? 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}} } 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 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..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 @@ -11,11 +11,13 @@ 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; + final Authentication? 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( @@ -47,7 +46,7 @@ class ApiClient { Map formParams, String? contentType, ) async { - _updateParamsForAuth(queryParams, headerParams); + await authentication?.applyToParams(queryParams, headerParams); headerParams.addAll(_defaultHeaderMap); if (contentType != null) { @@ -165,16 +164,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 queryParams, - Map headerParams, - ) { - if (authentication != null) { - authentication!.applyToParams(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 e304eda321ee..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,7 +20,7 @@ class ApiKeyAuth implements Authentication { String apiKey = ''; @override - void applyToParams(List queryParams, Map headerParams) { + 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 49baf7c46a9c..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,5 +13,5 @@ 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); + 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 81abd7185f2d..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,7 +17,7 @@ class HttpBasicAuth implements Authentication { String password; @override - void applyToParams(List queryParams, Map headerParams) { + 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 213f3483b8fb..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,7 +27,7 @@ class HttpBearerAuth implements Authentication { } @override - void applyToParams(List queryParams, Map headerParams) { + 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 e9b87cffb052..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,7 +16,7 @@ class OAuth implements Authentication { String accessToken; @override - void applyToParams(List queryParams, Map headerParams) { + 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 a4eaa58a9d08..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 @@ -59,23 +59,23 @@ class ApiResponse { String toString() => 'ApiResponse[code=$code, type=$type, message=$message]'; Map toJson() { - final _json = {}; - if (code != null) { - _json[r'code'] = code; + final json = {}; + if (this.code != null) { + json[r'code'] = this.code; } else { - _json[r'code'] = null; + 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; + 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; + 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..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 @@ -48,18 +48,18 @@ class Category { String toString() => 'Category[id=$id, name=$name]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; } else { - _json[r'id'] = null; + 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; + 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..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 @@ -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 = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; } else { - _json[r'id'] = null; + 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; + 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; + 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; + 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'status'] = null; } - _json[r'complete'] = complete; - return _json; + json[r'complete'] = this.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..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 @@ -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 = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; } else { - _json[r'id'] = null; + 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'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; + 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..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 @@ -48,18 +48,18 @@ class Tag { String toString() => 'Tag[id=$id, name=$name]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; } else { - _json[r'id'] = null; + 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; + 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..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 @@ -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 = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; } else { - _json[r'id'] = null; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart index 94a25909e6d9..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 @@ -11,11 +11,13 @@ 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; + final Authentication? 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( @@ -47,7 +46,7 @@ class ApiClient { Map formParams, String? contentType, ) async { - _updateParamsForAuth(queryParams, headerParams); + await authentication?.applyToParams(queryParams, headerParams); headerParams.addAll(_defaultHeaderMap); if (contentType != null) { @@ -165,16 +164,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 queryParams, - Map headerParams, - ) { - if (authentication != null) { - authentication!.applyToParams(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 e304eda321ee..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,7 +20,7 @@ class ApiKeyAuth implements Authentication { String apiKey = ''; @override - void applyToParams(List queryParams, Map headerParams) { + 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 49baf7c46a9c..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,5 +13,5 @@ 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); + 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 81abd7185f2d..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,7 +17,7 @@ class HttpBasicAuth implements Authentication { String password; @override - void applyToParams(List queryParams, Map headerParams) { + 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 213f3483b8fb..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,7 +27,7 @@ class HttpBearerAuth implements Authentication { } @override - void applyToParams(List queryParams, Map headerParams) { + 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 e9b87cffb052..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,7 +16,7 @@ class OAuth implements Authentication { String accessToken; @override - void applyToParams(List queryParams, Map headerParams) { + 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 43adda6ff718..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 @@ -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'] = this.mapProperty; + json[r'map_of_map_property'] = this.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..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 @@ -42,18 +42,18 @@ class AllOfWithSingleRef { String toString() => 'AllOfWithSingleRef[username=$username, singleRefType=$singleRefType]'; Map toJson() { - final _json = {}; - if (username != null) { - _json[r'username'] = username; + final json = {}; + if (this.username != null) { + json[r'username'] = this.username; } else { - _json[r'username'] = null; + 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; + 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..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 @@ -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'] = this.className; + json[r'color'] = this.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..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 @@ -59,23 +59,23 @@ class ApiResponse { String toString() => 'ApiResponse[code=$code, type=$type, message=$message]'; Map toJson() { - final _json = {}; - if (code != null) { - _json[r'code'] = code; + final json = {}; + if (this.code != null) { + json[r'code'] = this.code; } else { - _json[r'code'] = null; + 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; + 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; + 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..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 @@ -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'] = this.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..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 @@ -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'] = this.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..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 @@ -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'] = this.arrayOfString; + json[r'array_array_of_integer'] = this.arrayArrayOfInteger; + json[r'array_array_of_model'] = this.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..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 @@ -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 = {}; - if (smallCamel != null) { - _json[r'smallCamel'] = smallCamel; + final json = {}; + if (this.smallCamel != null) { + json[r'smallCamel'] = this.smallCamel; } else { - _json[r'smallCamel'] = null; + 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; + 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; + 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; + 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; + 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; + 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..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 @@ -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; - if (declawed != null) { - _json[r'declawed'] = declawed; + final json = {}; + json[r'className'] = this.className; + json[r'color'] = this.color; + if (this.declawed != null) { + json[r'declawed'] = this.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..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 @@ -37,13 +37,13 @@ class CatAllOf { String toString() => 'CatAllOf[declawed=$declawed]'; Map toJson() { - final _json = {}; - if (declawed != null) { - _json[r'declawed'] = declawed; + final json = {}; + if (this.declawed != null) { + json[r'declawed'] = this.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..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 @@ -42,14 +42,14 @@ class Category { String toString() => 'Category[id=$id, name=$name]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; } else { - _json[r'id'] = null; + json[r'id'] = null; } - _json[r'name'] = name; - return _json; + json[r'name'] = this.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..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 @@ -37,13 +37,13 @@ class ClassModel { String toString() => 'ClassModel[class_=$class_]'; Map toJson() { - final _json = {}; - if (class_ != null) { - _json[r'_class'] = class_; + final json = {}; + if (this.class_ != null) { + json[r'_class'] = this.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..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 @@ -37,13 +37,13 @@ class DeprecatedObject { String toString() => 'DeprecatedObject[name=$name]'; Map toJson() { - final _json = {}; - if (name != null) { - _json[r'name'] = name; + final json = {}; + if (this.name != null) { + json[r'name'] = this.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..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 @@ -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; - if (breed != null) { - _json[r'breed'] = breed; + final json = {}; + json[r'className'] = this.className; + json[r'color'] = this.color; + if (this.breed != null) { + json[r'breed'] = this.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..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 @@ -37,13 +37,13 @@ class DogAllOf { String toString() => 'DogAllOf[breed=$breed]'; Map toJson() { - final _json = {}; - if (breed != null) { - _json[r'breed'] = breed; + final json = {}; + if (this.breed != null) { + json[r'breed'] = this.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..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 @@ -36,14 +36,14 @@ class EnumArrays { String toString() => 'EnumArrays[justSymbol=$justSymbol, arrayEnum=$arrayEnum]'; Map toJson() { - final _json = {}; - if (justSymbol != null) { - _json[r'just_symbol'] = justSymbol; + final json = {}; + if (this.justSymbol != null) { + json[r'just_symbol'] = this.justSymbol; } else { - _json[r'just_symbol'] = null; + json[r'just_symbol'] = null; } - _json[r'array_enum'] = arrayEnum; - return _json; + json[r'array_enum'] = this.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..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 @@ -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 = {}; - if (enumString != null) { - _json[r'enum_string'] = enumString; + final json = {}; + if (this.enumString != null) { + json[r'enum_string'] = this.enumString; } else { - _json[r'enum_string'] = null; + 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; + 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; + 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; + 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; + 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; + 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; + 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..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 @@ -42,14 +42,14 @@ class FileSchemaTestClass { String toString() => 'FileSchemaTestClass[file=$file, files=$files]'; Map toJson() { - final _json = {}; - if (file != null) { - _json[r'file'] = file; + final json = {}; + if (this.file != null) { + json[r'file'] = this.file; } else { - _json[r'file'] = null; + json[r'file'] = null; } - _json[r'files'] = files; - return _json; + json[r'files'] = this.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..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 @@ -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'] = this.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..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 @@ -37,13 +37,13 @@ class FooGetDefaultResponse { String toString() => 'FooGetDefaultResponse[string=$string]'; Map toJson() { - final _json = {}; - if (string != null) { - _json[r'string'] = string; + final json = {}; + if (this.string != null) { + json[r'string'] = this.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..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 @@ -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 = {}; - if (integer != null) { - _json[r'integer'] = integer; + final json = {}; + if (this.integer != null) { + json[r'integer'] = this.integer; } else { - _json[r'integer'] = null; + 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; + 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'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; + 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; + 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; + 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'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'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; + 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'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; + 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; + 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..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 @@ -48,18 +48,18 @@ class HasOnlyReadOnly { String toString() => 'HasOnlyReadOnly[bar=$bar, foo=$foo]'; Map toJson() { - final _json = {}; - if (bar != null) { - _json[r'bar'] = bar; + final json = {}; + if (this.bar != null) { + json[r'bar'] = this.bar; } else { - _json[r'bar'] = null; + 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; + 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..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 @@ -31,13 +31,13 @@ class HealthCheckResult { String toString() => 'HealthCheckResult[nullableMessage=$nullableMessage]'; Map toJson() { - final _json = {}; - if (nullableMessage != null) { - _json[r'NullableMessage'] = nullableMessage; + final json = {}; + if (this.nullableMessage != null) { + json[r'NullableMessage'] = this.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..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 @@ -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'] = this.mapMapOfString; + json[r'map_of_enum_string'] = this.mapOfEnumString; + json[r'direct_map'] = this.directMap; + json[r'indirect_map'] = this.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..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 @@ -53,19 +53,19 @@ class MixedPropertiesAndAdditionalPropertiesClass { String toString() => 'MixedPropertiesAndAdditionalPropertiesClass[uuid=$uuid, dateTime=$dateTime, map=$map]'; Map toJson() { - final _json = {}; - if (uuid != null) { - _json[r'uuid'] = uuid; + final json = {}; + if (this.uuid != null) { + json[r'uuid'] = this.uuid; } else { - _json[r'uuid'] = null; + 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'dateTime'] = null; } - _json[r'map'] = map; - return _json; + json[r'map'] = this.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..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 @@ -48,18 +48,18 @@ class Model200Response { String toString() => 'Model200Response[name=$name, class_=$class_]'; Map toJson() { - final _json = {}; - if (name != null) { - _json[r'name'] = name; + final json = {}; + if (this.name != null) { + json[r'name'] = this.name; } else { - _json[r'name'] = null; + 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; + 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..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 @@ -37,13 +37,13 @@ class ModelClient { String toString() => 'ModelClient[client=$client]'; Map toJson() { - final _json = {}; - if (client != null) { - _json[r'client'] = client; + final json = {}; + if (this.client != null) { + json[r'client'] = this.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..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 @@ -38,13 +38,13 @@ class ModelFile { String toString() => 'ModelFile[sourceURI=$sourceURI]'; Map toJson() { - final _json = {}; - if (sourceURI != null) { - _json[r'sourceURI'] = sourceURI; + final json = {}; + if (this.sourceURI != null) { + json[r'sourceURI'] = this.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..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 @@ -37,13 +37,13 @@ class ModelList { String toString() => 'ModelList[n123list=$n123list]'; Map toJson() { - final _json = {}; - if (n123list != null) { - _json[r'123-list'] = n123list; + final json = {}; + if (this.n123list != null) { + json[r'123-list'] = this.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..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 @@ -37,13 +37,13 @@ class ModelReturn { String toString() => 'ModelReturn[return_=$return_]'; Map toJson() { - final _json = {}; - if (return_ != null) { - _json[r'return'] = return_; + final json = {}; + if (this.return_ != null) { + json[r'return'] = this.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..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 @@ -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; - if (snakeCase != null) { - _json[r'snake_case'] = snakeCase; + final json = {}; + json[r'name'] = this.name; + if (this.snakeCase != null) { + json[r'snake_case'] = this.snakeCase; } else { - _json[r'snake_case'] = null; + 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; + 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; + 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..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 @@ -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 = {}; - if (integerProp != null) { - _json[r'integer_prop'] = integerProp; + final json = {}; + if (this.integerProp != null) { + json[r'integer_prop'] = this.integerProp; } else { - _json[r'integer_prop'] = null; + 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; + 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; + 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; + 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; + 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; + 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; + 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_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; + 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_and_items_nullable_prop'] = null; } - _json[r'object_items_nullable'] = objectItemsNullable; - return _json; + json[r'object_items_nullable'] = this.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..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 @@ -37,13 +37,13 @@ class NumberOnly { String toString() => 'NumberOnly[justNumber=$justNumber]'; Map toJson() { - final _json = {}; - if (justNumber != null) { - _json[r'JustNumber'] = justNumber; + final json = {}; + if (this.justNumber != null) { + json[r'JustNumber'] = this.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..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 @@ -64,24 +64,24 @@ class ObjectWithDeprecatedFields { String toString() => 'ObjectWithDeprecatedFields[uuid=$uuid, id=$id, deprecatedRef=$deprecatedRef, bars=$bars]'; Map toJson() { - final _json = {}; - if (uuid != null) { - _json[r'uuid'] = uuid; + final json = {}; + if (this.uuid != null) { + json[r'uuid'] = this.uuid; } else { - _json[r'uuid'] = null; + 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; + 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'deprecatedRef'] = null; } - _json[r'bars'] = bars; - return _json; + json[r'bars'] = this.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..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 @@ -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 = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; } else { - _json[r'id'] = null; + 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; + 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; + 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; + 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'status'] = null; } - _json[r'complete'] = complete; - return _json; + json[r'complete'] = this.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..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 @@ -59,23 +59,23 @@ class OuterComposite { String toString() => 'OuterComposite[myNumber=$myNumber, myString=$myString, myBoolean=$myBoolean]'; Map toJson() { - final _json = {}; - if (myNumber != null) { - _json[r'my_number'] = myNumber; + final json = {}; + if (this.myNumber != null) { + json[r'my_number'] = this.myNumber; } else { - _json[r'my_number'] = null; + 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; + 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; + 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..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 @@ -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'] = this.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..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 @@ -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 = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; } else { - _json[r'id'] = null; + 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'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; + 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..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 @@ -48,18 +48,18 @@ class ReadOnlyFirst { String toString() => 'ReadOnlyFirst[bar=$bar, baz=$baz]'; Map toJson() { - final _json = {}; - if (bar != null) { - _json[r'bar'] = bar; + final json = {}; + if (this.bar != null) { + json[r'bar'] = this.bar; } else { - _json[r'bar'] = null; + 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; + 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..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 @@ -37,13 +37,13 @@ class SpecialModelName { String toString() => 'SpecialModelName[dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket=$dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket]'; Map toJson() { - final _json = {}; - if (dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket != null) { - _json[r'$special[property.name]'] = dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; + final json = {}; + if (this.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket != null) { + json[r'$special[property.name]'] = this.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..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 @@ -48,18 +48,18 @@ class Tag { String toString() => 'Tag[id=$id, name=$name]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; } else { - _json[r'id'] = null; + 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; + 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..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 @@ -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 = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; } else { - _json[r'id'] = null; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + json[r'userStatus'] = null; } - return _json; + return json; } /// Returns a new [User] instance and imports its values from