diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java index 7b5654c7279..a45bac4fd2c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java @@ -21,23 +21,17 @@ import java.io.BufferedReader; import java.io.File; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import com.google.common.collect.Lists; import com.google.common.collect.Sets; +import io.swagger.v3.oas.models.Operation; +import io.swagger.v3.oas.models.media.StringSchema; +import io.swagger.v3.oas.models.servers.Server; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.StringUtils; -import org.openapitools.codegen.CliOption; -import org.openapitools.codegen.CodegenConstants; -import org.openapitools.codegen.CodegenType; -import org.openapitools.codegen.DefaultCodegen; -import org.openapitools.codegen.SupportingFile; +import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.ClientModificationFeature; import org.openapitools.codegen.meta.features.DocumentationFeature; import org.openapitools.codegen.meta.features.GlobalFeature; @@ -106,9 +100,6 @@ public class DartClientCodegen extends DefaultCodegen { ) ); - // clear import mapping (from default generator) as dart does not use it at the moment - importMapping.clear(); - outputFolder = "generated-code/dart"; modelTemplateFiles.put("model.mustache", ".dart"); apiTemplateFiles.put("api.mustache", ".dart"); @@ -174,8 +165,6 @@ public class DartClientCodegen extends DefaultCodegen { // These are needed as they prevent models from being generated // which would clash with existing types, e.g. List - // Importing dart:core doesn't hurt but a subclass may choose to skip - // dart:core imports. importMapping.put("dynamic", "dart:core"); importMapping.put("Object", "dart:core"); importMapping.put("String", "dart:core"); @@ -188,6 +177,8 @@ public class DartClientCodegen extends DefaultCodegen { importMapping.put("Set", "dart:core"); importMapping.put("DateTime", "dart:core"); + defaultIncludes = new HashSet<>(Collections.singletonList("dart:core")); + cliOptions.add(new CliOption(PUB_LIBRARY, "Library name in generated code")); cliOptions.add(new CliOption(PUB_NAME, "Name in generated pubspec")); cliOptions.add(new CliOption(PUB_VERSION, "Version in generated pubspec")); @@ -474,27 +465,38 @@ public class DartClientCodegen extends DefaultCodegen { @Override public String getTypeDeclaration(Schema p) { - if (ModelUtils.isArraySchema(p)) { - ArraySchema ap = (ArraySchema) p; - Schema inner = ap.getItems(); - return instantiationTypes().get("array") + "<" + getTypeDeclaration(inner) + ">"; - } else if (ModelUtils.isMapSchema(p)) { - Schema inner = getAdditionalProperties(p); - return instantiationTypes().get("map") + ""; + Schema schema = ModelUtils.unaliasSchema(this.openAPI, p, importMapping); + Schema target = ModelUtils.isGenerateAliasAsModel() ? p : schema; + if (ModelUtils.isArraySchema(target)) { + Schema items = getSchemaItems((ArraySchema) schema); + return getSchemaType(target) + "<" + getTypeDeclaration(items) + ">"; + } else if (ModelUtils.isMapSchema(target)) { + // Note: ModelUtils.isMapSchema(p) returns true when p is a composed schema that also defines + // additionalproperties: true + Schema inner = getAdditionalProperties(target); + if (inner == null) { + LOGGER.error("`{}` (map property) does not have a proper inner type defined. Default to type:string", p.getName()); + inner = new StringSchema().description("TODO default missing map inner type to string"); + p.setAdditionalProperties(inner); + } + return getSchemaType(target) + ""; } return super.getTypeDeclaration(p); } @Override public String getSchemaType(Schema p) { - String type = super.getSchemaType(p); - if (typeMapping.containsKey(type)) { - return typeMapping.get(type); + String openAPIType = super.getSchemaType(p); + if (openAPIType == null) { + LOGGER.error("No Type defined for Schema " + p); } - if (languageSpecificPrimitives.contains(type)) { - return type; + if (typeMapping.containsKey(openAPIType)) { + return typeMapping.get(openAPIType); } - return toModelName(type); + if (languageSpecificPrimitives.contains(openAPIType)) { + return openAPIType; + } + return toModelName(openAPIType); } @Override @@ -502,6 +504,23 @@ public class DartClientCodegen extends DefaultCodegen { return postProcessModelsEnum(objs); } + @Override + public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, List servers) { + final CodegenOperation op = super.fromOperation(path, httpMethod, operation, servers); + for (CodegenResponse r : op.responses) { + // By default only set types are automatically added to operation imports, not sure why. + // Add all container type imports here, by default 'dart:core' imports are skipped + // but other sub classes may required specific container type imports. + if (r.containerType != null && typeMapping().containsKey(r.containerType)) { + final String value = typeMapping().get(r.containerType); + if (needToImport(value)) { + op.imports.add(value); + } + } + } + return op; + } + @Override protected void updateEnumVarsWithExtensions(List> enumVars, Map vendorExtensions, String dataType) { if (vendorExtensions != null && useEnumExtension && vendorExtensions.containsKey("x-enum-values")) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java index 16cc7107139..0a400b9da13 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java @@ -37,7 +37,6 @@ import java.util.*; import io.swagger.v3.oas.models.media.Schema; -import static org.openapitools.codegen.utils.StringUtils.camelize; import static org.openapitools.codegen.utils.StringUtils.underscore; public class DartDioClientCodegen extends DartClientCodegen { @@ -67,9 +66,15 @@ public class DartDioClientCodegen extends DartClientCodegen { dateLibrary.setEnum(dateOptions); cliOptions.add(dateLibrary); + typeMapping.put("Array", "BuiltList"); + typeMapping.put("array", "BuiltList"); + typeMapping.put("List", "BuiltList"); + typeMapping.put("set", "BuiltSet"); + typeMapping.put("map", "BuiltMap"); typeMapping.put("file", "Uint8List"); typeMapping.put("binary", "Uint8List"); - typeMapping.put("AnyType", "Object"); + typeMapping.put("object", "JsonObject"); + typeMapping.put("AnyType", "JsonObject"); importMapping.put("BuiltList", "package:built_collection/built_collection.dart"); importMapping.put("BuiltSet", "package:built_collection/built_collection.dart"); @@ -261,7 +266,7 @@ public class DartDioClientCodegen extends DartClientCodegen { for (String modelImport : cm.imports) { if (importMapping().containsKey(modelImport)) { final String value = importMapping().get(modelImport); - if (!Objects.equals(value, "dart:core")) { + if (needToImport(value)) { modelImports.add(value); } } else { @@ -278,31 +283,11 @@ public class DartDioClientCodegen extends DartClientCodegen { @Override public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { + super.postProcessModelProperty(model, property); if (nullableFields) { property.isNullable = true; } - property.setDatatype(property.getDataType() - .replaceAll("\\bList\\b", "BuiltList") - .replaceAll("\\bMap\\b", "BuiltMap") - .replaceAll("\\bObject\\b", "JsonObject") - ); - property.setBaseType(property.getBaseType() - .replaceAll("\\bList\\b", "BuiltList") - .replaceAll("\\bMap\\b", "BuiltMap") - .replaceAll("\\bObject\\b", "JsonObject") - ); - - if (property.dataType.contains("BuiltList")) { - model.imports.add("BuiltList"); - } - if (property.dataType.contains("BuiltMap")) { - model.imports.add("BuiltMap"); - } - if (property.dataType.contains("JsonObject")) { - model.imports.add("JsonObject"); - } - if (property.isEnum) { // enums are generated with built_value and make use of BuiltSet model.imports.add("BuiltSet"); @@ -354,7 +339,7 @@ public class DartDioClientCodegen extends DartClientCodegen { for (String item : op.imports) { if (importMapping().containsKey(item)) { final String value = importMapping().get(item); - if (!Objects.equals(value, "dart:core")) { + if (needToImport(value)) { fullImports.add(value); } } else { diff --git a/modules/openapi-generator/src/main/resources/dart-dio/api.mustache b/modules/openapi-generator/src/main/resources/dart-dio/api.mustache index 6758f93825d..884dfb2fe56 100644 --- a/modules/openapi-generator/src/main/resources/dart-dio/api.mustache +++ b/modules/openapi-generator/src/main/resources/dart-dio/api.mustache @@ -2,7 +2,6 @@ import 'dart:async'; import 'dart:io'; import 'dart:convert'; import 'package:dio/dio.dart'; -import 'package:built_collection/built_collection.dart'; import 'package:built_value/serializer.dart'; {{#operations}} @@ -64,13 +63,13 @@ class {{classname}} { {{#bodyParam}} {{#isArray}} - final type = const FullType(BuiltList, const [const FullType({{baseType}})]); - var serializedBody = _serializers.serialize(BuiltList<{{baseType}}>.from({{paramName}}), specifiedType: type); + const type = FullType(BuiltList, [FullType({{baseType}})]); + final serializedBody = _serializers.serialize({{paramName}}, specifiedType: type); {{/isArray}} {{^isArray}} - var serializedBody = _serializers.serialize({{paramName}}); + final serializedBody = _serializers.serialize({{paramName}}); {{/isArray}} - var json{{paramName}} = json.encode(serializedBody); + final json{{paramName}} = json.encode(serializedBody); bodyData = json{{paramName}}; {{/bodyParam}} @@ -94,30 +93,25 @@ class {{classname}} { onReceiveProgress: onReceiveProgress, ){{#returnType}}.then((response) { - {{#returnTypeIsPrimitive}} - var data = response.data as {{{returnType}}}; - {{/returnTypeIsPrimitive}} - {{^returnTypeIsPrimitive}} {{#isResponseFile}} final data = response.data; {{/isResponseFile}} {{^isResponseFile}} - {{#isArray}} - final FullType type = const FullType(BuiltList, const [const FullType({{returnBaseType}})]); - final BuiltList<{{returnBaseType}}> dataList = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type); - final data = dataList.toList(); - {{/isArray}} - {{^isArray}} - {{#isMap}} - final serializer = _serializers.serializerForType(Map); - {{/isMap}} - {{^isMap}} - final serializer = _serializers.serializerForType({{{returnType}}}); - {{/isMap}} - final data = _serializers.deserializeWith<{{{returnType}}}>(serializer, response.data is String ? jsonDecode(response.data) : response.data); - {{/isArray}} - {{/isResponseFile}} + {{#returnSimpleType}} + {{#returnTypeIsPrimitive}} + final data = response.data as {{{returnType}}}; {{/returnTypeIsPrimitive}} + {{^returnTypeIsPrimitive}} + final serializer = _serializers.serializerForType({{{returnType}}}); + final data = _serializers.deserializeWith<{{{returnType}}}>(serializer, response.data is String ? jsonDecode(response.data) : response.data); + {{/returnTypeIsPrimitive}} + {{/returnSimpleType}} + {{^returnSimpleType}} + const collectionType = {{#isMap}}BuiltMap{{/isMap}}{{^isMap}}BuiltList{{/isMap}}; + const type = FullType(collectionType, [{{#isMap}}FullType(String), {{/isMap}}FullType({{{returnBaseType}}})]); + final {{{returnType}}} data = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type); + {{/returnSimpleType}} + {{/isResponseFile}} return Response<{{{returnType}}}>( data: data, diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/doc/PetApi.md b/samples/client/petstore/dart-dio/petstore_client_lib/doc/PetApi.md index e781974607c..47f6cef7a2d 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/doc/PetApi.md +++ b/samples/client/petstore/dart-dio/petstore_client_lib/doc/PetApi.md @@ -106,7 +106,7 @@ void (empty response body) [[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) # **findPetsByStatus** -> List findPetsByStatus(status) +> BuiltList findPetsByStatus(status) Finds Pets by status @@ -119,7 +119,7 @@ import 'package:openapi/api.dart'; //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; var api_instance = new PetApi(); -var status = []; // List | Status values that need to be considered for filter +var status = []; // BuiltList | Status values that need to be considered for filter try { var result = api_instance.findPetsByStatus(status); @@ -133,11 +133,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to const []] + **status** | [**BuiltList<String>**](String.md)| Status values that need to be considered for filter | [default to const []] ### Return type -[**List**](Pet.md) +[**BuiltList**](Pet.md) ### Authorization @@ -151,7 +151,7 @@ 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) # **findPetsByTags** -> List findPetsByTags(tags) +> BuiltList findPetsByTags(tags) Finds Pets by tags @@ -164,7 +164,7 @@ import 'package:openapi/api.dart'; //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; var api_instance = new PetApi(); -var tags = []; // List | Tags to filter by +var tags = []; // BuiltList | Tags to filter by try { var result = api_instance.findPetsByTags(tags); @@ -178,11 +178,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**List<String>**](String.md)| Tags to filter by | [default to const []] + **tags** | [**BuiltList<String>**](String.md)| Tags to filter by | [default to const []] ### Return type -[**List**](Pet.md) +[**BuiltList**](Pet.md) ### Authorization diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/doc/StoreApi.md b/samples/client/petstore/dart-dio/petstore_client_lib/doc/StoreApi.md index 33896baac9b..fac1bb187aa 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/doc/StoreApi.md +++ b/samples/client/petstore/dart-dio/petstore_client_lib/doc/StoreApi.md @@ -58,7 +58,7 @@ 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) # **getInventory** -> Map getInventory() +> BuiltMap getInventory() Returns pet inventories by status @@ -87,7 +87,7 @@ This endpoint does not need any parameter. ### Return type -**Map** +**BuiltMap** ### Authorization diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/doc/UserApi.md b/samples/client/petstore/dart-dio/petstore_client_lib/doc/UserApi.md index 052dc20aef7..de14cb998df 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/doc/UserApi.md +++ b/samples/client/petstore/dart-dio/petstore_client_lib/doc/UserApi.md @@ -71,7 +71,7 @@ Creates list of users with given input array import 'package:openapi/api.dart'; var api_instance = new UserApi(); -var body = [new List<User>()]; // List | List of user object +var body = [new BuiltList<User>()]; // BuiltList | List of user object try { api_instance.createUsersWithArrayInput(body); @@ -84,7 +84,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](User.md)| List of user object | + **body** | [**BuiltList<User>**](User.md)| List of user object | ### Return type @@ -111,7 +111,7 @@ Creates list of users with given input array import 'package:openapi/api.dart'; var api_instance = new UserApi(); -var body = [new List<User>()]; // List | List of user object +var body = [new BuiltList<User>()]; // BuiltList | List of user object try { api_instance.createUsersWithListInput(body); @@ -124,7 +124,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](User.md)| List of user object | + **body** | [**BuiltList<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart index aa095015f5a..5d3e4e37ac6 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart @@ -2,12 +2,12 @@ import 'dart:async'; import 'dart:io'; import 'dart:convert'; import 'package:dio/dio.dart'; -import 'package:built_collection/built_collection.dart'; import 'package:built_value/serializer.dart'; import 'package:openapi/model/pet.dart'; import 'package:openapi/model/api_response.dart'; import 'dart:typed_data'; +import 'package:built_collection/built_collection.dart'; import 'package:openapi/api_util.dart'; class PetApi { @@ -33,8 +33,8 @@ class PetApi { List contentTypes = ["application/json","application/xml"]; - var serializedBody = _serializers.serialize(body); - var jsonbody = json.encode(serializedBody); + final serializedBody = _serializers.serialize(body); + final jsonbody = json.encode(serializedBody); bodyData = jsonbody; return _dio.request( @@ -93,7 +93,7 @@ class PetApi { /// Finds Pets by status /// /// Multiple status values can be provided with comma separated strings - Future>>findPetsByStatus(List status,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + Future>>findPetsByStatus(BuiltList status,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { String _path = "/pet/findByStatus"; @@ -126,11 +126,11 @@ class PetApi { onReceiveProgress: onReceiveProgress, ).then((response) { - final FullType type = const FullType(BuiltList, const [const FullType(Pet)]); - final BuiltList dataList = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type); - final data = dataList.toList(); + const collectionType = BuiltList; + const type = FullType(collectionType, [FullType(Pet)]); + final BuiltList data = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type); - return Response>( + return Response>( data: data, headers: response.headers, request: response.request, @@ -144,7 +144,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,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + Future>>findPetsByTags(BuiltList tags,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { String _path = "/pet/findByTags"; @@ -177,11 +177,11 @@ class PetApi { onReceiveProgress: onReceiveProgress, ).then((response) { - final FullType type = const FullType(BuiltList, const [const FullType(Pet)]); - final BuiltList dataList = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type); - final data = dataList.toList(); + const collectionType = BuiltList; + const type = FullType(collectionType, [FullType(Pet)]); + final BuiltList data = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type); - return Response>( + return Response>( data: data, headers: response.headers, request: response.request, @@ -258,8 +258,8 @@ class PetApi { List contentTypes = ["application/json","application/xml"]; - var serializedBody = _serializers.serialize(body); - var jsonbody = json.encode(serializedBody); + final serializedBody = _serializers.serialize(body); + final jsonbody = json.encode(serializedBody); bodyData = jsonbody; return _dio.request( diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart index 5aa5f69da51..d7ae685d211 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart @@ -2,10 +2,10 @@ import 'dart:async'; import 'dart:io'; import 'dart:convert'; import 'package:dio/dio.dart'; -import 'package:built_collection/built_collection.dart'; import 'package:built_value/serializer.dart'; import 'package:openapi/model/order.dart'; +import 'package:built_collection/built_collection.dart'; class StoreApi { final Dio _dio; @@ -51,7 +51,7 @@ class StoreApi { /// Returns pet inventories by status /// /// Returns a map of status codes to quantities - Future>>getInventory({ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + Future>>getInventory({ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { String _path = "/store/inventory"; @@ -83,9 +83,11 @@ class StoreApi { onReceiveProgress: onReceiveProgress, ).then((response) { - var data = response.data as Map; + const collectionType = BuiltMap; + const type = FullType(collectionType, [FullType(String), FullType(int)]); + final BuiltMap data = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type); - return Response>( + return Response>( data: data, headers: response.headers, request: response.request, @@ -162,8 +164,8 @@ class StoreApi { List contentTypes = []; - var serializedBody = _serializers.serialize(body); - var jsonbody = json.encode(serializedBody); + final serializedBody = _serializers.serialize(body); + final jsonbody = json.encode(serializedBody); bodyData = jsonbody; return _dio.request( diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart index eb7a6b4bdde..20406454ed8 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart @@ -2,10 +2,10 @@ import 'dart:async'; import 'dart:io'; import 'dart:convert'; import 'package:dio/dio.dart'; -import 'package:built_collection/built_collection.dart'; import 'package:built_value/serializer.dart'; import 'package:openapi/model/user.dart'; +import 'package:built_collection/built_collection.dart'; class UserApi { final Dio _dio; @@ -30,8 +30,8 @@ class UserApi { List contentTypes = []; - var serializedBody = _serializers.serialize(body); - var jsonbody = json.encode(serializedBody); + final serializedBody = _serializers.serialize(body); + final jsonbody = json.encode(serializedBody); bodyData = jsonbody; return _dio.request( @@ -54,7 +54,7 @@ class UserApi { /// Creates list of users with given input array /// /// - FuturecreateUsersWithArrayInput(List body,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + FuturecreateUsersWithArrayInput(BuiltList body,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { String _path = "/user/createWithArray"; @@ -68,9 +68,9 @@ class UserApi { List contentTypes = []; - final type = const FullType(BuiltList, const [const FullType(User)]); - var serializedBody = _serializers.serialize(BuiltList.from(body), specifiedType: type); - var jsonbody = json.encode(serializedBody); + const type = FullType(BuiltList, [FullType(User)]); + final serializedBody = _serializers.serialize(body, specifiedType: type); + final jsonbody = json.encode(serializedBody); bodyData = jsonbody; return _dio.request( @@ -93,7 +93,7 @@ class UserApi { /// Creates list of users with given input array /// /// - FuturecreateUsersWithListInput(List body,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + FuturecreateUsersWithListInput(BuiltList body,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { String _path = "/user/createWithList"; @@ -107,9 +107,9 @@ class UserApi { List contentTypes = []; - final type = const FullType(BuiltList, const [const FullType(User)]); - var serializedBody = _serializers.serialize(BuiltList.from(body), specifiedType: type); - var jsonbody = json.encode(serializedBody); + const type = FullType(BuiltList, [FullType(User)]); + final serializedBody = _serializers.serialize(body, specifiedType: type); + final jsonbody = json.encode(serializedBody); bodyData = jsonbody; return _dio.request( @@ -250,7 +250,7 @@ class UserApi { onReceiveProgress: onReceiveProgress, ).then((response) { - var data = response.data as String; + final data = response.data as String; return Response( data: data, @@ -315,8 +315,8 @@ class UserApi { List contentTypes = []; - var serializedBody = _serializers.serialize(body); - var jsonbody = json.encode(serializedBody); + final serializedBody = _serializers.serialize(body); + final jsonbody = json.encode(serializedBody); bodyData = jsonbody; return _dio.request( diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/test/pet_api_test.dart b/samples/client/petstore/dart-dio/petstore_client_lib/test/pet_api_test.dart index 96c8b9e1c1a..df04da6a5e9 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/test/pet_api_test.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/test/pet_api_test.dart @@ -26,7 +26,7 @@ void main() { // // Multiple status values can be provided with comma separated strings // - //Future> findPetsByStatus(List status) async + //Future> findPetsByStatus(BuiltList status) async test('test findPetsByStatus', () async { // TODO }); @@ -35,7 +35,7 @@ void main() { // // Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. // - //Future> findPetsByTags(List tags) async + //Future> findPetsByTags(BuiltList tags) async test('test findPetsByTags', () async { // TODO }); diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/test/store_api_test.dart b/samples/client/petstore/dart-dio/petstore_client_lib/test/store_api_test.dart index 92d2ff0f5b6..77c6c9d160e 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/test/store_api_test.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/test/store_api_test.dart @@ -21,7 +21,7 @@ void main() { // // Returns a map of status codes to quantities // - //Future> getInventory() async + //Future> getInventory() async test('test getInventory', () async { // TODO }); diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/test/user_api_test.dart b/samples/client/petstore/dart-dio/petstore_client_lib/test/user_api_test.dart index 618e8a94f89..d3eeaf68ee4 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/test/user_api_test.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/test/user_api_test.dart @@ -19,14 +19,14 @@ void main() { // Creates list of users with given input array // - //Future createUsersWithArrayInput(List body) async + //Future createUsersWithArrayInput(BuiltList body) async test('test createUsersWithArrayInput', () async { // TODO }); // Creates list of users with given input array // - //Future createUsersWithListInput(List body) async + //Future createUsersWithListInput(BuiltList body) async test('test createUsersWithListInput', () async { // TODO }); diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/PetApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/PetApi.md index 0119bd4fa41..b8185134f3d 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/PetApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/PetApi.md @@ -107,7 +107,7 @@ void (empty response body) [[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) # **findPetsByStatus** -> List findPetsByStatus(status) +> BuiltList findPetsByStatus(status) Finds Pets by status @@ -120,7 +120,7 @@ import 'package:openapi/api.dart'; //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; var api_instance = new PetApi(); -var status = []; // List | Status values that need to be considered for filter +var status = []; // BuiltList | Status values that need to be considered for filter try { var result = api_instance.findPetsByStatus(status); @@ -134,11 +134,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to const []] + **status** | [**BuiltList<String>**](String.md)| Status values that need to be considered for filter | [default to const []] ### Return type -[**List**](Pet.md) +[**BuiltList**](Pet.md) ### Authorization @@ -152,7 +152,7 @@ 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) # **findPetsByTags** -> List findPetsByTags(tags) +> BuiltList findPetsByTags(tags) Finds Pets by tags @@ -165,7 +165,7 @@ import 'package:openapi/api.dart'; //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; var api_instance = new PetApi(); -var tags = []; // List | Tags to filter by +var tags = []; // BuiltList | Tags to filter by try { var result = api_instance.findPetsByTags(tags); @@ -179,11 +179,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**List<String>**](String.md)| Tags to filter by | [default to const []] + **tags** | [**BuiltList<String>**](String.md)| Tags to filter by | [default to const []] ### Return type -[**List**](Pet.md) +[**BuiltList**](Pet.md) ### Authorization diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/StoreApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/StoreApi.md index ff948b30a44..4755ee09e69 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/StoreApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/StoreApi.md @@ -58,7 +58,7 @@ 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) # **getInventory** -> Map getInventory() +> BuiltMap getInventory() Returns pet inventories by status @@ -87,7 +87,7 @@ This endpoint does not need any parameter. ### Return type -**Map** +**BuiltMap** ### Authorization diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/UserApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/UserApi.md index 08348d54d24..dfedf9d9e36 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/UserApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/UserApi.md @@ -79,7 +79,7 @@ import 'package:openapi/api.dart'; //defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; var api_instance = new UserApi(); -var user = [new List<User>()]; // List | List of user object +var user = [new BuiltList<User>()]; // BuiltList | List of user object try { api_instance.createUsersWithArrayInput(user); @@ -92,7 +92,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**List<User>**](User.md)| List of user object | + **user** | [**BuiltList<User>**](User.md)| List of user object | ### Return type @@ -123,7 +123,7 @@ import 'package:openapi/api.dart'; //defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; var api_instance = new UserApi(); -var user = [new List<User>()]; // List | List of user object +var user = [new BuiltList<User>()]; // BuiltList | List of user object try { api_instance.createUsersWithListInput(user); @@ -136,7 +136,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**List<User>**](User.md)| List of user object | + **user** | [**BuiltList<User>**](User.md)| List of user object | ### Return type diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart index 9f438379d67..28c906b775a 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart @@ -2,12 +2,12 @@ import 'dart:async'; import 'dart:io'; import 'dart:convert'; import 'package:dio/dio.dart'; -import 'package:built_collection/built_collection.dart'; import 'package:built_value/serializer.dart'; import 'package:openapi/model/pet.dart'; import 'package:openapi/model/api_response.dart'; import 'dart:typed_data'; +import 'package:built_collection/built_collection.dart'; import 'package:openapi/api_util.dart'; class PetApi { @@ -33,8 +33,8 @@ class PetApi { List contentTypes = ["application/json","application/xml"]; - var serializedBody = _serializers.serialize(pet); - var jsonpet = json.encode(serializedBody); + final serializedBody = _serializers.serialize(pet); + final jsonpet = json.encode(serializedBody); bodyData = jsonpet; return _dio.request( @@ -107,7 +107,7 @@ class PetApi { /// Finds Pets by status /// /// Multiple status values can be provided with comma separated strings - Future>>findPetsByStatus(List status,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + Future>>findPetsByStatus(BuiltList status,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { String _path = "/pet/findByStatus"; @@ -140,11 +140,11 @@ class PetApi { onReceiveProgress: onReceiveProgress, ).then((response) { - final FullType type = const FullType(BuiltList, const [const FullType(Pet)]); - final BuiltList dataList = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type); - final data = dataList.toList(); + const collectionType = BuiltList; + const type = FullType(collectionType, [FullType(Pet)]); + final BuiltList data = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type); - return Response>( + return Response>( data: data, headers: response.headers, request: response.request, @@ -158,7 +158,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,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + Future>>findPetsByTags(BuiltList tags,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { String _path = "/pet/findByTags"; @@ -191,11 +191,11 @@ class PetApi { onReceiveProgress: onReceiveProgress, ).then((response) { - final FullType type = const FullType(BuiltList, const [const FullType(Pet)]); - final BuiltList dataList = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type); - final data = dataList.toList(); + const collectionType = BuiltList; + const type = FullType(collectionType, [FullType(Pet)]); + final BuiltList data = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type); - return Response>( + return Response>( data: data, headers: response.headers, request: response.request, @@ -272,8 +272,8 @@ class PetApi { List contentTypes = ["application/json","application/xml"]; - var serializedBody = _serializers.serialize(pet); - var jsonpet = json.encode(serializedBody); + final serializedBody = _serializers.serialize(pet); + final jsonpet = json.encode(serializedBody); bodyData = jsonpet; return _dio.request( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart index a821b9ff078..bbb101e8235 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart @@ -2,10 +2,10 @@ import 'dart:async'; import 'dart:io'; import 'dart:convert'; import 'package:dio/dio.dart'; -import 'package:built_collection/built_collection.dart'; import 'package:built_value/serializer.dart'; import 'package:openapi/model/order.dart'; +import 'package:built_collection/built_collection.dart'; class StoreApi { final Dio _dio; @@ -51,7 +51,7 @@ class StoreApi { /// Returns pet inventories by status /// /// Returns a map of status codes to quantities - Future>>getInventory({ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + Future>>getInventory({ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { String _path = "/store/inventory"; @@ -83,9 +83,11 @@ class StoreApi { onReceiveProgress: onReceiveProgress, ).then((response) { - var data = response.data as Map; + const collectionType = BuiltMap; + const type = FullType(collectionType, [FullType(String), FullType(int)]); + final BuiltMap data = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type); - return Response>( + return Response>( data: data, headers: response.headers, request: response.request, @@ -162,8 +164,8 @@ class StoreApi { List contentTypes = ["application/json"]; - var serializedBody = _serializers.serialize(order); - var jsonorder = json.encode(serializedBody); + final serializedBody = _serializers.serialize(order); + final jsonorder = json.encode(serializedBody); bodyData = jsonorder; return _dio.request( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart index 07a794a48f4..e2801bcd924 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart @@ -2,10 +2,10 @@ import 'dart:async'; import 'dart:io'; import 'dart:convert'; import 'package:dio/dio.dart'; -import 'package:built_collection/built_collection.dart'; import 'package:built_value/serializer.dart'; import 'package:openapi/model/user.dart'; +import 'package:built_collection/built_collection.dart'; class UserApi { final Dio _dio; @@ -30,8 +30,8 @@ class UserApi { List contentTypes = ["application/json"]; - var serializedBody = _serializers.serialize(user); - var jsonuser = json.encode(serializedBody); + final serializedBody = _serializers.serialize(user); + final jsonuser = json.encode(serializedBody); bodyData = jsonuser; return _dio.request( @@ -54,7 +54,7 @@ class UserApi { /// Creates list of users with given input array /// /// - FuturecreateUsersWithArrayInput(List user,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + FuturecreateUsersWithArrayInput(BuiltList user,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { String _path = "/user/createWithArray"; @@ -68,9 +68,9 @@ class UserApi { List contentTypes = ["application/json"]; - final type = const FullType(BuiltList, const [const FullType(User)]); - var serializedBody = _serializers.serialize(BuiltList.from(user), specifiedType: type); - var jsonuser = json.encode(serializedBody); + const type = FullType(BuiltList, [FullType(User)]); + final serializedBody = _serializers.serialize(user, specifiedType: type); + final jsonuser = json.encode(serializedBody); bodyData = jsonuser; return _dio.request( @@ -93,7 +93,7 @@ class UserApi { /// Creates list of users with given input array /// /// - FuturecreateUsersWithListInput(List user,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + FuturecreateUsersWithListInput(BuiltList user,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { String _path = "/user/createWithList"; @@ -107,9 +107,9 @@ class UserApi { List contentTypes = ["application/json"]; - final type = const FullType(BuiltList, const [const FullType(User)]); - var serializedBody = _serializers.serialize(BuiltList.from(user), specifiedType: type); - var jsonuser = json.encode(serializedBody); + const type = FullType(BuiltList, [FullType(User)]); + final serializedBody = _serializers.serialize(user, specifiedType: type); + final jsonuser = json.encode(serializedBody); bodyData = jsonuser; return _dio.request( @@ -250,7 +250,7 @@ class UserApi { onReceiveProgress: onReceiveProgress, ).then((response) { - var data = response.data as String; + final data = response.data as String; return Response( data: data, @@ -315,8 +315,8 @@ class UserApi { List contentTypes = ["application/json"]; - var serializedBody = _serializers.serialize(user); - var jsonuser = json.encode(serializedBody); + final serializedBody = _serializers.serialize(user); + final jsonuser = json.encode(serializedBody); bodyData = jsonuser; return _dio.request( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/pet_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/pet_api_test.dart index 4cd22a598c1..bdbdcfc07aa 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/pet_api_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/pet_api_test.dart @@ -26,7 +26,7 @@ void main() { // // Multiple status values can be provided with comma separated strings // - //Future> findPetsByStatus(List status) async + //Future> findPetsByStatus(BuiltList status) async test('test findPetsByStatus', () async { // TODO }); @@ -35,7 +35,7 @@ void main() { // // Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. // - //Future> findPetsByTags(List tags) async + //Future> findPetsByTags(BuiltList tags) async test('test findPetsByTags', () async { // TODO }); diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/store_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/store_api_test.dart index ae64309d973..27854e9d9cf 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/store_api_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/store_api_test.dart @@ -21,7 +21,7 @@ void main() { // // Returns a map of status codes to quantities // - //Future> getInventory() async + //Future> getInventory() async test('test getInventory', () async { // TODO }); diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/user_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/user_api_test.dart index 9377f97e3c3..b202f3662c4 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/user_api_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/user_api_test.dart @@ -19,14 +19,14 @@ void main() { // Creates list of users with given input array // - //Future createUsersWithArrayInput(List user) async + //Future createUsersWithArrayInput(BuiltList user) async test('test createUsersWithArrayInput', () async { // TODO }); // Creates list of users with given input array // - //Future createUsersWithListInput(List user) async + //Future createUsersWithListInput(BuiltList user) async test('test createUsersWithListInput', () async { // TODO }); diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/AdditionalPropertiesClass.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/AdditionalPropertiesClass.md index 4f473ed345b..3371005bbd5 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/AdditionalPropertiesClass.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/AdditionalPropertiesClass.md @@ -9,7 +9,7 @@ import 'package:openapi/api.dart'; Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **mapProperty** | **BuiltMap<String, String>** | | [optional] [default to const {}] -**mapOfMapProperty** | [**BuiltMap<String, BuiltMap<String, String>>**](Map.md) | | [optional] [default to const {}] +**mapOfMapProperty** | [**BuiltMap<String, BuiltMap<String, String>>**](BuiltMap.md) | | [optional] [default to const {}] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ArrayOfArrayOfNumberOnly.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ArrayOfArrayOfNumberOnly.md index 49cf42af14f..e378f671ea1 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ArrayOfArrayOfNumberOnly.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ArrayOfArrayOfNumberOnly.md @@ -8,7 +8,7 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**arrayArrayNumber** | [**BuiltList<BuiltList<num>>**](List.md) | | [optional] [default to const []] +**arrayArrayNumber** | [**BuiltList<BuiltList<num>>**](BuiltList.md) | | [optional] [default to const []] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ArrayTest.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ArrayTest.md index db2cd4c9523..3cc123045e8 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ArrayTest.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ArrayTest.md @@ -9,8 +9,8 @@ import 'package:openapi/api.dart'; Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **arrayOfString** | **BuiltList<String>** | | [optional] [default to const []] -**arrayArrayOfInteger** | [**BuiltList<BuiltList<int>>**](List.md) | | [optional] [default to const []] -**arrayArrayOfModel** | [**BuiltList<BuiltList<ReadOnlyFirst>>**](List.md) | | [optional] [default to const []] +**arrayArrayOfInteger** | [**BuiltList<BuiltList<int>>**](BuiltList.md) | | [optional] [default to const []] +**arrayArrayOfModel** | [**BuiltList<BuiltList<ReadOnlyFirst>>**](BuiltList.md) | | [optional] [default to const []] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md index 20c8e7ecf2f..e7661f82818 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md @@ -492,13 +492,13 @@ To test enum parameters import 'package:openapi/api.dart'; var api_instance = new FakeApi(); -var enumHeaderStringArray = []; // List | Header parameter enum test (string array) +var enumHeaderStringArray = []; // BuiltList | Header parameter enum test (string array) var enumHeaderString = enumHeaderString_example; // String | Header parameter enum test (string) -var enumQueryStringArray = []; // List | Query parameter enum test (string array) +var enumQueryStringArray = []; // BuiltList | Query parameter enum test (string array) var enumQueryString = enumQueryString_example; // String | Query parameter enum test (string) var enumQueryInteger = 56; // int | Query parameter enum test (double) var enumQueryDouble = 1.2; // double | Query parameter enum test (double) -var enumFormStringArray = [enumFormStringArray_example]; // List | Form parameter enum test (string array) +var enumFormStringArray = [enumFormStringArray_example]; // BuiltList | Form parameter enum test (string array) var enumFormString = enumFormString_example; // String | Form parameter enum test (string) try { @@ -512,13 +512,13 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **enumHeaderStringArray** | [**List<String>**](String.md)| Header parameter enum test (string array) | [optional] [default to const []] + **enumHeaderStringArray** | [**BuiltList<String>**](String.md)| Header parameter enum test (string array) | [optional] [default to const []] **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to '-efg'] - **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [default to const []] + **enumQueryStringArray** | [**BuiltList<String>**](String.md)| Query parameter enum test (string array) | [optional] [default to const []] **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to '-efg'] **enumQueryInteger** | **int**| Query parameter enum test (double) | [optional] [default to null] **enumQueryDouble** | **double**| Query parameter enum test (double) | [optional] [default to null] - **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [default to '$'] + **enumFormStringArray** | [**BuiltList<String>**](String.md)| Form parameter enum test (string array) | [optional] [default to '$'] **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to '-efg'] ### Return type @@ -601,7 +601,7 @@ test inline additionalProperties import 'package:openapi/api.dart'; var api_instance = new FakeApi(); -var requestBody = new Map<String, String>(); // Map | request body +var requestBody = new BuiltMap<String, String>(); // BuiltMap | request body try { api_instance.testInlineAdditionalProperties(requestBody); @@ -614,7 +614,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **requestBody** | [**Map<String, String>**](String.md)| request body | + **requestBody** | [**BuiltMap<String, String>**](String.md)| request body | ### Return type @@ -685,11 +685,11 @@ To test the collection format in query parameters import 'package:openapi/api.dart'; var api_instance = new FakeApi(); -var pipe = []; // List | -var ioutil = []; // List | -var http = []; // List | -var url = []; // List | -var context = []; // List | +var pipe = []; // BuiltList | +var ioutil = []; // BuiltList | +var http = []; // BuiltList | +var url = []; // BuiltList | +var context = []; // BuiltList | try { api_instance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); @@ -702,11 +702,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pipe** | [**List<String>**](String.md)| | [default to const []] - **ioutil** | [**List<String>**](String.md)| | [default to const []] - **http** | [**List<String>**](String.md)| | [default to const []] - **url** | [**List<String>**](String.md)| | [default to const []] - **context** | [**List<String>**](String.md)| | [default to const []] + **pipe** | [**BuiltList<String>**](String.md)| | [default to const []] + **ioutil** | [**BuiltList<String>**](String.md)| | [default to const []] + **http** | [**BuiltList<String>**](String.md)| | [default to const []] + **url** | [**BuiltList<String>**](String.md)| | [default to const []] + **context** | [**BuiltList<String>**](String.md)| | [default to const []] ### Return type diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/MapTest.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/MapTest.md index c9355eab36d..3a6fa0871ee 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/MapTest.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/MapTest.md @@ -8,7 +8,7 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**mapMapOfString** | [**BuiltMap<String, BuiltMap<String, String>>**](Map.md) | | [optional] [default to const {}] +**mapMapOfString** | [**BuiltMap<String, BuiltMap<String, String>>**](BuiltMap.md) | | [optional] [default to const {}] **mapOfEnumString** | **BuiltMap<String, String>** | | [optional] [default to const {}] **directMap** | **BuiltMap<String, bool>** | | [optional] [default to const {}] **indirectMap** | **BuiltMap<String, bool>** | | [optional] [default to const {}] diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/NullableClass.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/NullableClass.md index 5c3443d6342..bcc17d7f5e5 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/NullableClass.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/NullableClass.md @@ -14,12 +14,12 @@ Name | Type | Description | Notes **stringProp** | **String** | | [optional] [default to null] **dateProp** | [**DateTime**](DateTime.md) | | [optional] [default to null] **datetimeProp** | [**DateTime**](DateTime.md) | | [optional] [default to null] -**arrayNullableProp** | [**BuiltList<JsonObject>**](Object.md) | | [optional] [default to const []] -**arrayAndItemsNullableProp** | [**BuiltList<JsonObject>**](Object.md) | | [optional] [default to const []] -**arrayItemsNullable** | [**BuiltList<JsonObject>**](Object.md) | | [optional] [default to const []] -**objectNullableProp** | [**BuiltMap<String, JsonObject>**](Object.md) | | [optional] [default to const {}] -**objectAndItemsNullableProp** | [**BuiltMap<String, JsonObject>**](Object.md) | | [optional] [default to const {}] -**objectItemsNullable** | [**BuiltMap<String, JsonObject>**](Object.md) | | [optional] [default to const {}] +**arrayNullableProp** | [**BuiltList<JsonObject>**](JsonObject.md) | | [optional] [default to const []] +**arrayAndItemsNullableProp** | [**BuiltList<JsonObject>**](JsonObject.md) | | [optional] [default to const []] +**arrayItemsNullable** | [**BuiltList<JsonObject>**](JsonObject.md) | | [optional] [default to const []] +**objectNullableProp** | [**BuiltMap<String, JsonObject>**](JsonObject.md) | | [optional] [default to const {}] +**objectAndItemsNullableProp** | [**BuiltMap<String, JsonObject>**](JsonObject.md) | | [optional] [default to const {}] +**objectItemsNullable** | [**BuiltMap<String, JsonObject>**](JsonObject.md) | | [optional] [default to const {}] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/PetApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/PetApi.md index 1eb54f8d385..0c22a386f40 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/PetApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/PetApi.md @@ -107,7 +107,7 @@ void (empty response body) [[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) # **findPetsByStatus** -> List findPetsByStatus(status) +> BuiltList findPetsByStatus(status) Finds Pets by status @@ -120,7 +120,7 @@ import 'package:openapi/api.dart'; //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; var api_instance = new PetApi(); -var status = []; // List | Status values that need to be considered for filter +var status = []; // BuiltList | Status values that need to be considered for filter try { var result = api_instance.findPetsByStatus(status); @@ -134,11 +134,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to const []] + **status** | [**BuiltList<String>**](String.md)| Status values that need to be considered for filter | [default to const []] ### Return type -[**List**](Pet.md) +[**BuiltList**](Pet.md) ### Authorization @@ -152,7 +152,7 @@ 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) # **findPetsByTags** -> List findPetsByTags(tags) +> BuiltList findPetsByTags(tags) Finds Pets by tags @@ -165,7 +165,7 @@ import 'package:openapi/api.dart'; //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; var api_instance = new PetApi(); -var tags = []; // List | Tags to filter by +var tags = []; // BuiltList | Tags to filter by try { var result = api_instance.findPetsByTags(tags); @@ -179,11 +179,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**List<String>**](String.md)| Tags to filter by | [default to const []] + **tags** | [**BuiltList<String>**](String.md)| Tags to filter by | [default to const []] ### Return type -[**List**](Pet.md) +[**BuiltList**](Pet.md) ### Authorization diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/StoreApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/StoreApi.md index 10196b4cfa4..3731ef5fe7f 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/StoreApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/StoreApi.md @@ -58,7 +58,7 @@ 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) # **getInventory** -> Map getInventory() +> BuiltMap getInventory() Returns pet inventories by status @@ -87,7 +87,7 @@ This endpoint does not need any parameter. ### Return type -**Map** +**BuiltMap** ### Authorization diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/UserApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/UserApi.md index f4334518616..16a608ad285 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/UserApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/UserApi.md @@ -71,7 +71,7 @@ Creates list of users with given input array import 'package:openapi/api.dart'; var api_instance = new UserApi(); -var user = [new List<User>()]; // List | List of user object +var user = [new BuiltList<User>()]; // BuiltList | List of user object try { api_instance.createUsersWithArrayInput(user); @@ -84,7 +84,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**List<User>**](User.md)| List of user object | + **user** | [**BuiltList<User>**](User.md)| List of user object | ### Return type @@ -111,7 +111,7 @@ Creates list of users with given input array import 'package:openapi/api.dart'; var api_instance = new UserApi(); -var user = [new List<User>()]; // List | List of user object +var user = [new BuiltList<User>()]; // BuiltList | List of user object try { api_instance.createUsersWithListInput(user); @@ -124,7 +124,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**List<User>**](User.md)| List of user object | + **user** | [**BuiltList<User>**](User.md)| List of user object | ### Return type diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart index f18394e15c8..1d53eac21db 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'dart:io'; import 'dart:convert'; import 'package:dio/dio.dart'; -import 'package:built_collection/built_collection.dart'; import 'package:built_value/serializer.dart'; import 'package:openapi/model/client.dart'; @@ -30,8 +29,8 @@ class AnotherFakeApi { List contentTypes = ["application/json"]; - var serializedBody = _serializers.serialize(client); - var jsonclient = json.encode(serializedBody); + final serializedBody = _serializers.serialize(client); + final jsonclient = json.encode(serializedBody); bodyData = jsonclient; return _dio.request( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/default_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/default_api.dart index 8dcef4f418f..61252491155 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/default_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/default_api.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'dart:io'; import 'dart:convert'; import 'package:dio/dio.dart'; -import 'package:built_collection/built_collection.dart'; import 'package:built_value/serializer.dart'; import 'package:openapi/model/inline_response_default.dart'; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart index 3ec6259b83f..916e4fbda3f 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'dart:io'; import 'dart:convert'; import 'package:dio/dio.dart'; -import 'package:built_collection/built_collection.dart'; import 'package:built_value/serializer.dart'; import 'package:openapi/model/client.dart'; @@ -12,6 +11,7 @@ import 'package:openapi/model/user.dart'; import 'package:openapi/model/health_check_result.dart'; import 'package:openapi/model/pet.dart'; import 'dart:typed_data'; +import 'package:built_collection/built_collection.dart'; import 'package:openapi/api_util.dart'; class FakeApi { @@ -88,8 +88,8 @@ class FakeApi { List contentTypes = ["application/json","application/xml"]; - var serializedBody = _serializers.serialize(pet); - var jsonpet = json.encode(serializedBody); + final serializedBody = _serializers.serialize(pet); + final jsonpet = json.encode(serializedBody); bodyData = jsonpet; return _dio.request( @@ -126,8 +126,8 @@ class FakeApi { List contentTypes = ["application/json"]; - var serializedBody = _serializers.serialize(body); - var jsonbody = json.encode(serializedBody); + final serializedBody = _serializers.serialize(body); + final jsonbody = json.encode(serializedBody); bodyData = jsonbody; return _dio.request( @@ -147,7 +147,7 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ).then((response) { - var data = response.data as bool; + final data = response.data as bool; return Response( data: data, @@ -177,8 +177,8 @@ class FakeApi { List contentTypes = ["application/json"]; - var serializedBody = _serializers.serialize(outerComposite); - var jsonouterComposite = json.encode(serializedBody); + final serializedBody = _serializers.serialize(outerComposite); + final jsonouterComposite = json.encode(serializedBody); bodyData = jsonouterComposite; return _dio.request( @@ -229,8 +229,8 @@ class FakeApi { List contentTypes = ["application/json"]; - var serializedBody = _serializers.serialize(body); - var jsonbody = json.encode(serializedBody); + final serializedBody = _serializers.serialize(body); + final jsonbody = json.encode(serializedBody); bodyData = jsonbody; return _dio.request( @@ -250,7 +250,7 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ).then((response) { - var data = response.data as num; + final data = response.data as num; return Response( data: data, @@ -280,8 +280,8 @@ class FakeApi { List contentTypes = ["application/json"]; - var serializedBody = _serializers.serialize(body); - var jsonbody = json.encode(serializedBody); + final serializedBody = _serializers.serialize(body); + final jsonbody = json.encode(serializedBody); bodyData = jsonbody; return _dio.request( @@ -301,7 +301,7 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ).then((response) { - var data = response.data as String; + final data = response.data as String; return Response( data: data, @@ -331,8 +331,8 @@ class FakeApi { List contentTypes = ["application/json"]; - var serializedBody = _serializers.serialize(fileSchemaTestClass); - var jsonfileSchemaTestClass = json.encode(serializedBody); + final serializedBody = _serializers.serialize(fileSchemaTestClass); + final jsonfileSchemaTestClass = json.encode(serializedBody); bodyData = jsonfileSchemaTestClass; return _dio.request( @@ -370,8 +370,8 @@ class FakeApi { List contentTypes = ["application/json"]; - var serializedBody = _serializers.serialize(user); - var jsonuser = json.encode(serializedBody); + final serializedBody = _serializers.serialize(user); + final jsonuser = json.encode(serializedBody); bodyData = jsonuser; return _dio.request( @@ -408,8 +408,8 @@ class FakeApi { List contentTypes = ["application/json"]; - var serializedBody = _serializers.serialize(client); - var jsonclient = json.encode(serializedBody); + final serializedBody = _serializers.serialize(client); + final jsonclient = json.encode(serializedBody); bodyData = jsonclient; return _dio.request( @@ -497,7 +497,7 @@ class FakeApi { /// To test enum parameters /// /// To test enum parameters - FuturetestEnumParameters({ List enumHeaderStringArray,String enumHeaderString,List enumQueryStringArray,String enumQueryString,int enumQueryInteger,double enumQueryDouble,List enumFormStringArray,String enumFormString,CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + FuturetestEnumParameters({ BuiltList enumHeaderStringArray,String enumHeaderString,BuiltList enumQueryStringArray,String enumQueryString,int enumQueryInteger,double enumQueryDouble,BuiltList enumFormStringArray,String enumFormString,CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { String _path = "/fake"; @@ -583,7 +583,7 @@ class FakeApi { /// test inline additionalProperties /// /// - FuturetestInlineAdditionalProperties(Map requestBody,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + FuturetestInlineAdditionalProperties(BuiltMap requestBody,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { String _path = "/fake/inline-additionalProperties"; @@ -597,8 +597,8 @@ class FakeApi { List contentTypes = ["application/json"]; - var serializedBody = _serializers.serialize(requestBody); - var jsonrequestBody = json.encode(serializedBody); + final serializedBody = _serializers.serialize(requestBody); + final jsonrequestBody = json.encode(serializedBody); bodyData = jsonrequestBody; return _dio.request( @@ -660,7 +660,7 @@ class FakeApi { /// /// /// To test the collection format in query parameters - FuturetestQueryParameterCollectionFormat(List pipe,List ioutil,List http,List url,List context,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + FuturetestQueryParameterCollectionFormat(BuiltList pipe,BuiltList ioutil,BuiltList http,BuiltList url,BuiltList context,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { String _path = "/fake/test-query-paramters"; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart index 1e87b70e59d..6bb3607e11d 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'dart:io'; import 'dart:convert'; import 'package:dio/dio.dart'; -import 'package:built_collection/built_collection.dart'; import 'package:built_value/serializer.dart'; import 'package:openapi/model/client.dart'; @@ -30,8 +29,8 @@ class FakeClassnameTags123Api { List contentTypes = ["application/json"]; - var serializedBody = _serializers.serialize(client); - var jsonclient = json.encode(serializedBody); + final serializedBody = _serializers.serialize(client); + final jsonclient = json.encode(serializedBody); bodyData = jsonclient; return _dio.request( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart index 3f11f5fffe1..45a34674ae6 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart @@ -2,12 +2,12 @@ import 'dart:async'; import 'dart:io'; import 'dart:convert'; import 'package:dio/dio.dart'; -import 'package:built_collection/built_collection.dart'; import 'package:built_value/serializer.dart'; import 'package:openapi/model/pet.dart'; import 'package:openapi/model/api_response.dart'; import 'dart:typed_data'; +import 'package:built_collection/built_collection.dart'; import 'package:openapi/api_util.dart'; class PetApi { @@ -33,8 +33,8 @@ class PetApi { List contentTypes = ["application/json","application/xml"]; - var serializedBody = _serializers.serialize(pet); - var jsonpet = json.encode(serializedBody); + final serializedBody = _serializers.serialize(pet); + final jsonpet = json.encode(serializedBody); bodyData = jsonpet; return _dio.request( @@ -93,7 +93,7 @@ class PetApi { /// Finds Pets by status /// /// Multiple status values can be provided with comma separated strings - Future>>findPetsByStatus(List status,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + Future>>findPetsByStatus(BuiltList status,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { String _path = "/pet/findByStatus"; @@ -126,11 +126,11 @@ class PetApi { onReceiveProgress: onReceiveProgress, ).then((response) { - final FullType type = const FullType(BuiltList, const [const FullType(Pet)]); - final BuiltList dataList = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type); - final data = dataList.toList(); + const collectionType = BuiltList; + const type = FullType(collectionType, [FullType(Pet)]); + final BuiltList data = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type); - return Response>( + return Response>( data: data, headers: response.headers, request: response.request, @@ -144,7 +144,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,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + Future>>findPetsByTags(BuiltList tags,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { String _path = "/pet/findByTags"; @@ -177,11 +177,11 @@ class PetApi { onReceiveProgress: onReceiveProgress, ).then((response) { - final FullType type = const FullType(BuiltList, const [const FullType(Pet)]); - final BuiltList dataList = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type); - final data = dataList.toList(); + const collectionType = BuiltList; + const type = FullType(collectionType, [FullType(Pet)]); + final BuiltList data = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type); - return Response>( + return Response>( data: data, headers: response.headers, request: response.request, @@ -258,8 +258,8 @@ class PetApi { List contentTypes = ["application/json","application/xml"]; - var serializedBody = _serializers.serialize(pet); - var jsonpet = json.encode(serializedBody); + final serializedBody = _serializers.serialize(pet); + final jsonpet = json.encode(serializedBody); bodyData = jsonpet; return _dio.request( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/store_api.dart index 140b27ae3b4..5f43c7dc8ca 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/store_api.dart @@ -2,10 +2,10 @@ import 'dart:async'; import 'dart:io'; import 'dart:convert'; import 'package:dio/dio.dart'; -import 'package:built_collection/built_collection.dart'; import 'package:built_value/serializer.dart'; import 'package:openapi/model/order.dart'; +import 'package:built_collection/built_collection.dart'; class StoreApi { final Dio _dio; @@ -51,7 +51,7 @@ class StoreApi { /// Returns pet inventories by status /// /// Returns a map of status codes to quantities - Future>>getInventory({ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + Future>>getInventory({ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { String _path = "/store/inventory"; @@ -83,9 +83,11 @@ class StoreApi { onReceiveProgress: onReceiveProgress, ).then((response) { - var data = response.data as Map; + const collectionType = BuiltMap; + const type = FullType(collectionType, [FullType(String), FullType(int)]); + final BuiltMap data = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type); - return Response>( + return Response>( data: data, headers: response.headers, request: response.request, @@ -162,8 +164,8 @@ class StoreApi { List contentTypes = ["application/json"]; - var serializedBody = _serializers.serialize(order); - var jsonorder = json.encode(serializedBody); + final serializedBody = _serializers.serialize(order); + final jsonorder = json.encode(serializedBody); bodyData = jsonorder; return _dio.request( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/user_api.dart index 4ccd843dfd9..f99d40f56ac 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/user_api.dart @@ -2,10 +2,10 @@ import 'dart:async'; import 'dart:io'; import 'dart:convert'; import 'package:dio/dio.dart'; -import 'package:built_collection/built_collection.dart'; import 'package:built_value/serializer.dart'; import 'package:openapi/model/user.dart'; +import 'package:built_collection/built_collection.dart'; class UserApi { final Dio _dio; @@ -30,8 +30,8 @@ class UserApi { List contentTypes = ["application/json"]; - var serializedBody = _serializers.serialize(user); - var jsonuser = json.encode(serializedBody); + final serializedBody = _serializers.serialize(user); + final jsonuser = json.encode(serializedBody); bodyData = jsonuser; return _dio.request( @@ -54,7 +54,7 @@ class UserApi { /// Creates list of users with given input array /// /// - FuturecreateUsersWithArrayInput(List user,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + FuturecreateUsersWithArrayInput(BuiltList user,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { String _path = "/user/createWithArray"; @@ -68,9 +68,9 @@ class UserApi { List contentTypes = ["application/json"]; - final type = const FullType(BuiltList, const [const FullType(User)]); - var serializedBody = _serializers.serialize(BuiltList.from(user), specifiedType: type); - var jsonuser = json.encode(serializedBody); + const type = FullType(BuiltList, [FullType(User)]); + final serializedBody = _serializers.serialize(user, specifiedType: type); + final jsonuser = json.encode(serializedBody); bodyData = jsonuser; return _dio.request( @@ -93,7 +93,7 @@ class UserApi { /// Creates list of users with given input array /// /// - FuturecreateUsersWithListInput(List user,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + FuturecreateUsersWithListInput(BuiltList user,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { String _path = "/user/createWithList"; @@ -107,9 +107,9 @@ class UserApi { List contentTypes = ["application/json"]; - final type = const FullType(BuiltList, const [const FullType(User)]); - var serializedBody = _serializers.serialize(BuiltList.from(user), specifiedType: type); - var jsonuser = json.encode(serializedBody); + const type = FullType(BuiltList, [FullType(User)]); + final serializedBody = _serializers.serialize(user, specifiedType: type); + final jsonuser = json.encode(serializedBody); bodyData = jsonuser; return _dio.request( @@ -250,7 +250,7 @@ class UserApi { onReceiveProgress: onReceiveProgress, ).then((response) { - var data = response.data as String; + final data = response.data as String; return Response( data: data, @@ -315,8 +315,8 @@ class UserApi { List contentTypes = ["application/json"]; - var serializedBody = _serializers.serialize(user); - var jsonuser = json.encode(serializedBody); + final serializedBody = _serializers.serialize(user); + final jsonuser = json.encode(serializedBody); bodyData = jsonuser; return _dio.request( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/fake_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/fake_api_test.dart index 3fc5ab60ada..0ffe770cdd4 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/fake_api_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/fake_api_test.dart @@ -84,7 +84,7 @@ void main() { // // To test enum parameters // - //Future testEnumParameters({ List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, List enumFormStringArray, String enumFormString }) async + //Future testEnumParameters({ BuiltList enumHeaderStringArray, String enumHeaderString, BuiltList enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, BuiltList enumFormStringArray, String enumFormString }) async test('test testEnumParameters', () async { // TODO }); @@ -100,7 +100,7 @@ void main() { // test inline additionalProperties // - //Future testInlineAdditionalProperties(Map requestBody) async + //Future testInlineAdditionalProperties(BuiltMap requestBody) async test('test testInlineAdditionalProperties', () async { // TODO }); @@ -114,7 +114,7 @@ void main() { // To test the collection format in query parameters // - //Future testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context) async + //Future testQueryParameterCollectionFormat(BuiltList pipe, BuiltList ioutil, BuiltList http, BuiltList url, BuiltList context) async test('test testQueryParameterCollectionFormat', () async { // TODO }); diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/pet_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/pet_api_test.dart index a576981450b..7724f48b5df 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/pet_api_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/pet_api_test.dart @@ -26,7 +26,7 @@ void main() { // // Multiple status values can be provided with comma separated strings // - //Future> findPetsByStatus(List status) async + //Future> findPetsByStatus(BuiltList status) async test('test findPetsByStatus', () async { // TODO }); @@ -35,7 +35,7 @@ void main() { // // Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. // - //Future> findPetsByTags(List tags) async + //Future> findPetsByTags(BuiltList tags) async test('test findPetsByTags', () async { // TODO }); diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/store_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/store_api_test.dart index ae64309d973..27854e9d9cf 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/store_api_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/store_api_test.dart @@ -21,7 +21,7 @@ void main() { // // Returns a map of status codes to quantities // - //Future> getInventory() async + //Future> getInventory() async test('test getInventory', () async { // TODO }); diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/user_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/user_api_test.dart index 9377f97e3c3..b202f3662c4 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/user_api_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/user_api_test.dart @@ -19,14 +19,14 @@ void main() { // Creates list of users with given input array // - //Future createUsersWithArrayInput(List user) async + //Future createUsersWithArrayInput(BuiltList user) async test('test createUsersWithArrayInput', () async { // TODO }); // Creates list of users with given input array // - //Future createUsersWithListInput(List user) async + //Future createUsersWithListInput(BuiltList user) async test('test createUsersWithListInput', () async { // TODO });