From 51b941cf88184524e9af18e48ce013696145d9ba Mon Sep 17 00:00:00 2001 From: ircecho Date: Fri, 4 Nov 2016 12:17:23 +0100 Subject: [PATCH] DART: Removed the 'justIgnoreThisFlag' flag (#4116) * feat[dart]: remove unused argument 'justIgnoreThisFlag' * chore[dart]: petstore rebuild --- .../src/main/resources/dart/api.mustache | 6 +-- .../options/DartClientOptionsProvider.java | 2 +- .../dart/swagger/lib/api/pet_api.dart | 48 ++++--------------- .../dart/swagger/lib/api/store_api.dart | 24 ++-------- .../dart/swagger/lib/api/user_api.dart | 48 ++++--------------- 5 files changed, 22 insertions(+), 106 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/dart/api.mustache b/modules/swagger-codegen/src/main/resources/dart/api.mustache index cff22ffecf9..aaa9d5db1f4 100644 --- a/modules/swagger-codegen/src/main/resources/dart/api.mustache +++ b/modules/swagger-codegen/src/main/resources/dart/api.mustache @@ -12,11 +12,7 @@ class {{classname}} { /// {{summary}} /// /// {{notes}} - {{#returnType}}Future<{{{returnType}}}> {{/returnType}}{{^returnType}}Future {{/returnType}}{{nickname}}({{#allParams}}{{#required}}{{{dataType}}} {{paramName}}, {{/required}}{{/allParams}} { {{#allParams}}{{^required}} {{{dataType}}} {{paramName}}, {{/required}}{{/allParams}} bool justIgnoreThisFlag: true}) async { - if (!justIgnoreThisFlag) { - print('Why??? Just trust me, I only need this variable inside the mustache codegen template.'); - // This code may be removed as soon as dart accepts trailing spaces (has already been implemented). - } + {{#returnType}}Future<{{{returnType}}}> {{/returnType}}{{^returnType}}Future {{/returnType}}{{nickname}}({{#allParams}}{{#required}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{ {{#allParams}}{{^required}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}} }{{/hasOptionalParams}}) async { Object postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; // verify required params are set diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/DartClientOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/DartClientOptionsProvider.java index 72066f54053..5560780eb96 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/DartClientOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/DartClientOptionsProvider.java @@ -8,7 +8,7 @@ import com.google.common.collect.ImmutableMap; import java.util.Map; public class DartClientOptionsProvider implements OptionsProvider { - public static final String SORT_PARAMS_VALUE = "false"; + public static final String SORT_PARAMS_VALUE = "true"; public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true"; public static final String BROWSER_CLIENT_VALUE = "true"; public static final String PUB_NAME_VALUE = "swagger"; diff --git a/samples/client/petstore/dart/swagger/lib/api/pet_api.dart b/samples/client/petstore/dart/swagger/lib/api/pet_api.dart index 45c203c51ef..961387012cc 100644 --- a/samples/client/petstore/dart/swagger/lib/api/pet_api.dart +++ b/samples/client/petstore/dart/swagger/lib/api/pet_api.dart @@ -10,11 +10,7 @@ class PetApi { /// Add a new pet to the store /// /// - Future addPet(Pet body, { bool justIgnoreThisFlag: true}) async { - if (!justIgnoreThisFlag) { - print('Why??? Just trust me, I only need this variable inside the mustache codegen template.'); - // This code may be removed as soon as dart accepts trailing spaces (has already been implemented). - } + Future addPet(Pet body) async { Object postBody = body; // verify required params are set @@ -65,11 +61,7 @@ class PetApi { /// Deletes a pet /// /// - Future deletePet(int petId, { String apiKey, bool justIgnoreThisFlag: true}) async { - if (!justIgnoreThisFlag) { - print('Why??? Just trust me, I only need this variable inside the mustache codegen template.'); - // This code may be removed as soon as dart accepts trailing spaces (has already been implemented). - } + Future deletePet(int petId, { String apiKey }) async { Object postBody = null; // verify required params are set @@ -121,11 +113,7 @@ class PetApi { /// Finds Pets by status /// /// Multiple status values can be provided with comma separated strings - Future> findPetsByStatus(List status, { bool justIgnoreThisFlag: true}) async { - if (!justIgnoreThisFlag) { - print('Why??? Just trust me, I only need this variable inside the mustache codegen template.'); - // This code may be removed as soon as dart accepts trailing spaces (has already been implemented). - } + Future> findPetsByStatus(List status) async { Object postBody = null; // verify required params are set @@ -177,11 +165,7 @@ class PetApi { /// Finds Pets by tags /// /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - Future> findPetsByTags(List tags, { bool justIgnoreThisFlag: true}) async { - if (!justIgnoreThisFlag) { - print('Why??? Just trust me, I only need this variable inside the mustache codegen template.'); - // This code may be removed as soon as dart accepts trailing spaces (has already been implemented). - } + Future> findPetsByTags(List tags) async { Object postBody = null; // verify required params are set @@ -233,11 +217,7 @@ class PetApi { /// Find pet by ID /// /// Returns a single pet - Future getPetById(int petId, { bool justIgnoreThisFlag: true}) async { - if (!justIgnoreThisFlag) { - print('Why??? Just trust me, I only need this variable inside the mustache codegen template.'); - // This code may be removed as soon as dart accepts trailing spaces (has already been implemented). - } + Future getPetById(int petId) async { Object postBody = null; // verify required params are set @@ -288,11 +268,7 @@ class PetApi { /// Update an existing pet /// /// - Future updatePet(Pet body, { bool justIgnoreThisFlag: true}) async { - if (!justIgnoreThisFlag) { - print('Why??? Just trust me, I only need this variable inside the mustache codegen template.'); - // This code may be removed as soon as dart accepts trailing spaces (has already been implemented). - } + Future updatePet(Pet body) async { Object postBody = body; // verify required params are set @@ -343,11 +319,7 @@ class PetApi { /// Updates a pet in the store with form data /// /// - Future updatePetWithForm(int petId, { String name, String status, bool justIgnoreThisFlag: true}) async { - if (!justIgnoreThisFlag) { - print('Why??? Just trust me, I only need this variable inside the mustache codegen template.'); - // This code may be removed as soon as dart accepts trailing spaces (has already been implemented). - } + Future updatePetWithForm(int petId, { String name, String status }) async { Object postBody = null; // verify required params are set @@ -412,11 +384,7 @@ if (status != null) /// uploads an image /// /// - Future uploadFile(int petId, { String additionalMetadata, MultipartFile file, bool justIgnoreThisFlag: true}) async { - if (!justIgnoreThisFlag) { - print('Why??? Just trust me, I only need this variable inside the mustache codegen template.'); - // This code may be removed as soon as dart accepts trailing spaces (has already been implemented). - } + Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async { Object postBody = null; // verify required params are set diff --git a/samples/client/petstore/dart/swagger/lib/api/store_api.dart b/samples/client/petstore/dart/swagger/lib/api/store_api.dart index a2bf1bb68b9..9b1c4d6b6e9 100644 --- a/samples/client/petstore/dart/swagger/lib/api/store_api.dart +++ b/samples/client/petstore/dart/swagger/lib/api/store_api.dart @@ -10,11 +10,7 @@ class StoreApi { /// Delete purchase order by ID /// /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - Future deleteOrder(String orderId, { bool justIgnoreThisFlag: true}) async { - if (!justIgnoreThisFlag) { - print('Why??? Just trust me, I only need this variable inside the mustache codegen template.'); - // This code may be removed as soon as dart accepts trailing spaces (has already been implemented). - } + Future deleteOrder(String orderId) async { Object postBody = null; // verify required params are set @@ -65,11 +61,7 @@ class StoreApi { /// Returns pet inventories by status /// /// Returns a map of status codes to quantities - Future> getInventory( { bool justIgnoreThisFlag: true}) async { - if (!justIgnoreThisFlag) { - print('Why??? Just trust me, I only need this variable inside the mustache codegen template.'); - // This code may be removed as soon as dart accepts trailing spaces (has already been implemented). - } + Future> getInventory() async { Object postBody = null; // verify required params are set @@ -117,11 +109,7 @@ class StoreApi { /// Find purchase order by ID /// /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - Future getOrderById(int orderId, { bool justIgnoreThisFlag: true}) async { - if (!justIgnoreThisFlag) { - print('Why??? Just trust me, I only need this variable inside the mustache codegen template.'); - // This code may be removed as soon as dart accepts trailing spaces (has already been implemented). - } + Future getOrderById(int orderId) async { Object postBody = null; // verify required params are set @@ -172,11 +160,7 @@ class StoreApi { /// Place an order for a pet /// /// - Future placeOrder(Order body, { bool justIgnoreThisFlag: true}) async { - if (!justIgnoreThisFlag) { - print('Why??? Just trust me, I only need this variable inside the mustache codegen template.'); - // This code may be removed as soon as dart accepts trailing spaces (has already been implemented). - } + Future placeOrder(Order body) async { Object postBody = body; // verify required params are set diff --git a/samples/client/petstore/dart/swagger/lib/api/user_api.dart b/samples/client/petstore/dart/swagger/lib/api/user_api.dart index 10fecbf80f0..3632422fecd 100644 --- a/samples/client/petstore/dart/swagger/lib/api/user_api.dart +++ b/samples/client/petstore/dart/swagger/lib/api/user_api.dart @@ -10,11 +10,7 @@ class UserApi { /// Create user /// /// This can only be done by the logged in user. - Future createUser(User body, { bool justIgnoreThisFlag: true}) async { - if (!justIgnoreThisFlag) { - print('Why??? Just trust me, I only need this variable inside the mustache codegen template.'); - // This code may be removed as soon as dart accepts trailing spaces (has already been implemented). - } + Future createUser(User body) async { Object postBody = body; // verify required params are set @@ -65,11 +61,7 @@ class UserApi { /// Creates list of users with given input array /// /// - Future createUsersWithArrayInput(List body, { bool justIgnoreThisFlag: true}) async { - if (!justIgnoreThisFlag) { - print('Why??? Just trust me, I only need this variable inside the mustache codegen template.'); - // This code may be removed as soon as dart accepts trailing spaces (has already been implemented). - } + Future createUsersWithArrayInput(List body) async { Object postBody = body; // verify required params are set @@ -120,11 +112,7 @@ class UserApi { /// Creates list of users with given input array /// /// - Future createUsersWithListInput(List body, { bool justIgnoreThisFlag: true}) async { - if (!justIgnoreThisFlag) { - print('Why??? Just trust me, I only need this variable inside the mustache codegen template.'); - // This code may be removed as soon as dart accepts trailing spaces (has already been implemented). - } + Future createUsersWithListInput(List body) async { Object postBody = body; // verify required params are set @@ -175,11 +163,7 @@ class UserApi { /// Delete user /// /// This can only be done by the logged in user. - Future deleteUser(String username, { bool justIgnoreThisFlag: true}) async { - if (!justIgnoreThisFlag) { - print('Why??? Just trust me, I only need this variable inside the mustache codegen template.'); - // This code may be removed as soon as dart accepts trailing spaces (has already been implemented). - } + Future deleteUser(String username) async { Object postBody = null; // verify required params are set @@ -230,11 +214,7 @@ class UserApi { /// Get user by user name /// /// - Future getUserByName(String username, { bool justIgnoreThisFlag: true}) async { - if (!justIgnoreThisFlag) { - print('Why??? Just trust me, I only need this variable inside the mustache codegen template.'); - // This code may be removed as soon as dart accepts trailing spaces (has already been implemented). - } + Future getUserByName(String username) async { Object postBody = null; // verify required params are set @@ -285,11 +265,7 @@ class UserApi { /// Logs user into the system /// /// - Future loginUser(String username, String password, { bool justIgnoreThisFlag: true}) async { - if (!justIgnoreThisFlag) { - print('Why??? Just trust me, I only need this variable inside the mustache codegen template.'); - // This code may be removed as soon as dart accepts trailing spaces (has already been implemented). - } + Future loginUser(String username, String password) async { Object postBody = null; // verify required params are set @@ -345,11 +321,7 @@ class UserApi { /// Logs out current logged in user session /// /// - Future logoutUser( { bool justIgnoreThisFlag: true}) async { - if (!justIgnoreThisFlag) { - print('Why??? Just trust me, I only need this variable inside the mustache codegen template.'); - // This code may be removed as soon as dart accepts trailing spaces (has already been implemented). - } + Future logoutUser() async { Object postBody = null; // verify required params are set @@ -397,11 +369,7 @@ class UserApi { /// Updated user /// /// This can only be done by the logged in user. - Future updateUser(String username, User body, { bool justIgnoreThisFlag: true}) async { - if (!justIgnoreThisFlag) { - print('Why??? Just trust me, I only need this variable inside the mustache codegen template.'); - // This code may be removed as soon as dart accepts trailing spaces (has already been implemented). - } + Future updateUser(String username, User body) async { Object postBody = body; // verify required params are set