diff --git a/bin/dart-flutter-petstore.sh b/bin/dart-flutter-petstore.sh new file mode 100755 index 00000000000..ab4a0a5ff42 --- /dev/null +++ b/bin/dart-flutter-petstore.sh @@ -0,0 +1,50 @@ +#!/bin/sh + +SCRIPT="$0" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" + +if [ ! -f "$executable" ] +then + mvn clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" + +## Generate non-browserClient +#ags="$@ generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l dart -o samples/client/petstore/dart/swagger -DhideGenerationTimestamp=true -DbrowserClient=false" +# +## then options to generate the library for vm would be: +##ags="$@ generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l dart -o samples/client/petstore/dart/swagger_vm -DbrowserClient=false -DpubName=swagger_vm" +#java $JAVA_OPTS -jar $executable $ags +# +## Generate browserClient +#ags="$@ generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l dart -o samples/client/petstore/dart/swagger-browser-client -DhideGenerationTimestamp=true -DbrowserClient=true" +#java $JAVA_OPTS -jar $executable $ags + +# Generate non-browserClient and put it to the flutter sample app +ags="$@ generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l dart -o samples/client/petstore/dart/flutter_petstore/swagger -DhideGenerationTimestamp=true -DbrowserClient=false" +java $JAVA_OPTS -jar $executable $ags + +# There is a proposal to allow importing different libraries depending on the environment: +# https://github.com/munificent/dep-interface-libraries +# When this is implemented there will only be one library. + +# The current petstore test will then work for both: the browser library and the vm library. + diff --git a/modules/openapi-generator/src/main/resources/dart/api_doc.mustache b/modules/openapi-generator/src/main/resources/dart/api_doc.mustache index e723114f18c..c7c10a817a1 100644 --- a/modules/openapi-generator/src/main/resources/dart/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/dart/api_doc.mustache @@ -64,7 +64,7 @@ try { {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} -{{#allParams}} **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} +{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{baseType}}.md){{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} {{/allParams}} ### Return type diff --git a/samples/client/petstore/dart/flutter_petstore/swagger/README.md b/samples/client/petstore/dart/flutter_petstore/swagger/README.md index 2136cafdd5d..c7cf01ff3e4 100644 --- a/samples/client/petstore/dart/flutter_petstore/swagger/README.md +++ b/samples/client/petstore/dart/flutter_petstore/swagger/README.md @@ -4,7 +4,7 @@ This is a sample server Petstore server. You can find out more about Swagger at This Dart package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: - API version: 1.0.0 -- Build package: io.swagger.codegen.languages.DartClientCodegen +- Build package: org.openapitools.codegen.languages.DartClientCodegen ## Requirements @@ -47,10 +47,10 @@ import 'package:swagger/api.dart'; //swagger.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; var api_instance = new PetApi(); -var body = new Pet(); // Pet | Pet object that needs to be added to the store +var pet = new Pet(); // Pet | Pet object that needs to be added to the store try { - api_instance.addPet(body); + api_instance.addPet(pet); } catch (e) { print("Exception when calling PetApi->addPet: $e\n"); } @@ -59,7 +59,7 @@ try { ## Documentation for API Endpoints -All URIs are relative to *http://localhost/v2* +All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- diff --git a/samples/client/petstore/dart/flutter_petstore/swagger/docs/PetApi.md b/samples/client/petstore/dart/flutter_petstore/swagger/docs/PetApi.md index 6f353923e87..98fa465fcb2 100644 --- a/samples/client/petstore/dart/flutter_petstore/swagger/docs/PetApi.md +++ b/samples/client/petstore/dart/flutter_petstore/swagger/docs/PetApi.md @@ -5,7 +5,7 @@ import 'package:swagger/api.dart'; ``` -All URIs are relative to *http://localhost/v2* +All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- @@ -20,12 +20,10 @@ Method | HTTP request | Description # **addPet** -> addPet(body) +> addPet(pet) Add a new pet to the store - - ### Example ```dart import 'package:swagger/api.dart'; @@ -33,10 +31,10 @@ import 'package:swagger/api.dart'; //swagger.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; var api_instance = new PetApi(); -var body = new Pet(); // Pet | Pet object that needs to be added to the store +var pet = new Pet(); // Pet | Pet object that needs to be added to the store try { - api_instance.addPet(body); + api_instance.addPet(pet); } catch (e) { print("Exception when calling PetApi->addPet: $e\n"); } @@ -46,7 +44,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -59,7 +57,7 @@ void (empty response body) ### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: application/xml, application/json + - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -68,8 +66,6 @@ void (empty response body) Deletes a pet - - ### Example ```dart import 'package:swagger/api.dart'; @@ -105,7 +101,7 @@ void (empty response body) ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -247,12 +243,10 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **updatePet** -> updatePet(body) +> updatePet(pet) Update an existing pet - - ### Example ```dart import 'package:swagger/api.dart'; @@ -260,10 +254,10 @@ import 'package:swagger/api.dart'; //swagger.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; var api_instance = new PetApi(); -var body = new Pet(); // Pet | Pet object that needs to be added to the store +var pet = new Pet(); // Pet | Pet object that needs to be added to the store try { - api_instance.updatePet(body); + api_instance.updatePet(pet); } catch (e) { print("Exception when calling PetApi->updatePet: $e\n"); } @@ -273,7 +267,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -286,7 +280,7 @@ void (empty response body) ### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: application/xml, application/json + - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -295,8 +289,6 @@ void (empty response body) Updates a pet in the store with form data - - ### Example ```dart import 'package:swagger/api.dart'; @@ -334,7 +326,7 @@ void (empty response body) ### HTTP request headers - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: application/xml, application/json + - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -343,8 +335,6 @@ void (empty response body) uploads an image - - ### Example ```dart import 'package:swagger/api.dart'; @@ -354,7 +344,7 @@ import 'package:swagger/api.dart'; var api_instance = new PetApi(); var petId = 789; // int | ID of pet to update var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server -var file = /path/to/file.txt; // MultipartFile | file to upload +var file = BINARY_DATA_HERE; // MultipartFile | file to upload try { var result = api_instance.uploadFile(petId, additionalMetadata, file); diff --git a/samples/client/petstore/dart/flutter_petstore/swagger/docs/StoreApi.md b/samples/client/petstore/dart/flutter_petstore/swagger/docs/StoreApi.md index de492737ace..fff0d414bb9 100644 --- a/samples/client/petstore/dart/flutter_petstore/swagger/docs/StoreApi.md +++ b/samples/client/petstore/dart/flutter_petstore/swagger/docs/StoreApi.md @@ -5,7 +5,7 @@ import 'package:swagger/api.dart'; ``` -All URIs are relative to *http://localhost/v2* +All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- @@ -53,7 +53,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -144,21 +144,19 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **placeOrder** -> Order placeOrder(body) +> Order placeOrder(order) Place an order for a pet - - ### Example ```dart import 'package:swagger/api.dart'; var api_instance = new StoreApi(); -var body = new Order(); // Order | order placed for purchasing the pet +var order = new Order(); // Order | order placed for purchasing the pet try { - var result = api_instance.placeOrder(body); + var result = api_instance.placeOrder(order); print(result); } catch (e) { print("Exception when calling StoreApi->placeOrder: $e\n"); @@ -169,7 +167,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Order**](Order.md)| order placed for purchasing the pet | + **order** | [**Order**](Order.md)| order placed for purchasing the pet | ### Return type diff --git a/samples/client/petstore/dart/flutter_petstore/swagger/docs/UserApi.md b/samples/client/petstore/dart/flutter_petstore/swagger/docs/UserApi.md index 9b71d075453..8f593886e44 100644 --- a/samples/client/petstore/dart/flutter_petstore/swagger/docs/UserApi.md +++ b/samples/client/petstore/dart/flutter_petstore/swagger/docs/UserApi.md @@ -5,7 +5,7 @@ import 'package:swagger/api.dart'; ``` -All URIs are relative to *http://localhost/v2* +All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- @@ -20,7 +20,7 @@ Method | HTTP request | Description # **createUser** -> createUser(body) +> createUser(user) Create user @@ -31,10 +31,10 @@ This can only be done by the logged in user. import 'package:swagger/api.dart'; var api_instance = new UserApi(); -var body = new User(); // User | Created user object +var user = new User(); // User | Created user object try { - api_instance.createUser(body); + api_instance.createUser(user); } catch (e) { print("Exception when calling UserApi->createUser: $e\n"); } @@ -44,7 +44,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**User**](User.md)| Created user object | + **user** | [**User**](User.md)| Created user object | ### Return type @@ -57,26 +57,24 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **createUsersWithArrayInput** -> createUsersWithArrayInput(body) +> createUsersWithArrayInput(user) Creates list of users with given input array - - ### Example ```dart import 'package:swagger/api.dart'; var api_instance = new UserApi(); -var body = [new List<User>()]; // List | List of user object +var user = [new List<User>()]; // List | List of user object try { - api_instance.createUsersWithArrayInput(body); + api_instance.createUsersWithArrayInput(user); } catch (e) { print("Exception when calling UserApi->createUsersWithArrayInput: $e\n"); } @@ -86,7 +84,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](User.md)| List of user object | + **user** | [**List<User>**](List.md)| List of user object | ### Return type @@ -99,26 +97,24 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **createUsersWithListInput** -> createUsersWithListInput(body) +> createUsersWithListInput(user) Creates list of users with given input array - - ### Example ```dart import 'package:swagger/api.dart'; var api_instance = new UserApi(); -var body = [new List<User>()]; // List | List of user object +var user = [new List<User>()]; // List | List of user object try { - api_instance.createUsersWithListInput(body); + api_instance.createUsersWithListInput(user); } catch (e) { print("Exception when calling UserApi->createUsersWithListInput: $e\n"); } @@ -128,7 +124,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](User.md)| List of user object | + **user** | [**List<User>**](List.md)| List of user object | ### Return type @@ -141,7 +137,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -183,7 +179,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -192,8 +188,6 @@ No authorization required Get user by user name - - ### Example ```dart import 'package:swagger/api.dart'; @@ -235,8 +229,6 @@ No authorization required Logs user into the system - - ### Example ```dart import 'package:swagger/api.dart'; @@ -280,8 +272,6 @@ No authorization required Logs out current logged in user session - - ### Example ```dart import 'package:swagger/api.dart'; @@ -309,12 +299,12 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **updateUser** -> updateUser(username, body) +> updateUser(username, user) Updated user @@ -326,10 +316,10 @@ import 'package:swagger/api.dart'; var api_instance = new UserApi(); var username = username_example; // String | name that need to be deleted -var body = new User(); // User | Updated user object +var user = new User(); // User | Updated user object try { - api_instance.updateUser(username, body); + api_instance.updateUser(username, user); } catch (e) { print("Exception when calling UserApi->updateUser: $e\n"); } @@ -340,7 +330,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **String**| name that need to be deleted | - **body** | [**User**](User.md)| Updated user object | + **user** | [**User**](User.md)| Updated user object | ### Return type @@ -353,7 +343,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/dart/flutter_petstore/swagger/lib/api/pet_api.dart b/samples/client/petstore/dart/flutter_petstore/swagger/lib/api/pet_api.dart index 1d7c37382c7..9dc8167e5e1 100644 --- a/samples/client/petstore/dart/flutter_petstore/swagger/lib/api/pet_api.dart +++ b/samples/client/petstore/dart/flutter_petstore/swagger/lib/api/pet_api.dart @@ -10,12 +10,12 @@ class PetApi { /// Add a new pet to the store /// /// - Future addPet(Pet body) async { - Object postBody = body; + Future addPet(Pet pet) async { + Object postBody = pet; // verify required params are set - if(body == null) { - throw new ApiException(400, "Missing required param: body"); + if(pet == null) { + throw new ApiException(400, "Missing required param: pet"); } // create path and map variables @@ -34,12 +34,11 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) postBody = mp; } else { - } + } var response = await apiClient.invokeAPI(path, 'POST', @@ -86,12 +85,11 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) postBody = mp; } else { - } + } var response = await apiClient.invokeAPI(path, 'DELETE', @@ -128,7 +126,7 @@ class PetApi { List queryParams = []; Map headerParams = {}; Map formParams = {}; - queryParams.addAll(_convertParametersForCollectionFormat("csv", "status", status)); + queryParams.addAll(_convertParametersForCollectionFormat("", "status", status)); List contentTypes = []; @@ -138,12 +136,11 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) postBody = mp; } else { - } + } var response = await apiClient.invokeAPI(path, 'GET', @@ -180,7 +177,7 @@ class PetApi { List queryParams = []; Map headerParams = {}; Map formParams = {}; - queryParams.addAll(_convertParametersForCollectionFormat("csv", "tags", tags)); + queryParams.addAll(_convertParametersForCollectionFormat("", "tags", tags)); List contentTypes = []; @@ -190,12 +187,11 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) postBody = mp; } else { - } + } var response = await apiClient.invokeAPI(path, 'GET', @@ -241,12 +237,11 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) postBody = mp; } else { - } + } var response = await apiClient.invokeAPI(path, 'GET', @@ -268,12 +263,12 @@ class PetApi { /// Update an existing pet /// /// - Future updatePet(Pet body) async { - Object postBody = body; + Future updatePet(Pet pet) async { + Object postBody = pet; // verify required params are set - if(body == null) { - throw new ApiException(400, "Missing required param: body"); + if(pet == null) { + throw new ApiException(400, "Missing required param: pet"); } // create path and map variables @@ -292,12 +287,11 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) postBody = mp; } else { - } + } var response = await apiClient.invokeAPI(path, 'PUT', @@ -343,24 +337,21 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if (name != null) { hasFields = true; mp.fields['name'] = parameterToString(name); } - if (status != null) { hasFields = true; mp.fields['status'] = parameterToString(status); } - if(hasFields) postBody = mp; } else { if (name != null) formParams['name'] = parameterToString(name); -if (status != null) + if (status != null) formParams['status'] = parameterToString(status); } @@ -408,25 +399,21 @@ if (status != null) if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if (additionalMetadata != null) { hasFields = true; mp.fields['additionalMetadata'] = parameterToString(additionalMetadata); } - if (file != null) { hasFields = true; mp.fields['file'] = file.field; mp.files.add(file); } - if(hasFields) postBody = mp; } else { if (additionalMetadata != null) formParams['additionalMetadata'] = parameterToString(additionalMetadata); - } var response = await apiClient.invokeAPI(path, diff --git a/samples/client/petstore/dart/flutter_petstore/swagger/lib/api/store_api.dart b/samples/client/petstore/dart/flutter_petstore/swagger/lib/api/store_api.dart index 9b1c4d6b6e9..9ea2e32c19d 100644 --- a/samples/client/petstore/dart/flutter_petstore/swagger/lib/api/store_api.dart +++ b/samples/client/petstore/dart/flutter_petstore/swagger/lib/api/store_api.dart @@ -34,12 +34,11 @@ class StoreApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) postBody = mp; } else { - } + } var response = await apiClient.invokeAPI(path, 'DELETE', @@ -82,12 +81,11 @@ class StoreApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) postBody = mp; } else { - } + } var response = await apiClient.invokeAPI(path, 'GET', @@ -133,12 +131,11 @@ class StoreApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) postBody = mp; } else { - } + } var response = await apiClient.invokeAPI(path, 'GET', @@ -160,12 +157,12 @@ class StoreApi { /// Place an order for a pet /// /// - Future placeOrder(Order body) async { - Object postBody = body; + Future placeOrder(Order order) async { + Object postBody = order; // verify required params are set - if(body == null) { - throw new ApiException(400, "Missing required param: body"); + if(order == null) { + throw new ApiException(400, "Missing required param: order"); } // create path and map variables @@ -184,12 +181,11 @@ class StoreApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) postBody = mp; } else { - } + } var response = await apiClient.invokeAPI(path, 'POST', diff --git a/samples/client/petstore/dart/flutter_petstore/swagger/lib/api/user_api.dart b/samples/client/petstore/dart/flutter_petstore/swagger/lib/api/user_api.dart index 3632422fecd..13dc2ecdc10 100644 --- a/samples/client/petstore/dart/flutter_petstore/swagger/lib/api/user_api.dart +++ b/samples/client/petstore/dart/flutter_petstore/swagger/lib/api/user_api.dart @@ -10,12 +10,12 @@ class UserApi { /// Create user /// /// This can only be done by the logged in user. - Future createUser(User body) async { - Object postBody = body; + Future createUser(User user) async { + Object postBody = user; // verify required params are set - if(body == null) { - throw new ApiException(400, "Missing required param: body"); + if(user == null) { + throw new ApiException(400, "Missing required param: user"); } // create path and map variables @@ -34,12 +34,11 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) postBody = mp; } else { - } + } var response = await apiClient.invokeAPI(path, 'POST', @@ -61,12 +60,12 @@ class UserApi { /// Creates list of users with given input array /// /// - Future createUsersWithArrayInput(List body) async { - Object postBody = body; + Future createUsersWithArrayInput(List user) async { + Object postBody = user; // verify required params are set - if(body == null) { - throw new ApiException(400, "Missing required param: body"); + if(user == null) { + throw new ApiException(400, "Missing required param: user"); } // create path and map variables @@ -85,12 +84,11 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) postBody = mp; } else { - } + } var response = await apiClient.invokeAPI(path, 'POST', @@ -112,12 +110,12 @@ class UserApi { /// Creates list of users with given input array /// /// - Future createUsersWithListInput(List body) async { - Object postBody = body; + Future createUsersWithListInput(List user) async { + Object postBody = user; // verify required params are set - if(body == null) { - throw new ApiException(400, "Missing required param: body"); + if(user == null) { + throw new ApiException(400, "Missing required param: user"); } // create path and map variables @@ -136,12 +134,11 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) postBody = mp; } else { - } + } var response = await apiClient.invokeAPI(path, 'POST', @@ -187,12 +184,11 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) postBody = mp; } else { - } + } var response = await apiClient.invokeAPI(path, 'DELETE', @@ -238,12 +234,11 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) postBody = mp; } else { - } + } var response = await apiClient.invokeAPI(path, 'GET', @@ -294,12 +289,11 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) postBody = mp; } else { - } + } var response = await apiClient.invokeAPI(path, 'GET', @@ -342,12 +336,11 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) postBody = mp; } else { - } + } var response = await apiClient.invokeAPI(path, 'GET', @@ -369,15 +362,15 @@ class UserApi { /// Updated user /// /// This can only be done by the logged in user. - Future updateUser(String username, User body) async { - Object postBody = body; + Future updateUser(String username, User user) async { + Object postBody = user; // verify required params are set if(username == null) { throw new ApiException(400, "Missing required param: username"); } - if(body == null) { - throw new ApiException(400, "Missing required param: body"); + if(user == null) { + throw new ApiException(400, "Missing required param: user"); } // create path and map variables @@ -396,12 +389,11 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) postBody = mp; } else { - } + } var response = await apiClient.invokeAPI(path, 'PUT', diff --git a/samples/client/petstore/dart/flutter_petstore/swagger/lib/api_client.dart b/samples/client/petstore/dart/flutter_petstore/swagger/lib/api_client.dart index 4888f158f55..5ba2bb32f51 100644 --- a/samples/client/petstore/dart/flutter_petstore/swagger/lib/api_client.dart +++ b/samples/client/petstore/dart/flutter_petstore/swagger/lib/api_client.dart @@ -18,7 +18,7 @@ class ApiClient { final _RegList = new RegExp(r'^List<(.*)>$'); final _RegMap = new RegExp(r'^Map$'); - ApiClient({this.basePath: "http://localhost/v2"}) { + ApiClient({this.basePath: "http://petstore.swagger.io/v2"}) { // Setup authentications (key: authentication name, value: authentication). _authentications['api_key'] = new ApiKeyAuth("header", "api_key"); _authentications['petstore_auth'] = new OAuth(); diff --git a/samples/client/petstore/dart/swagger-browser-client/.openapi-generator/VERSION b/samples/client/petstore/dart/swagger-browser-client/.openapi-generator/VERSION index 855ff9501eb..096bf47efe3 100644 --- a/samples/client/petstore/dart/swagger-browser-client/.openapi-generator/VERSION +++ b/samples/client/petstore/dart/swagger-browser-client/.openapi-generator/VERSION @@ -1 +1 @@ -2.4.0-SNAPSHOT \ No newline at end of file +3.0.0-SNAPSHOT \ No newline at end of file