diff --git a/modules/openapi-generator/src/main/resources/dart2/api.mustache b/modules/openapi-generator/src/main/resources/dart2/api.mustache index d99ba2b325f..6a53829cb59 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api.mustache @@ -99,39 +99,37 @@ class {{{classname}}} { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = [{{#authMethods}}'{{{name}}}'{{^-last}}, {{/-last}}{{/authMethods}}]; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - {{#formParams}} - {{^isFile}} - if ({{{paramName}}} != null) { - hasFields = true; - mp.fields[r'{{{baseName}}}'] = parameterToString({{{paramName}}}); - } - {{/isFile}} - {{#isFile}} - if ({{{paramName}}} != null) { - hasFields = true; - mp.fields[r'{{{baseName}}}'] = {{{paramName}}}.field; - mp.files.add({{{paramName}}}); - } - {{/isFile}} - {{/formParams}} - if (hasFields) { - postBody = mp; - } - } else { - {{#formParams}} - {{^isFile}} - if ({{{paramName}}} != null) { - formParams[r'{{{baseName}}}'] = parameterToString({{{paramName}}}); - } - {{/isFile}} - {{/formParams}} + {{#isMultipart}} + bool hasFields = false; + final mp = MultipartRequest('{{{httpMethod}}}', Uri.parse(path)); + {{#formParams}} + {{^isFile}} + if ({{{paramName}}} != null) { + hasFields = true; + mp.fields[r'{{{baseName}}}'] = parameterToString({{{paramName}}}); } + {{/isFile}} + {{#isFile}} + if ({{{paramName}}} != null) { + hasFields = true; + mp.fields[r'{{{baseName}}}'] = {{{paramName}}}.field; + mp.files.add({{{paramName}}}); + } + {{/isFile}} + {{/formParams}} + if (hasFields) { + postBody = mp; + } + {{/isMultipart}} + {{^isMultipart}} + {{#formParams}} + {{^isFile}} + if ({{{paramName}}} != null) { + formParams[r'{{{baseName}}}'] = parameterToString({{{paramName}}}); + } + {{/isFile}} + {{/formParams}} + {{/isMultipart}} return await apiClient.invokeAPI( path, diff --git a/samples/openapi3/client/petstore/dart2/petstore/.analysis_options b/samples/openapi3/client/petstore/dart2/petstore/.analysis_options deleted file mode 100644 index a10d4c5a05c..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore/.analysis_options +++ /dev/null @@ -1,2 +0,0 @@ -analyzer: - strong-mode: true diff --git a/samples/openapi3/client/petstore/dart2/petstore/pubspec.yaml b/samples/openapi3/client/petstore/dart2/petstore/pubspec.yaml index f2630175093..92262618ab4 100644 --- a/samples/openapi3/client/petstore/dart2/petstore/pubspec.yaml +++ b/samples/openapi3/client/petstore/dart2/petstore/pubspec.yaml @@ -1,13 +1,18 @@ name: petstore_client version: 1.0.0 description: Petstore client using OpenAPI library + +publish_to: none + environment: - sdk: '>=2.5.0 <3.0.0' + sdk: '>=2.11.0 <3.0.0' + dependencies: openapi: path: ../petstore_client_lib + dev_dependencies: test: ^1.8.0 mockito: ^4.1.1 - http: ^0.12.0 + http: ^0.13.0 collection: ^1.14.12 diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/fake_client.dart b/samples/openapi3/client/petstore/dart2/petstore/test/fake_client.dart index 95c735deb38..ed60f386aa4 100644 --- a/samples/openapi3/client/petstore/dart2/petstore/test/fake_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore/test/fake_client.dart @@ -21,9 +21,9 @@ class FakeClient extends Fake implements Client { this.expectedPutRequestBody, this.putResponseBody, this.sendResponseBody, - this.expectedUrl, + String expectedUrl, this.expectedHeaders = null, - }); + }) : this.expectedUrl = Uri.parse(expectedUrl); Exception throwException; Object expectedPostRequestBody; @@ -34,12 +34,12 @@ class FakeClient extends Fake implements Client { String expectedPutRequestBody; String putResponseBody; String sendResponseBody; - String expectedUrl; + Uri expectedUrl; Map expectedHeaders; @override - Future post(url, - {Map headers, body, Encoding encoding}) async { + Future post(Uri url, + {Map headers, Object body, Encoding encoding}) async { // check that the request was made with expected values if (url != expectedUrl) { throw StateError( @@ -67,7 +67,7 @@ class FakeClient extends Fake implements Client { } @override - Future get(url, {Map headers}) async { + Future get(Uri url, {Map headers}) async { // check that the request was made with expected values if (url != expectedUrl) { throw StateError( @@ -85,7 +85,8 @@ class FakeClient extends Fake implements Client { } @override - Future delete(url, {Map headers}) async { + Future delete(Uri url, + {Map headers, Object body, Encoding encoding}) async { // check that the request was made with expected values if (url != expectedUrl) { throw StateError( @@ -103,8 +104,8 @@ class FakeClient extends Fake implements Client { } @override - Future put(url, - {Map headers, body, Encoding encoding}) async { + Future put(Uri url, + {Map headers, Object body, Encoding encoding}) async { // check that the request was made with expected values if (url != expectedUrl) { throw StateError( diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/order_model_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/order_model_test.dart index 9cdc65fe52d..7048659e894 100644 --- a/samples/openapi3/client/petstore/dart2/petstore/test/order_model_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore/test/order_model_test.dart @@ -2,8 +2,8 @@ import 'package:openapi/api.dart'; import 'package:test/test.dart'; void main() { - test('Check if default value is generated', () async { - var order = Order(); - expect(order.complete, equals(false)); - }); + test('Check if default value is generated', () async { + var order = Order(); + expect(order.complete, equals(false)); + }); } diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/pet_faked_client_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/pet_faked_client_test.dart index 277c49b3971..9737df5d488 100644 --- a/samples/openapi3/client/petstore/dart2/petstore/test/pet_faked_client_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore/test/pet_faked_client_test.dart @@ -26,11 +26,10 @@ void main() { ..id = 124321 ..name = 'Jose' ]; - return Pet() + return Pet(name: name) ..id = id ..category = category ..tags = tags - ..name = name ..status = PetStatusEnum.fromJson(status) ..photoUrls = ['https://petstore.com/sample/photo1.jpg']; } @@ -53,8 +52,7 @@ void main() { // use the pet api to add a pet petApi.apiClient.client = FakeClient( expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: - await petApi.apiClient.serializeAsync(newPet), + expectedPostRequestBody: await petApi.apiClient.serializeAsync(newPet), postResponseBody: await petApi.apiClient.serializeAsync(newPet), expectedHeaders: {'Content-Type': 'application/json'}); await petApi.addPet(newPet); @@ -76,8 +74,7 @@ void main() { expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', throwException: ApiException(400, 'not found'), ); - expect( - petApi.getPetById(id), throwsA(equals(TypeMatcher()))); + expect(petApi.getPetById(id), throwsA(equals(TypeMatcher()))); }); test('deletes existing pet by id', () async { @@ -87,8 +84,7 @@ void main() { // add a new pet petApi.apiClient.client = FakeClient( expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: - await petApi.apiClient.serializeAsync(newPet), + expectedPostRequestBody: await petApi.apiClient.serializeAsync(newPet), postResponseBody: await petApi.apiClient.serializeAsync(newPet), expectedHeaders: {'Content-Type': 'application/json'}); await petApi.addPet(newPet); @@ -106,8 +102,7 @@ void main() { expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', throwException: ApiException(400, 'Not found'), ); - expect( - petApi.getPetById(id), throwsA(equals(TypeMatcher()))); + expect(petApi.getPetById(id), throwsA(equals(TypeMatcher()))); }); test('updates pet with form', () async { @@ -117,16 +112,11 @@ void main() { // add a new pet petApi.apiClient.client = FakeClient( expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: - await petApi.apiClient.serializeAsync(newPet), + expectedPostRequestBody: await petApi.apiClient.serializeAsync(newPet), postResponseBody: await petApi.apiClient.serializeAsync(newPet), expectedHeaders: {'Content-Type': 'application/json'}); await petApi.addPet(newPet); - final multipartRequest = MultipartRequest(null, null); - multipartRequest.fields['name'] = 'Doge'; - multipartRequest.fields['status'] = ''; - // update with form petApi.apiClient.client = FakeClient( expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', @@ -157,8 +147,7 @@ void main() { // add a new pet petApi.apiClient.client = FakeClient( expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: - await petApi.apiClient.serializeAsync(newPet), + expectedPostRequestBody: await petApi.apiClient.serializeAsync(newPet), postResponseBody: await petApi.apiClient.serializeAsync(newPet), expectedHeaders: {'Content-Type': 'application/json'}); await petApi.addPet(newPet); @@ -166,8 +155,7 @@ void main() { // update the same pet petApi.apiClient.client = FakeClient( expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPutRequestBody: - await petApi.apiClient.serializeAsync(updatePet), + expectedPutRequestBody: await petApi.apiClient.serializeAsync(updatePet), putResponseBody: await petApi.apiClient.serializeAsync(updatePet), expectedHeaders: {'Content-Type': 'application/json'}); await petApi.updatePet(updatePet); @@ -196,15 +184,13 @@ void main() { // retrieve pets by status petApi.apiClient.client = FakeClient( - expectedUrl: - 'http://petstore.swagger.io/v2/pet/findByStatus?status=$status', + expectedUrl: 'http://petstore.swagger.io/v2/pet/findByStatus?status=$status', getResponseBody: await petApi.apiClient.serializeAsync([pet1, pet2]), ); final pets = await petApi.findPetsByStatus([status]); // tests serialisation and deserialisation of enum - final petsByStatus = - pets.where((p) => p.status == PetStatusEnum.available); + final petsByStatus = pets.where((p) => p.status == PetStatusEnum.available); expect(petsByStatus.length, equals(2)); final petIds = pets.map((pet) => pet.id).toList(); expect(petIds, contains(id1)); @@ -216,14 +202,12 @@ void main() { final id = newId(); final newPet = makePet(id: id); // get some test data (recorded from live response) - final uploadResponse = - await File('test/file_upload_response.json').readAsString(); + final uploadResponse = await File('test/file_upload_response.json').readAsString(); // add a new pet petApi.apiClient.client = FakeClient( expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: - await petApi.apiClient.serializeAsync(newPet), + expectedPostRequestBody: await petApi.apiClient.serializeAsync(newPet), postResponseBody: await petApi.apiClient.serializeAsync(newPet), expectedHeaders: {'Content-Type': 'application/json'}); await petApi.addPet(newPet); @@ -232,9 +216,8 @@ void main() { expectedUrl: 'http://petstore.swagger.io/v2/pet', sendResponseBody: uploadResponse, ); - final file = - new MultipartFile.fromBytes('file', [104, 101, 108, 108, 111]); - await petApi.uploadFile(id, additionalMetadata: '', file: file); + final file = new MultipartFile.fromBytes('file', [104, 101, 108, 108, 111]); + await petApi.uploadFile(id, file: file); }); }); } diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/pet_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/pet_test.dart index 72126ba6a90..cbd26c68c7e 100644 --- a/samples/openapi3/client/petstore/dart2/petstore/test/pet_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore/test/pet_test.dart @@ -1,5 +1,4 @@ -import 'dart:async'; - +@Skip('Needs real petstore') import 'package:http/http.dart'; import 'package:openapi/api.dart'; import 'package:test/test.dart'; @@ -46,16 +45,14 @@ void main() { }); test('doesn\'t get non-existing pet by id', () { - expect(petApi.getPetById(newId()), - throwsA(equals(TypeMatcher()))); + expect(petApi.getPetById(newId()), throwsA(equals(TypeMatcher()))); }); test('deletes existing pet by id', () async { var id = newId(); await petApi.addPet(makePet(id: id)); await petApi.deletePet(id, apiKey: 'special-key'); - expect( - petApi.getPetById(id), throwsA(equals(TypeMatcher()))); + expect(petApi.getPetById(id), throwsA(equals(TypeMatcher()))); }); test('updates pet with form', () async { @@ -100,5 +97,5 @@ void main() { var file = new MultipartFile.fromBytes('file', [104, 101, 108, 108, 111]); await petApi.uploadFile(id, additionalMetadata: '', file: file); }); - }, skip: 'e2e tests for CI'); + }); } diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/random_id.dart b/samples/openapi3/client/petstore/dart2/petstore/test/random_id.dart index 0457428c7dd..ca67ac20993 100644 --- a/samples/openapi3/client/petstore/dart2/petstore/test/random_id.dart +++ b/samples/openapi3/client/petstore/dart2/petstore/test/random_id.dart @@ -4,4 +4,4 @@ final _random = new Random(); int newId() { return _random.nextInt(999999); -} \ No newline at end of file +} diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/store_faked_client_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/store_faked_client_test.dart index 9f75fd55d86..541d08b8c6a 100644 --- a/samples/openapi3/client/petstore/dart2/petstore/test/store_faked_client_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore/test/store_faked_client_test.dart @@ -21,62 +21,56 @@ void main() { group('Store API with faked client', () { test('places an order and gets it by id', () async { - // TODO: Please uncomment this after a content type of the petstore order in petstore.yaml is fixed. - // final id = newId(); - // final newOrder = makeOrder(id: id); + final id = newId(); + final newOrder = makeOrder(id: id); - // // use the store api to add an order - // storeApi.apiClient.client = FakeClient( - // expectedUrl: 'http://petstore.swagger.io/v2/store/order', - // expectedPostRequestBody: await storeApi.apiClient.serializeAsync(newOrder), - // postResponseBody: await storeApi.apiClient.serializeAsync(newOrder), - // expectedHeaders: {"Content-Type": "application/json"} - // ); - // await storeApi.placeOrder(newOrder); + // use the store api to add an order + storeApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/store/order', + expectedPostRequestBody: await storeApi.apiClient.serializeAsync(newOrder), + postResponseBody: await storeApi.apiClient.serializeAsync(newOrder), + expectedHeaders: {"Content-Type": "application/json"}); + await storeApi.placeOrder(newOrder); - // // retrieve the same order by id - // storeApi.apiClient.client = FakeClient( - // expectedUrl: 'http://petstore.swagger.io/v2/store/order/$id', - // getResponseBody: await storeApi.apiClient.serializeAsync(newOrder), - // ); - // final placedOrder = await storeApi.getOrderById(id); - // expect(placedOrder.id, equals(id)); + // retrieve the same order by id + storeApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/store/order/$id', + getResponseBody: await storeApi.apiClient.serializeAsync(newOrder), + ); + final placedOrder = await storeApi.getOrderById(id); + expect(placedOrder.id, equals(id)); }); test('deletes an order', () async { - // TODO: Please uncomment this after a content type of the petstore order in petstore.yaml is fixed. - // final id = newId(); - // final newOrder = makeOrder(id: id); + final id = newId(); + final newOrder = makeOrder(id: id); - // // use the store api to add an order - // storeApi.apiClient.client = FakeClient( - // expectedUrl: 'http://petstore.swagger.io/v2/store/order', - // expectedPostRequestBody: await storeApi.apiClient.serializeAsync(newOrder), - // postResponseBody: await storeApi.apiClient.serializeAsync(newOrder), - // expectedHeaders: {"Content-Type": "application/json"} - // ); - // await storeApi.placeOrder(newOrder); + // use the store api to add an order + storeApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/store/order', + expectedPostRequestBody: await storeApi.apiClient.serializeAsync(newOrder), + postResponseBody: await storeApi.apiClient.serializeAsync(newOrder), + expectedHeaders: {"Content-Type": "application/json"}); + await storeApi.placeOrder(newOrder); - // // delete the same order - // storeApi.apiClient.client = FakeClient( - // expectedUrl: 'http://petstore.swagger.io/v2/store/order/$id', - // deleteResponseBody: '', - // ); - // await storeApi.deleteOrder(id.toString()); + // delete the same order + storeApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/store/order/$id', + deleteResponseBody: '', + ); + await storeApi.deleteOrder(id.toString()); - // // try and retrieve the order - // storeApi.apiClient.client = FakeClient( - // expectedUrl: 'http://petstore.swagger.io/v2/store/order/$id', - // throwException: ApiException(400, 'Not found'), - // ); - // expect(storeApi.getOrderById(id), - // throwsA(equals(TypeMatcher()))); + // try and retrieve the order + storeApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/store/order/$id', + throwException: ApiException(400, 'Not found'), + ); + expect(storeApi.getOrderById(id), throwsA(equals(TypeMatcher()))); }); test('gets the store inventory', () async { // get some test data (recorded from live response) - final inventoryResponse = - await File('test/inventory_response.json').readAsString(); + final inventoryResponse = await File('test/inventory_response.json').readAsString(); // use the store api to get the inventory storeApi.apiClient.client = FakeClient( expectedUrl: 'http://petstore.swagger.io/v2/store/inventory', diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/store_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/store_test.dart index b2175238819..a5b19cd1de5 100644 --- a/samples/openapi3/client/petstore/dart2/petstore/test/store_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore/test/store_test.dart @@ -1,3 +1,4 @@ +@Skip('Needs real petstore') import 'package:openapi/api.dart'; import 'package:test/test.dart'; @@ -18,27 +19,24 @@ void main() { group('Store API with live client', () { test('places an order and gets it by id', () async { - // TODO: Please uncomment this after a content type of the petstore order in petstore.yaml is fixed. - // var id = newId(); + var id = newId(); - // await storeApi.placeOrder(makeOrder(id: id)); - // var order = await storeApi.getOrderById(id); - // expect(order.id, equals(id)); + await storeApi.placeOrder(makeOrder(id: id)); + var order = await storeApi.getOrderById(id); + expect(order.id, equals(id)); }); test('deletes an order', () async { - // TODO: Please uncomment this after a content type of the petstore order in petstore.yaml is fixed. - // var id = newId(); + var id = newId(); - // await storeApi.placeOrder(makeOrder(id: id)); - // await storeApi.deleteOrder(id.toString()); - // expect(storeApi.getOrderById(id), - // throwsA(equals(TypeMatcher()))); + await storeApi.placeOrder(makeOrder(id: id)); + await storeApi.deleteOrder(id.toString()); + expect(storeApi.getOrderById(id), throwsA(equals(TypeMatcher()))); }); test('gets the store inventory', () async { Map inventory = await storeApi.getInventory(); expect(inventory.length, isNot(equals(0))); }); - }); // , skip: 'e2e tests for CI' + }); } diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/user_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/user_test.dart index ea34b3713fa..d604363622d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore/test/user_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore/test/user_test.dart @@ -1,3 +1,4 @@ +@Skip('Needs real petstore') import 'package:openapi/api.dart'; import 'package:test/test.dart'; @@ -6,8 +7,7 @@ import 'random_id.dart'; void main() { var userApi = new UserApi(); - User makeUser( - {int id, String userName = 'username', String password = 'password'}) { + User makeUser({int id, String userName = 'username', String password = 'password'}) { return User() ..id = id ..username = userName @@ -63,8 +63,7 @@ void main() { var username = 'Riddlem325'; await userApi.createUser(makeUser(id: newId(), userName: username)); await userApi.deleteUser(username); - expect(userApi.getUserByName(username), - throwsA(TypeMatcher())); + expect(userApi.getUserByName(username), throwsA(TypeMatcher())); }); test('logs a user in', () async { @@ -76,5 +75,5 @@ void main() { var result = await userApi.loginUser(username, password); expect(result, contains('logged in user session:')); }); - }, skip: 'e2e tests for CI'); + }); } 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 2ec34d475e2..ee5c6f0d24c 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 @@ -41,17 +41,6 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['petstore_auth']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -118,17 +107,6 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['petstore_auth']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -187,17 +165,6 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['petstore_auth']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -265,17 +232,6 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['petstore_auth']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -342,17 +298,6 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['api_key']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -414,17 +359,6 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['petstore_auth']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -491,30 +425,11 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['petstore_auth']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (name != null) { - hasFields = true; - mp.fields[r'name'] = parameterToString(name); - } - if (status != null) { - hasFields = true; - mp.fields[r'status'] = parameterToString(status); - } - if (hasFields) { - postBody = mp; - } - } else { - if (name != null) { - formParams[r'name'] = parameterToString(name); - } - if (status != null) { - formParams[r'status'] = parameterToString(status); - } + if (name != null) { + formParams[r'name'] = parameterToString(name); + } + if (status != null) { + formParams[r'status'] = parameterToString(status); } return await apiClient.invokeAPI( @@ -581,28 +496,19 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['petstore_auth']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (additionalMetadata != null) { - hasFields = true; - mp.fields[r'additionalMetadata'] = parameterToString(additionalMetadata); - } - if (file != null) { - hasFields = true; - mp.fields[r'file'] = file.field; - mp.files.add(file); - } - if (hasFields) { - postBody = mp; - } - } else { - if (additionalMetadata != null) { - formParams[r'additionalMetadata'] = parameterToString(additionalMetadata); - } + bool hasFields = false; + final mp = MultipartRequest('POST', Uri.parse(path)); + if (additionalMetadata != null) { + hasFields = true; + mp.fields[r'additionalMetadata'] = parameterToString(additionalMetadata); + } + if (file != null) { + hasFields = true; + mp.fields[r'file'] = file.field; + mp.files.add(file); + } + if (hasFields) { + postBody = mp; } return await apiClient.invokeAPI( 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 9696bacc9de..4ff0cee3e1a 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 @@ -44,17 +44,6 @@ class StoreApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -101,17 +90,6 @@ class StoreApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['api_key']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -171,17 +149,6 @@ class StoreApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -243,17 +210,6 @@ class StoreApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, 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 fc19afb4e93..274b176291b 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 @@ -43,17 +43,6 @@ class UserApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['api_key']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -108,17 +97,6 @@ class UserApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['api_key']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -171,17 +149,6 @@ class UserApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['api_key']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -237,17 +204,6 @@ class UserApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['api_key']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -303,17 +259,6 @@ class UserApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -382,17 +327,6 @@ class UserApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -445,17 +379,6 @@ class UserApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['api_key']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -512,17 +435,6 @@ class UserApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['api_key']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, 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 c297f77a8a3..8f8b96abc53 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 @@ -43,17 +43,6 @@ class AnotherFakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, 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 1185af2521c..e811495110f 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 @@ -29,17 +29,6 @@ class DefaultApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, 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 20db8f0c9b0..95eb36aacdf 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 @@ -31,17 +31,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -110,17 +99,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['http_signature_test']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -176,17 +154,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -243,17 +210,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -310,17 +266,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -377,17 +322,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -447,17 +381,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -516,17 +439,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -581,17 +493,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -645,17 +546,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -767,112 +657,44 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['http_basic_test']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (integer != null) { - hasFields = true; - mp.fields[r'integer'] = parameterToString(integer); - } - if (int32 != null) { - hasFields = true; - mp.fields[r'int32'] = parameterToString(int32); - } - if (int64 != null) { - hasFields = true; - mp.fields[r'int64'] = parameterToString(int64); - } - if (number != null) { - hasFields = true; - mp.fields[r'number'] = parameterToString(number); - } - if (float != null) { - hasFields = true; - mp.fields[r'float'] = parameterToString(float); - } - if (double_ != null) { - hasFields = true; - mp.fields[r'double'] = parameterToString(double_); - } - if (string != null) { - hasFields = true; - mp.fields[r'string'] = parameterToString(string); - } - if (patternWithoutDelimiter != null) { - hasFields = true; - mp.fields[r'pattern_without_delimiter'] = parameterToString(patternWithoutDelimiter); - } - if (byte != null) { - hasFields = true; - mp.fields[r'byte'] = parameterToString(byte); - } - if (binary != null) { - hasFields = true; - mp.fields[r'binary'] = binary.field; - mp.files.add(binary); - } - if (date != null) { - hasFields = true; - mp.fields[r'date'] = parameterToString(date); - } - if (dateTime != null) { - hasFields = true; - mp.fields[r'dateTime'] = parameterToString(dateTime); - } - if (password != null) { - hasFields = true; - mp.fields[r'password'] = parameterToString(password); - } - if (callback != null) { - hasFields = true; - mp.fields[r'callback'] = parameterToString(callback); - } - if (hasFields) { - postBody = mp; - } - } else { - if (integer != null) { - formParams[r'integer'] = parameterToString(integer); - } - if (int32 != null) { - formParams[r'int32'] = parameterToString(int32); - } - if (int64 != null) { - formParams[r'int64'] = parameterToString(int64); - } - if (number != null) { - formParams[r'number'] = parameterToString(number); - } - if (float != null) { - formParams[r'float'] = parameterToString(float); - } - if (double_ != null) { - formParams[r'double'] = parameterToString(double_); - } - if (string != null) { - formParams[r'string'] = parameterToString(string); - } - if (patternWithoutDelimiter != null) { - formParams[r'pattern_without_delimiter'] = parameterToString(patternWithoutDelimiter); - } - if (byte != null) { - formParams[r'byte'] = parameterToString(byte); - } - if (date != null) { - formParams[r'date'] = parameterToString(date); - } - if (dateTime != null) { - formParams[r'dateTime'] = parameterToString(dateTime); - } - if (password != null) { - formParams[r'password'] = parameterToString(password); - } - if (callback != null) { - formParams[r'callback'] = parameterToString(callback); - } + if (integer != null) { + formParams[r'integer'] = parameterToString(integer); + } + if (int32 != null) { + formParams[r'int32'] = parameterToString(int32); + } + if (int64 != null) { + formParams[r'int64'] = parameterToString(int64); + } + if (number != null) { + formParams[r'number'] = parameterToString(number); + } + if (float != null) { + formParams[r'float'] = parameterToString(float); + } + if (double_ != null) { + formParams[r'double'] = parameterToString(double_); + } + if (string != null) { + formParams[r'string'] = parameterToString(string); + } + if (patternWithoutDelimiter != null) { + formParams[r'pattern_without_delimiter'] = parameterToString(patternWithoutDelimiter); + } + if (byte != null) { + formParams[r'byte'] = parameterToString(byte); + } + if (date != null) { + formParams[r'date'] = parameterToString(date); + } + if (dateTime != null) { + formParams[r'dateTime'] = parameterToString(dateTime); + } + if (password != null) { + formParams[r'password'] = parameterToString(password); + } + if (callback != null) { + formParams[r'callback'] = parameterToString(callback); } return await apiClient.invokeAPI( @@ -1007,30 +829,11 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (enumFormStringArray != null) { - hasFields = true; - mp.fields[r'enum_form_string_array'] = parameterToString(enumFormStringArray); - } - if (enumFormString != null) { - hasFields = true; - mp.fields[r'enum_form_string'] = parameterToString(enumFormString); - } - if (hasFields) { - postBody = mp; - } - } else { - if (enumFormStringArray != null) { - formParams[r'enum_form_string_array'] = parameterToString(enumFormStringArray); - } - if (enumFormString != null) { - formParams[r'enum_form_string'] = parameterToString(enumFormString); - } + if (enumFormStringArray != null) { + formParams[r'enum_form_string_array'] = parameterToString(enumFormStringArray); + } + if (enumFormString != null) { + formParams[r'enum_form_string'] = parameterToString(enumFormString); } return await apiClient.invokeAPI( @@ -1144,17 +947,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['bearer_test']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -1224,17 +1016,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -1293,30 +1074,11 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (param != null) { - hasFields = true; - mp.fields[r'param'] = parameterToString(param); - } - if (param2 != null) { - hasFields = true; - mp.fields[r'param2'] = parameterToString(param2); - } - if (hasFields) { - postBody = mp; - } - } else { - if (param != null) { - formParams[r'param'] = parameterToString(param); - } - if (param2 != null) { - formParams[r'param2'] = parameterToString(param2); - } + if (param != null) { + formParams[r'param'] = parameterToString(param); + } + if (param2 != null) { + formParams[r'param2'] = parameterToString(param2); } return await apiClient.invokeAPI( @@ -1398,17 +1160,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, 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 f7e337dbee5..79ec2cbed45 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 @@ -43,17 +43,6 @@ class FakeClassnameTags123Api { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['api_key_query']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, 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 af2215c4db7..50d001f61ce 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 @@ -41,17 +41,6 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['petstore_auth']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -111,17 +100,6 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['petstore_auth']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -180,17 +158,6 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['petstore_auth']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -258,17 +225,6 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['petstore_auth']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -335,17 +291,6 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['api_key']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -407,17 +352,6 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['petstore_auth']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -477,30 +411,11 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['petstore_auth']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (name != null) { - hasFields = true; - mp.fields[r'name'] = parameterToString(name); - } - if (status != null) { - hasFields = true; - mp.fields[r'status'] = parameterToString(status); - } - if (hasFields) { - postBody = mp; - } - } else { - if (name != null) { - formParams[r'name'] = parameterToString(name); - } - if (status != null) { - formParams[r'status'] = parameterToString(status); - } + if (name != null) { + formParams[r'name'] = parameterToString(name); + } + if (status != null) { + formParams[r'status'] = parameterToString(status); } return await apiClient.invokeAPI( @@ -567,28 +482,19 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['petstore_auth']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (additionalMetadata != null) { - hasFields = true; - mp.fields[r'additionalMetadata'] = parameterToString(additionalMetadata); - } - if (file != null) { - hasFields = true; - mp.fields[r'file'] = file.field; - mp.files.add(file); - } - if (hasFields) { - postBody = mp; - } - } else { - if (additionalMetadata != null) { - formParams[r'additionalMetadata'] = parameterToString(additionalMetadata); - } + bool hasFields = false; + final mp = MultipartRequest('POST', Uri.parse(path)); + if (additionalMetadata != null) { + hasFields = true; + mp.fields[r'additionalMetadata'] = parameterToString(additionalMetadata); + } + if (file != null) { + hasFields = true; + mp.fields[r'file'] = file.field; + mp.files.add(file); + } + if (hasFields) { + postBody = mp; } return await apiClient.invokeAPI( @@ -665,28 +571,19 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['petstore_auth']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (additionalMetadata != null) { - hasFields = true; - mp.fields[r'additionalMetadata'] = parameterToString(additionalMetadata); - } - if (requiredFile != null) { - hasFields = true; - mp.fields[r'requiredFile'] = requiredFile.field; - mp.files.add(requiredFile); - } - if (hasFields) { - postBody = mp; - } - } else { - if (additionalMetadata != null) { - formParams[r'additionalMetadata'] = parameterToString(additionalMetadata); - } + bool hasFields = false; + final mp = MultipartRequest('POST', Uri.parse(path)); + if (additionalMetadata != null) { + hasFields = true; + mp.fields[r'additionalMetadata'] = parameterToString(additionalMetadata); + } + if (requiredFile != null) { + hasFields = true; + mp.fields[r'requiredFile'] = requiredFile.field; + mp.files.add(requiredFile); + } + if (hasFields) { + postBody = mp; } return await apiClient.invokeAPI( 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 ea459d16052..08a73bb8fca 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 @@ -44,17 +44,6 @@ class StoreApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -101,17 +90,6 @@ class StoreApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['api_key']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -171,17 +149,6 @@ class StoreApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -243,17 +210,6 @@ class StoreApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, 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 0a2c54c75fe..d45509dcac5 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 @@ -43,17 +43,6 @@ class UserApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -108,17 +97,6 @@ class UserApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -171,17 +149,6 @@ class UserApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -237,17 +204,6 @@ class UserApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -303,17 +259,6 @@ class UserApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -382,17 +327,6 @@ class UserApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -445,17 +379,6 @@ class UserApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -512,17 +435,6 @@ class UserApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/another_fake_api.dart index b712431a035..f0115e6907b 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/another_fake_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/another_fake_api.dart @@ -43,17 +43,6 @@ class AnotherFakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/default_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/default_api.dart index 779bdec8b3a..182442cbd42 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/default_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/default_api.dart @@ -29,17 +29,6 @@ class DefaultApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_api.dart index edcd08cfa4a..2386fdfe4d5 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_api.dart @@ -31,17 +31,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -111,17 +100,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['http_signature_test']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -177,17 +155,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -245,17 +212,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -313,17 +269,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -381,17 +326,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -452,17 +386,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -522,17 +445,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -587,17 +499,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -651,17 +552,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -774,112 +664,44 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['http_basic_test']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (integer != null) { - hasFields = true; - mp.fields[r'integer'] = parameterToString(integer); - } - if (int32 != null) { - hasFields = true; - mp.fields[r'int32'] = parameterToString(int32); - } - if (int64 != null) { - hasFields = true; - mp.fields[r'int64'] = parameterToString(int64); - } - if (number != null) { - hasFields = true; - mp.fields[r'number'] = parameterToString(number); - } - if (float != null) { - hasFields = true; - mp.fields[r'float'] = parameterToString(float); - } - if (double_ != null) { - hasFields = true; - mp.fields[r'double'] = parameterToString(double_); - } - if (string != null) { - hasFields = true; - mp.fields[r'string'] = parameterToString(string); - } - if (patternWithoutDelimiter != null) { - hasFields = true; - mp.fields[r'pattern_without_delimiter'] = parameterToString(patternWithoutDelimiter); - } - if (byte != null) { - hasFields = true; - mp.fields[r'byte'] = parameterToString(byte); - } - if (binary != null) { - hasFields = true; - mp.fields[r'binary'] = binary.field; - mp.files.add(binary); - } - if (date != null) { - hasFields = true; - mp.fields[r'date'] = parameterToString(date); - } - if (dateTime != null) { - hasFields = true; - mp.fields[r'dateTime'] = parameterToString(dateTime); - } - if (password != null) { - hasFields = true; - mp.fields[r'password'] = parameterToString(password); - } - if (callback != null) { - hasFields = true; - mp.fields[r'callback'] = parameterToString(callback); - } - if (hasFields) { - postBody = mp; - } - } else { - if (integer != null) { - formParams[r'integer'] = parameterToString(integer); - } - if (int32 != null) { - formParams[r'int32'] = parameterToString(int32); - } - if (int64 != null) { - formParams[r'int64'] = parameterToString(int64); - } - if (number != null) { - formParams[r'number'] = parameterToString(number); - } - if (float != null) { - formParams[r'float'] = parameterToString(float); - } - if (double_ != null) { - formParams[r'double'] = parameterToString(double_); - } - if (string != null) { - formParams[r'string'] = parameterToString(string); - } - if (patternWithoutDelimiter != null) { - formParams[r'pattern_without_delimiter'] = parameterToString(patternWithoutDelimiter); - } - if (byte != null) { - formParams[r'byte'] = parameterToString(byte); - } - if (date != null) { - formParams[r'date'] = parameterToString(date); - } - if (dateTime != null) { - formParams[r'dateTime'] = parameterToString(dateTime); - } - if (password != null) { - formParams[r'password'] = parameterToString(password); - } - if (callback != null) { - formParams[r'callback'] = parameterToString(callback); - } + if (integer != null) { + formParams[r'integer'] = parameterToString(integer); + } + if (int32 != null) { + formParams[r'int32'] = parameterToString(int32); + } + if (int64 != null) { + formParams[r'int64'] = parameterToString(int64); + } + if (number != null) { + formParams[r'number'] = parameterToString(number); + } + if (float != null) { + formParams[r'float'] = parameterToString(float); + } + if (double_ != null) { + formParams[r'double'] = parameterToString(double_); + } + if (string != null) { + formParams[r'string'] = parameterToString(string); + } + if (patternWithoutDelimiter != null) { + formParams[r'pattern_without_delimiter'] = parameterToString(patternWithoutDelimiter); + } + if (byte != null) { + formParams[r'byte'] = parameterToString(byte); + } + if (date != null) { + formParams[r'date'] = parameterToString(date); + } + if (dateTime != null) { + formParams[r'dateTime'] = parameterToString(dateTime); + } + if (password != null) { + formParams[r'password'] = parameterToString(password); + } + if (callback != null) { + formParams[r'callback'] = parameterToString(callback); } return await apiClient.invokeAPI( @@ -1014,30 +836,11 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (enumFormStringArray != null) { - hasFields = true; - mp.fields[r'enum_form_string_array'] = parameterToString(enumFormStringArray); - } - if (enumFormString != null) { - hasFields = true; - mp.fields[r'enum_form_string'] = parameterToString(enumFormString); - } - if (hasFields) { - postBody = mp; - } - } else { - if (enumFormStringArray != null) { - formParams[r'enum_form_string_array'] = parameterToString(enumFormStringArray); - } - if (enumFormString != null) { - formParams[r'enum_form_string'] = parameterToString(enumFormString); - } + if (enumFormStringArray != null) { + formParams[r'enum_form_string_array'] = parameterToString(enumFormStringArray); + } + if (enumFormString != null) { + formParams[r'enum_form_string'] = parameterToString(enumFormString); } return await apiClient.invokeAPI( @@ -1151,17 +954,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['bearer_test']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -1231,17 +1023,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -1300,30 +1081,11 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (param != null) { - hasFields = true; - mp.fields[r'param'] = parameterToString(param); - } - if (param2 != null) { - hasFields = true; - mp.fields[r'param2'] = parameterToString(param2); - } - if (hasFields) { - postBody = mp; - } - } else { - if (param != null) { - formParams[r'param'] = parameterToString(param); - } - if (param2 != null) { - formParams[r'param2'] = parameterToString(param2); - } + if (param != null) { + formParams[r'param'] = parameterToString(param); + } + if (param2 != null) { + formParams[r'param2'] = parameterToString(param2); } return await apiClient.invokeAPI( @@ -1405,17 +1167,6 @@ class FakeApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_classname_tags123_api.dart index 49f4ce7cde2..c9fc34d194c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_classname_tags123_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_classname_tags123_api.dart @@ -43,17 +43,6 @@ class FakeClassnameTags123Api { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['api_key_query']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/pet_api.dart index cd2a65ab939..dec9efa15f7 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/pet_api.dart @@ -41,17 +41,6 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['petstore_auth']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -111,17 +100,6 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['petstore_auth']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -180,17 +158,6 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['petstore_auth']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -259,17 +226,6 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['petstore_auth']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -337,17 +293,6 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['api_key']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -410,17 +355,6 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['petstore_auth']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -480,30 +414,11 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['petstore_auth']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (name != null) { - hasFields = true; - mp.fields[r'name'] = parameterToString(name); - } - if (status != null) { - hasFields = true; - mp.fields[r'status'] = parameterToString(status); - } - if (hasFields) { - postBody = mp; - } - } else { - if (name != null) { - formParams[r'name'] = parameterToString(name); - } - if (status != null) { - formParams[r'status'] = parameterToString(status); - } + if (name != null) { + formParams[r'name'] = parameterToString(name); + } + if (status != null) { + formParams[r'status'] = parameterToString(status); } return await apiClient.invokeAPI( @@ -570,28 +485,19 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['petstore_auth']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (additionalMetadata != null) { - hasFields = true; - mp.fields[r'additionalMetadata'] = parameterToString(additionalMetadata); - } - if (file != null) { - hasFields = true; - mp.fields[r'file'] = file.field; - mp.files.add(file); - } - if (hasFields) { - postBody = mp; - } - } else { - if (additionalMetadata != null) { - formParams[r'additionalMetadata'] = parameterToString(additionalMetadata); - } + bool hasFields = false; + final mp = MultipartRequest('POST', Uri.parse(path)); + if (additionalMetadata != null) { + hasFields = true; + mp.fields[r'additionalMetadata'] = parameterToString(additionalMetadata); + } + if (file != null) { + hasFields = true; + mp.fields[r'file'] = file.field; + mp.files.add(file); + } + if (hasFields) { + postBody = mp; } return await apiClient.invokeAPI( @@ -669,28 +575,19 @@ class PetApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['petstore_auth']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (additionalMetadata != null) { - hasFields = true; - mp.fields[r'additionalMetadata'] = parameterToString(additionalMetadata); - } - if (requiredFile != null) { - hasFields = true; - mp.fields[r'requiredFile'] = requiredFile.field; - mp.files.add(requiredFile); - } - if (hasFields) { - postBody = mp; - } - } else { - if (additionalMetadata != null) { - formParams[r'additionalMetadata'] = parameterToString(additionalMetadata); - } + bool hasFields = false; + final mp = MultipartRequest('POST', Uri.parse(path)); + if (additionalMetadata != null) { + hasFields = true; + mp.fields[r'additionalMetadata'] = parameterToString(additionalMetadata); + } + if (requiredFile != null) { + hasFields = true; + mp.fields[r'requiredFile'] = requiredFile.field; + mp.files.add(requiredFile); + } + if (hasFields) { + postBody = mp; } return await apiClient.invokeAPI( diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/store_api.dart index 9e262c18b98..f7a67632d33 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/store_api.dart @@ -44,17 +44,6 @@ class StoreApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -101,17 +90,6 @@ class StoreApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['api_key']; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -172,17 +150,6 @@ class StoreApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -245,17 +212,6 @@ class StoreApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/user_api.dart index 3291afc2670..13e62586ac9 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/user_api.dart @@ -43,17 +43,6 @@ class UserApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -108,17 +97,6 @@ class UserApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -171,17 +149,6 @@ class UserApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -237,17 +204,6 @@ class UserApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -303,17 +259,6 @@ class UserApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -383,17 +328,6 @@ class UserApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -447,17 +381,6 @@ class UserApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, @@ -514,17 +437,6 @@ class UserApi { final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = []; - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } return await apiClient.invokeAPI( path, diff --git a/samples/server/petstore/go-echo-server/pom.xml b/samples/server/petstore/go-echo-server/pom.xml index df4dbbf4702..5e7f03d3842 100644 --- a/samples/server/petstore/go-echo-server/pom.xml +++ b/samples/server/petstore/go-echo-server/pom.xml @@ -35,7 +35,6 @@ go - go mod download