From a1d65f48a16f849210d54bd18a66e1883f082637 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kate=20D=C3=B6en?= Date: Wed, 6 Oct 2021 14:31:23 +0200 Subject: [PATCH 1/2] fix: Make dart2 generated code compilable --- .../openapitools/codegen/CodegenModel.java | 10 ++- .../codegen/CodegenParameter.java | 8 +++ .../openapitools/codegen/CodegenProperty.java | 8 +++ .../openapitools/codegen/CodegenResponse.java | 8 +++ .../IJsonSchemaValidationProperties.java | 6 +- .../languages/AbstractDartCodegen.java | 40 ++++++++--- .../src/main/resources/dart2/README.mustache | 2 +- .../src/main/resources/dart2/api.mustache | 22 ++----- .../main/resources/dart2/api_client.mustache | 39 +++++------ .../resources/dart2/api_exception.mustache | 6 +- .../main/resources/dart2/api_helper.mustache | 30 +++------ .../main/resources/dart2/api_test.mustache | 29 -------- .../dart2/auth/api_key_auth.mustache | 4 +- .../main/resources/dart2/auth/header.mustache | 2 +- .../dart2/auth/http_basic_auth.mustache | 4 +- .../main/resources/dart2/auth/oauth.mustache | 2 +- .../resources/dart2/dart_constructor.mustache | 6 +- .../main/resources/dart2/gitignore.mustache | 32 ++++----- .../src/main/resources/dart2/header.mustache | 2 +- .../main/resources/dart2/model_test.mustache | 29 -------- .../src/main/resources/dart2/pubspec.mustache | 10 ++- .../json_serializable_class.mustache | 16 ++--- .../native/native_class.mustache | 66 ++++++++----------- .../serialization/native/native_enum.mustache | 46 +++++-------- .../native/native_enum_inline.mustache | 45 +++++-------- .../src/main/resources/dart2/travis.mustache | 2 +- 26 files changed, 201 insertions(+), 273 deletions(-) delete mode 100644 modules/openapi-generator/src/main/resources/dart2/api_test.mustache delete mode 100644 modules/openapi-generator/src/main/resources/dart2/model_test.mustache diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java index ab9f23fba675..00634f89470c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java @@ -69,7 +69,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties { public String defaultValue; public String arrayModelType; public boolean isAlias; // Is this effectively an alias of another simple type - public boolean isString, isInteger, isLong, isNumber, isNumeric, isFloat, isDouble, isDate, isDateTime, isShort, isUnboundedInteger, isBoolean; + public boolean isString, isInteger, isLong, isNumber, isNumeric, isFloat, isDouble, isDate, isDateTime, isShort, isUnboundedInteger, isPrimitiveType, isBoolean; private boolean additionalPropertiesIsAnyType; public List vars = new ArrayList(); // all properties (without parent's properties) public List allVars = new ArrayList(); // all properties (with parent's properties) @@ -640,6 +640,14 @@ public void setIsUnboundedInteger(boolean isUnboundedInteger) { this.isUnboundedInteger = isUnboundedInteger; } + @Override + public boolean getIsPrimitiveType() { return isPrimitiveType; } + + @Override + public void setIsPrimitiveType(boolean isPrimitiveType) { + this.isPrimitiveType = isPrimitiveType; + } + @Override public CodegenProperty getAdditionalProperties() { return additionalProperties; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java index ebd01afdfd24..32d5f3d48ade 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java @@ -601,6 +601,14 @@ public void setIsUnboundedInteger(boolean isUnboundedInteger) { this.isUnboundedInteger = isUnboundedInteger; } + @Override + public boolean getIsPrimitiveType() { return isPrimitiveType; } + + @Override + public void setIsPrimitiveType(boolean isPrimitiveType) { + this.isPrimitiveType = isPrimitiveType; + } + @Override public CodegenProperty getAdditionalProperties() { return additionalProperties; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java index ed1636fc6d53..c108914d26e8 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java @@ -534,6 +534,14 @@ public void setIsUnboundedInteger(boolean isUnboundedInteger) { this.isUnboundedInteger = isUnboundedInteger; } + @Override + public boolean getIsPrimitiveType() { return isPrimitiveType; } + + @Override + public void setIsPrimitiveType(boolean isPrimitiveType) { + this.isPrimitiveType = isPrimitiveType; + } + public Map getVendorExtensions() { return vendorExtensions; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java index 1a99e774e598..49d6598196c8 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java @@ -347,6 +347,14 @@ public void setIsUnboundedInteger(boolean isUnboundedInteger) { this.isUnboundedInteger = isUnboundedInteger; } + @Override + public boolean getIsPrimitiveType() { return primitiveType; } + + @Override + public void setIsPrimitiveType(boolean isPrimitiveType) { + this.primitiveType = isPrimitiveType; + } + @Override public void setIsModel(boolean isModel) { this.isModel = isModel; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java index b3833e47f6fe..bc268562d99e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java @@ -95,6 +95,10 @@ public interface IJsonSchemaValidationProperties { void setIsUnboundedInteger(boolean isUnboundedInteger); + boolean getIsPrimitiveType(); + + void setIsPrimitiveType(boolean isPrimitiveType); + CodegenProperty getAdditionalProperties(); void setAdditionalProperties(CodegenProperty additionalProperties); @@ -205,4 +209,4 @@ default void setTypeProperties(Schema p) { setIsAnyType(true); } } -} \ No newline at end of file +} diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java index c456b0438e31..ec1494c29a1f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java @@ -98,9 +98,6 @@ public AbstractDartCodegen() { modelDocTemplateFiles.put("object_doc.mustache", ".md"); apiDocTemplateFiles.put("api_doc.mustache", ".md"); - modelTestTemplateFiles.put("model_test.mustache", ".dart"); - apiTestTemplateFiles.put("api_test.mustache", ".dart"); - final List reservedWordsList = new ArrayList<>(); try(BufferedReader reader = new BufferedReader( new InputStreamReader(DartClientCodegen.class.getResourceAsStream("/dart/dart-keywords.txt"), @@ -507,6 +504,21 @@ public Map postProcessModels(Map objs) { @Override public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { super.postProcessModelProperty(model, property); + if (property.dataType.equals("Object") || property.baseType.equals("Object") || (property.complexType != null && property.complexType.equals("Object"))) { + String dataType = "Map"; + String complexType = dataType; + if (property.isArray) { + dataType = "List<"+dataType+">"; + } + if (property.required) { + dataType += "?"; + complexType += "?"; + } + property.setDatatypeWithEnum(dataType); + property.setDatatype(dataType); + property.setComplexType(complexType); + property.setIsPrimitiveType(true); + } if (!model.isEnum && property.isEnum) { // These are inner enums, enums which do not exist as models, just as properties. // They are handled via the enum_inline template and and are generated in the @@ -532,6 +544,12 @@ public void postProcessModelProperty(CodegenModel model, CodegenProperty propert @Override public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, List servers) { final CodegenOperation op = super.fromOperation(path, httpMethod, operation, servers); + String returnType = op.returnType; + if (returnType == null || returnType.equals("Object")) { + op.returnType = "Map"; + op.returnBaseType = "Map"; + op.returnTypeIsPrimitive = true; + } 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 @@ -644,15 +662,20 @@ protected void updateEnumVarsWithExtensions(List> enumVars, } } + boolean needsEnumEscape(String datatype) { + // TODO: is this complete? + return !("num".equalsIgnoreCase(datatype) || + "int".equalsIgnoreCase(datatype) || + "double".equalsIgnoreCase(datatype)|| + "float".equalsIgnoreCase(datatype)); + } + @Override public String toEnumVarName(String value, String datatype) { if (value.length() == 0) { return "empty"; } - if (("number".equalsIgnoreCase(datatype) || - "double".equalsIgnoreCase(datatype) || - "int".equalsIgnoreCase(datatype)) && - value.matches("^-?\\d.*")) { + if (!needsEnumEscape(datatype) && value.matches("^-?\\d.*")) { // Only rename numeric values when the datatype is numeric // AND the name is not changed by enum extensions (matches a numeric value). boolean isNegative = value.startsWith("-"); @@ -663,8 +686,7 @@ public String toEnumVarName(String value, String datatype) { @Override public String toEnumValue(String value, String datatype) { - if ("number".equalsIgnoreCase(datatype) || - "int".equalsIgnoreCase(datatype)) { + if (!needsEnumEscape(datatype)) { return value; } else { return "'" + escapeText(value) + "'"; diff --git a/modules/openapi-generator/src/main/resources/dart2/README.mustache b/modules/openapi-generator/src/main/resources/dart2/README.mustache index 1b1129159560..d3d86486807c 100644 --- a/modules/openapi-generator/src/main/resources/dart2/README.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/README.mustache @@ -19,7 +19,7 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) ## Requirements -Dart 2.0 or later +Dart 2.14 or later ## Installation & Usage diff --git a/modules/openapi-generator/src/main/resources/dart2/api.mustache b/modules/openapi-generator/src/main/resources/dart2/api.mustache index c16db47c110b..6576879f7c9a 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api.mustache @@ -3,7 +3,7 @@ {{#operations}} class {{{classname}}} { - {{{classname}}}([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + {{{classname}}}([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; {{#operation}} @@ -49,24 +49,13 @@ class {{{classname}}} { /// {{/-last}} {{/allParams}} - Future {{{nickname}}}WithHttpInfo({{#allParams}}{{#required}}{{{dataType}}} {{{paramName}}},{{^-last}} {{/-last}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{ {{#allParams}}{{^required}}{{{dataType}}} {{{paramName}}},{{^-last}} {{/-last}}{{/required}}{{/allParams}} }{{/hasOptionalParams}}) async { - {{#hasParams}} - // Verify required params are set. - {{#allParams}} - {{#required}} - if ({{{paramName}}} == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: {{{paramName}}}'); - } - {{/required}} - {{/allParams}} - - {{/hasParams}} + Future {{{nickname}}}WithHttpInfo({{#allParams}}{{#required}}{{{dataType}}} {{{paramName}}},{{^-last}} {{/-last}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{ {{#allParams}}{{^required}}{{{dataType}}}? {{{paramName}}},{{^-last}} {{/-last}}{{/required}}{{/allParams}} }{{/hasOptionalParams}}) async { // ignore: prefer_const_declarations final path = r'{{{path}}}'{{#pathParams}} .replaceAll({{=<% %>=}}'{<% baseName %>}'<%={{ }}=%>, {{{paramName}}}{{^isString}}.toString(){{/isString}}){{/pathParams}}; // ignore: prefer_final_locals - Object postBody{{#bodyParam}} = {{{paramName}}}{{/bodyParam}}; + Object? postBody{{#bodyParam}} = {{{paramName}}}{{/bodyParam}}; final queryParams = []; final headerParams = {}; @@ -174,7 +163,7 @@ class {{{classname}}} { /// {{/-last}} {{/allParams}} - Future<{{{returnType}}}{{^returnType}}void{{/returnType}}> {{{nickname}}}({{#allParams}}{{#required}}{{{dataType}}} {{{paramName}}},{{^-last}} {{/-last}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{ {{#allParams}}{{^required}}{{{dataType}}} {{{paramName}}},{{^-last}} {{/-last}}{{/required}}{{/allParams}} }{{/hasOptionalParams}}) async { + Future<{{#returnType}}{{{.}}}?{{/returnType}}{{^returnType}}void{{/returnType}}> {{{nickname}}}({{#allParams}}{{#required}}{{{dataType}}} {{{paramName}}},{{^-last}} {{/-last}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{ {{#allParams}}{{^required}}{{{dataType}}}? {{{paramName}}},{{^-last}} {{/-last}}{{/required}}{{/allParams}} }{{/hasOptionalParams}}) async { final response = await {{{nickname}}}WithHttpInfo({{#allParams}}{{#required}}{{{paramName}}},{{^-last}} {{/-last}}{{/required}}{{/allParams}}{{#hasOptionalParams}} {{#allParams}}{{^required}}{{{paramName}}}: {{{paramName}}},{{^-last}} {{/-last}}{{/required}}{{/allParams}} {{/hasOptionalParams}}); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -183,7 +172,7 @@ class {{{classname}}} { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { {{#native_serialization}} {{#isArray}} final responseBody = await _decodeBodyBytes(response); @@ -225,7 +214,6 @@ class {{{classname}}} { {{/isArray}} {{/json_serializable}} } - return Future<{{{returnType}}}>.value(); {{/returnType}} } {{/operation}} diff --git a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache index 85be6bc9376b..3deda1a82e40 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache @@ -33,12 +33,7 @@ class ApiClient { Client get client => _client; /// Requests to use a new HTTP [Client] in this class. - /// - /// If the [newClient] is null, an [ArgumentError] is thrown. set client(Client newClient) { - if (newClient == null) { - throw ArgumentError('New client instance cannot be null.'); - } _client = newClient; } @@ -55,7 +50,7 @@ class ApiClient { /// or deleted. Map get authentications => Map.unmodifiable(_authentications); - T getAuthentication(String name) { + T? getAuthentication(String name) { final authentication = _authentications[name]; return authentication is T ? authentication : null; } @@ -66,10 +61,10 @@ class ApiClient { String path, String method, List queryParams, - Object body, + Object? body, Map headerParams, Map formParams, - String nullableContentType, + String? nullableContentType, List authNames, ) async { _updateParamsForAuth(authNames, queryParams, headerParams); @@ -149,12 +144,12 @@ class ApiClient { } {{#native_serialization}} - Future deserializeAsync(String json, String targetType, {bool growable}) async => + Future deserializeAsync(String json, String targetType, {bool? growable}) async => // ignore: deprecated_member_use_from_same_package deserialize(json, targetType, growable: growable); @Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use deserializeAsync() instead.') - dynamic deserialize(String json, String targetType, {bool growable}) { + dynamic deserialize(String json, String targetType, {bool? growable}) { // Remove all spaces. Necessary for regular expressions as well. targetType = targetType.replaceAll(' ', ''); // ignore: parameter_assignments @@ -166,10 +161,10 @@ class ApiClient { {{/native_serialization}} // ignore: deprecated_member_use_from_same_package - Future serializeAsync(Object value) async => serialize(value); + Future serializeAsync(Object? value) async => serialize(value); @Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use serializeAsync() instead.') - String serialize(Object value) => value == null ? '' : json.encode(value); + String serialize(Object? value) => value == null ? '' : json.encode(value); /// Update query and header parameters based on authentication settings. /// @param authNames The authentications to apply @@ -188,7 +183,7 @@ class ApiClient { } {{#native_serialization}} - static dynamic _deserialize(dynamic value, String targetType, {bool growable}) { + static dynamic _deserialize(dynamic value, String targetType, {bool? growable}) { try { switch (targetType) { case 'String': @@ -216,21 +211,21 @@ class ApiClient { {{/model}} {{/models}} default: - Match match; + Match? match; if (value is List && (match = _regList.firstMatch(targetType)) != null) { - targetType = match[1]; // ignore: parameter_assignments + targetType = match![1]!; // ignore: parameter_assignments return value .map((dynamic v) => _deserialize(v, targetType, growable: growable)) - .toList(growable: growable); + .toList(growable: growable == true); } if (value is Set && (match = _regSet.firstMatch(targetType)) != null) { - targetType = match[1]; // ignore: parameter_assignments + targetType = match![1]!; // ignore: parameter_assignments return value .map((dynamic v) => _deserialize(v, targetType, growable: growable)) .toSet(); } if (value is Map && (match = _regMap.firstMatch(targetType)) != null) { - targetType = match[1]; // ignore: parameter_assignments + targetType = match![1]!; // ignore: parameter_assignments return Map.fromIterables( value.keys.cast(), value.values.map((dynamic v) => _deserialize(v, targetType, growable: growable)), @@ -249,8 +244,8 @@ class ApiClient { /// Primarily intended for use in an isolate. class DeserializationMessage { const DeserializationMessage({ - @required this.json, - @required this.targetType, + required this.json, + required this.targetType, this.growable, }); @@ -261,7 +256,7 @@ class DeserializationMessage { final String targetType; /// Whether to make deserialized lists or maps growable. - final bool growable; + final bool? growable; } /// Primarily intended for use in an isolate. @@ -281,4 +276,4 @@ Future deserializeAsync(DeserializationMessage message) async { {{/native_serialization}} /// Primarily intended for use in an isolate. -Future serializeAsync(Object value) async => value == null ? '' : json.encode(value); +Future serializeAsync(Object? value) async => value == null ? '' : json.encode(value); diff --git a/modules/openapi-generator/src/main/resources/dart2/api_exception.mustache b/modules/openapi-generator/src/main/resources/dart2/api_exception.mustache index 28f734e55879..aeb7aa9ce226 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_exception.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_exception.mustache @@ -6,9 +6,9 @@ class ApiException implements Exception { ApiException.withInner(this.code, this.message, this.innerException, this.stackTrace); int code = 0; - String message; - Exception innerException; - StackTrace stackTrace; + String? message; + Exception? innerException; + StackTrace? stackTrace; @override String toString() { diff --git a/modules/openapi-generator/src/main/resources/dart2/api_helper.mustache b/modules/openapi-generator/src/main/resources/dart2/api_helper.mustache index c64effcdda0f..fdb61624e413 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_helper.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_helper.mustache @@ -4,16 +4,16 @@ class QueryParam { const QueryParam(this.name, this.value); final String name; - final String value; + final String? value; @override - String toString() => '${Uri.encodeQueryComponent(name)}=${Uri.encodeQueryComponent(value)}'; + String toString() => '${Uri.encodeQueryComponent(name)}=${Uri.encodeQueryComponent(value ?? 'null')}'; } // Ported from the Java version. Iterable _convertParametersForCollectionFormat( - String collectionFormat, - String name, + String? collectionFormat, + String? name, dynamic value, ) { final params = []; @@ -67,39 +67,27 @@ String parameterToString(dynamic value) { Future _decodeBodyBytes(Response response) async { final contentType = response.headers['content-type']; return contentType != null && contentType.toLowerCase().startsWith('application/json') - ? response.bodyBytes == null ? null : utf8.decode(response.bodyBytes) + ? utf8.decode(response.bodyBytes) : response.body; } -/// Returns a valid [T] value found at the specified Map [key], null otherwise. -T mapValueOfType(dynamic map, String key) { - final dynamic value = map is Map ? map[key] : null; - return value is T ? value : null; -} - -/// Returns a valid Map found at the specified Map [key], null otherwise. -Map mapCastOfType(dynamic map, String key) { - final dynamic value = map is Map ? map[key] : null; - return value is Map ? value.cast() : null; -} - /// Returns a valid [DateTime] found at the specified Map [key], null otherwise. -DateTime mapDateTime(dynamic map, String key, [String pattern]) { +DateTime mapDateTime(dynamic map, String key, [String? pattern]) { final dynamic value = map is Map ? map[key] : null; if (value != null) { - int millis; + int? millis; if (value is int) { millis = value; } else if (value is String) { if (pattern == _dateEpochMarker) { millis = int.tryParse(value); } else { - return DateTime.tryParse(value); + return DateTime.parse(value); } } if (millis != null) { return DateTime.fromMillisecondsSinceEpoch(millis, isUtc: true); } } - return null; + return DateTime(1970); } diff --git a/modules/openapi-generator/src/main/resources/dart2/api_test.mustache b/modules/openapi-generator/src/main/resources/dart2/api_test.mustache deleted file mode 100644 index 319945b2c3b5..000000000000 --- a/modules/openapi-generator/src/main/resources/dart2/api_test.mustache +++ /dev/null @@ -1,29 +0,0 @@ -{{>header}} -import 'package:{{{pubName}}}/api.dart'; -import 'package:test/test.dart'; - -{{#operations}} - -/// tests for {{{classname}}} -void main() { - final instance = {{{classname}}}(); - - group('tests for {{{classname}}}', () { - {{#operation}} - {{#summary}} - // {{{.}}} - // - {{/summary}} - {{#notes}} - // {{{.}}} - // - {{/notes}} - //{{#returnType}}Future<{{{.}}}> {{/returnType}}{{^returnType}}Future {{/returnType}}{{{operationId}}}({{#allParams}}{{#required}}{{{dataType}}} {{{paramName}}}{{^-last}}, {{/-last}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{ {{#allParams}}{{^required}}{{{dataType}}} {{{paramName}}}{{^-last}}, {{/-last}}{{/required}}{{/allParams}} }{{/hasOptionalParams}}) async - test('test {{{operationId}}}', () async { - // TODO - }); - - {{/operation}} - }); -} -{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/dart2/auth/api_key_auth.mustache b/modules/openapi-generator/src/main/resources/dart2/auth/api_key_auth.mustache index f5d602880de0..82cba34e95ea 100644 --- a/modules/openapi-generator/src/main/resources/dart2/auth/api_key_auth.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/auth/api_key_auth.mustache @@ -6,8 +6,8 @@ class ApiKeyAuth implements Authentication { final String location; final String paramName; - String apiKeyPrefix; - String apiKey; + String? apiKeyPrefix; + String? apiKey; @override void applyToParams(List queryParams, Map headerParams) { diff --git a/modules/openapi-generator/src/main/resources/dart2/auth/header.mustache b/modules/openapi-generator/src/main/resources/dart2/auth/header.mustache index 341e14bf9e63..c41fc334d1c2 100644 --- a/modules/openapi-generator/src/main/resources/dart2/auth/header.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/auth/header.mustache @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first diff --git a/modules/openapi-generator/src/main/resources/dart2/auth/http_basic_auth.mustache b/modules/openapi-generator/src/main/resources/dart2/auth/http_basic_auth.mustache index 6098ba5661ea..2f6a542f5d54 100644 --- a/modules/openapi-generator/src/main/resources/dart2/auth/http_basic_auth.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/auth/http_basic_auth.mustache @@ -1,8 +1,8 @@ {{>header}} {{>part_of}} class HttpBasicAuth implements Authentication { - String username; - String password; + String? username; + String? password; @override void applyToParams(List queryParams, Map headerParams) { diff --git a/modules/openapi-generator/src/main/resources/dart2/auth/oauth.mustache b/modules/openapi-generator/src/main/resources/dart2/auth/oauth.mustache index 6cdd30dceb27..464fe2d43ef1 100644 --- a/modules/openapi-generator/src/main/resources/dart2/auth/oauth.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/auth/oauth.mustache @@ -3,7 +3,7 @@ class OAuth implements Authentication { OAuth({this.accessToken}); - String accessToken; + String? accessToken; @override void applyToParams(List queryParams, Map headerParams) { diff --git a/modules/openapi-generator/src/main/resources/dart2/dart_constructor.mustache b/modules/openapi-generator/src/main/resources/dart2/dart_constructor.mustache index af2f2a0e2859..5255b3f8ed27 100644 --- a/modules/openapi-generator/src/main/resources/dart2/dart_constructor.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/dart_constructor.mustache @@ -2,9 +2,9 @@ {{{classname}}}({ {{#vars}} {{! - A field is @required in Dart when it is + A field is required in Dart when it is required && !nullable && !defaultValue in OAS }} - {{#required}}{{^isNullable}}{{^defaultValue}}@required {{/defaultValue}}{{/isNullable}}{{/required}}this.{{{name}}}{{^isNullable}}{{#defaultValue}} = {{#isEnum}}{{^isContainer}}const {{{enumName}}}._({{/isContainer}}{{/isEnum}}{{{defaultValue}}}{{#isEnum}}{{^isContainer}}){{/isContainer}}{{/isEnum}}{{/defaultValue}}{{/isNullable}}, + {{#required}}{{^isNullable}}{{^defaultValue}}required {{/defaultValue}}{{/isNullable}}{{/required}}this.{{{name}}}{{^isNullable}}{{#defaultValue}} = {{#isEnum}}{{^isContainer}}const {{{enumName}}}._({{/isContainer}}{{/isEnum}}{{{defaultValue}}}{{#isEnum}}{{^isContainer}}){{/isContainer}}{{/isEnum}}{{/defaultValue}}{{/isNullable}}, {{/vars}} - }); \ No newline at end of file + }); diff --git a/modules/openapi-generator/src/main/resources/dart2/gitignore.mustache b/modules/openapi-generator/src/main/resources/dart2/gitignore.mustache index 8b7331fd822c..1be28ced0940 100644 --- a/modules/openapi-generator/src/main/resources/dart2/gitignore.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/gitignore.mustache @@ -1,27 +1,17 @@ -# See https://www.dartlang.org/tools/private-files.html +# See https://dart.dev/guides/libraries/private-files -# Files and directories created by pub -.buildlog +.dart_tool/ .packages -.project -.pub/ build/ -**/packages/ +pubspec.lock # Except for application packages -# Files created by dart2js -# (Most Dart developers will use pub build to compile Dart, use/modify these -# rules if you intend to use dart2js directly -# Convention is to use extension '.dart.js' for Dart compiled to Javascript to -# differentiate from explicit Javascript files) -*.dart.js -*.part.js -*.js.deps -*.js.map -*.info.json - -# Directory created by dartdoc doc/api/ -# Don't commit pubspec lock file -# (Library packages only! Remove pattern if developing an application package) -pubspec.lock +# IntelliJ +*.iml +*.ipr +*.iws +.idea/ + +# Mac +.DS_Store diff --git a/modules/openapi-generator/src/main/resources/dart2/header.mustache b/modules/openapi-generator/src/main/resources/dart2/header.mustache index 341e14bf9e63..c41fc334d1c2 100644 --- a/modules/openapi-generator/src/main/resources/dart2/header.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/header.mustache @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first diff --git a/modules/openapi-generator/src/main/resources/dart2/model_test.mustache b/modules/openapi-generator/src/main/resources/dart2/model_test.mustache deleted file mode 100644 index 5d4f1c161c52..000000000000 --- a/modules/openapi-generator/src/main/resources/dart2/model_test.mustache +++ /dev/null @@ -1,29 +0,0 @@ -{{>header}} -{{#models}} -{{#model}} -import 'package:{{{pubName}}}/api.dart'; -import 'package:test/test.dart'; - -// tests for {{{classname}}} -void main() { - {{^isEnum}} - final instance = {{{classname}}}(); - {{/isEnum}} - - group('test {{{classname}}}', () { - {{#vars}} - {{#description}} - // {{{.}}} - {{/description}} - // {{{dataType}}} {{{name}}}{{#defaultValue}} (default value: {{{.}}}){{/defaultValue}} - test('to test the property `{{{name}}}`', () async { - // TODO - }); - - {{/vars}} - - }); - -} -{{/model}} -{{/models}} diff --git a/modules/openapi-generator/src/main/resources/dart2/pubspec.mustache b/modules/openapi-generator/src/main/resources/dart2/pubspec.mustache index 4ce12df9e486..e7b728d195f2 100644 --- a/modules/openapi-generator/src/main/resources/dart2/pubspec.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/pubspec.mustache @@ -7,15 +7,13 @@ version: '{{{pubVersion}}}' description: '{{{pubDescription}}}' homepage: '{{{pubHomepage}}}' environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.14.0 <3.0.0' dependencies: http: '>=0.13.0 <0.14.0' intl: '^0.17.0' - meta: '^1.1.8' {{#json_serializable}} - json_annotation: '^3.1.1'{{/json_serializable}} + json_annotation: '^4.1.0'{{/json_serializable}} dev_dependencies: - test: '>=1.16.0 <1.18.0' {{#json_serializable}} - build_runner: '^1.10.9' - json_serializable: '^3.5.1'{{/json_serializable}} + build_runner: '^2.1.4' + json_serializable: '^5.0.2'{{/json_serializable}} diff --git a/modules/openapi-generator/src/main/resources/dart2/serialization/json_serializable/json_serializable_class.mustache b/modules/openapi-generator/src/main/resources/dart2/serialization/json_serializable/json_serializable_class.mustache index ec97f23eb726..0e57b0ecff37 100644 --- a/modules/openapi-generator/src/main/resources/dart2/serialization/json_serializable/json_serializable_class.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/serialization/json_serializable/json_serializable_class.mustache @@ -9,27 +9,27 @@ class {{{classname}}} { {{#vars}} {{#description}} - /// {{{.}}} + /// {{{.}}} {{/description}} {{^isEnum}} {{#minimum}} - // minimum: {{{.}}} + // minimum: {{{.}}} {{/minimum}} {{#maximum}} - // maximum: {{{.}}} + // maximum: {{{.}}} {{/maximum}} {{/isEnum}} {{^isBinary}} @JsonKey( - {{#defaultValue}}defaultValue: {{{.}}},{{/defaultValue}}{{^defaultValue}}nullable: {{isNullable}},{{/defaultValue}} - name: r'{{{baseName}}}', + {{#defaultValue}}defaultValue: {{{.}}}, + {{/defaultValue}}name: r'{{{baseName}}}', required: {{#required}}true{{/required}}{{^required}}false{{/required}}, ) {{/isBinary}} {{#isBinary}} @JsonKey(ignore: true) {{/isBinary}} - {{{datatypeWithEnum}}} {{{name}}}; + {{{datatypeWithEnum}}}{{^required}}?{{/required}} {{{name}}}; {{/vars}} @override @@ -41,7 +41,7 @@ class {{{classname}}} { @override int get hashCode => {{#vars}} - ({{{name}}} == null ? 0 : {{{name}}}.hashCode){{^-last}} +{{/-last}}{{#-last}};{{/-last}} + {{{name}}}.hashCode{{^-last}} +{{/-last}}{{#-last}};{{/-last}} {{/vars}} factory {{{classname}}}.fromJson(Map json) => _${{{classname}}}FromJson(json); @@ -64,4 +64,4 @@ class {{{classname}}} { {{/mostInnerItems}} {{/isContainer}} {{/isEnum}} -{{/vars}} \ No newline at end of file +{{/vars}} diff --git a/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_class.mustache b/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_class.mustache index 0efe1455c4b5..7bbf7c9d1681 100644 --- a/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_class.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_class.mustache @@ -13,7 +13,7 @@ class {{{classname}}} { // maximum: {{{.}}} {{/maximum}} {{/isEnum}} - {{{datatypeWithEnum}}} {{{name}}}; + {{{datatypeWithEnum}}}{{^required}}?{{/required}} {{{name}}}; {{/vars}} @override @@ -24,9 +24,8 @@ class {{{classname}}} { @override int get hashCode => - // ignore: unnecessary_parenthesis {{#vars}} - ({{{name}}} == null ? 0 : {{{name}}}.hashCode){{^-last}} +{{/-last}}{{#-last}};{{/-last}} + {{{name}}}.hashCode{{^-last}} +{{/-last}}{{#-last}};{{/-last}} {{/vars}} @override @@ -45,17 +44,17 @@ class {{{classname}}} { : {{{name}}}.toUtc().toIso8601String(); {{/pattern}} {{^pattern}} - json[r'{{{baseName}}}'] = {{#required}}{{#isNullable}}{{{name}}} == null ? null : {{/isNullable}}{{/required}}{{{name}}}.toUtc().toIso8601String(); + json[r'{{{baseName}}}'] = {{{name}}}{{^required}}!{{/required}}.toUtc().toIso8601String(); {{/pattern}} {{/isDateTime}} {{#isDate}} {{#pattern}} json[r'{{{baseName}}}'] = {{#required}}{{#isNullable}}{{{name}}} == null ? null : {{/isNullable}}{{/required}}_dateEpochMarker == '{{{pattern}}}' ? {{{name}}}.millisecondsSinceEpoch - : _dateFormatter.format({{{name}}}.toUtc()); + : _dateFormatter.format({{{name}}}{{^required}}!{{/required}}.toUtc()); {{/pattern}} {{^pattern}} - json[r'{{{baseName}}}'] = {{#required}}{{#isNullable}}{{{name}}} == null ? null : {{/isNullable}}{{/required}}_dateFormatter.format({{{name}}}.toUtc()); + json[r'{{{baseName}}}'] = {{#required}}{{#isNullable}}{{{name}}} == null ? null : {{/isNullable}}{{/required}}_dateFormatter.format({{{name}}}{{^required}}!{{/required}}.toUtc()); {{/pattern}} {{/isDate}} {{^isDateTime}} @@ -73,10 +72,7 @@ class {{{classname}}} { /// Returns a new [{{{classname}}}] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static {{{classname}}} fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return {{{classname}}}( + static {{{classname}}} fromJson(Map json) => {{{classname}}}( {{#vars}} {{#isDateTime}} {{{name}}}: mapDateTime(json, r'{{{baseName}}}', '{{{pattern}}}'), @@ -90,18 +86,23 @@ class {{{classname}}} { {{#isArray}} {{#items.isArray}} {{{name}}}: json[r'{{{baseName}}}'] is List - ? (json[r'{{{baseName}}}'] as List).map( + ? (json[r'{{{baseName}}}'] as List).map{{#items.complexType}}>{{/items.complexType}}( {{#items.complexType}} - {{items.complexType}}.listFromJson(json[r'{{{baseName}}}']) + (final j) => {{items.complexType}}.listFromJson(j) {{/items.complexType}} {{^items.complexType}} - (e) => e == null ? null : (e as List).cast<{{items.items.dataType}}>() + (e) => e == null ? <{{items.items.dataType}}>[] : (e as List).cast<{{items.items.dataType}}>() {{/items.complexType}} ).toList(growable: false) - : null, + : [], {{/items.isArray}} {{^items.isArray}} + {{#isPrimitiveType}} + {{{name}}}: (json[r'{{{baseName}}}'] as List).cast<{{{complexType}}}>(), + {{/isPrimitiveType}} + {{^isPrimitiveType}} {{{name}}}: {{{complexType}}}.listFromJson(json[r'{{{baseName}}}']), + {{/isPrimitiveType}} {{/items.isArray}} {{/isArray}} {{^isArray}} @@ -113,7 +114,7 @@ class {{{classname}}} { : {{items.complexType}}.mapListFromJson(json[r'{{{baseName}}}']), {{/items.complexType}} {{^items.complexType}} - : mapCastOfType(json, r'{{{baseName}}}'), + : json[r'{{{baseName}}}'] as Map, {{/items.complexType}} {{/items.isArray}} {{^items.isArray}} @@ -122,11 +123,11 @@ class {{{classname}}} { {{{name}}}: {{items.complexType}}.mapFromJson(json[r'{{{baseName}}}']), {{/items.complexType}} {{^items.complexType}} - {{{name}}}: mapCastOfType(json, r'{{{baseName}}}'), + {{{name}}}: json[r'{{{baseName}}}'] as Map, {{/items.complexType}} {{/items.isMap}} {{^items.isMap}} - {{{name}}}: mapValueOfType<{{{datatypeWithEnum}}}>(json, r'{{{baseName}}}'), + {{{name}}}: json[r'{{{baseName}}}'] as {{{datatypeWithEnum}}}, {{/items.isMap}} {{/items.isArray}} {{/isMap}} @@ -148,42 +149,32 @@ class {{{classname}}} { {{^isEnum}} {{{name}}}: json[r'{{{baseName}}}'] is {{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}} ? (json[r'{{{baseName}}}'] as {{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}).cast<{{{items.datatype}}}>() - : null, + : {{#uniqueItems}}{}{{/uniqueItems}}{{^uniqueItems}}[]{{/uniqueItems}}, {{/isEnum}} {{/isArray}} {{^isArray}} {{#isMap}} - {{{name}}}: mapCastOfType(json, r'{{{baseName}}}'), + {{{name}}}: json[r'{{{baseName}}}'] as Map, {{/isMap}} {{^isMap}} - {{#isNumber}} - {{{name}}}: json[r'{{{baseName}}}'] == null - ? null - : {{{datatypeWithEnum}}}.parse(json[r'{{{baseName}}}'].toString()), - {{/isNumber}} - {{^isNumber}} {{^isEnum}} - {{{name}}}: mapValueOfType<{{{datatypeWithEnum}}}>(json, r'{{{baseName}}}'), + {{{name}}}: json[r'{{{baseName}}}'] as {{{datatypeWithEnum}}}, {{/isEnum}} {{#isEnum}} {{{name}}}: {{{enumName}}}.fromJson(json[r'{{{baseName}}}']), {{/isEnum}} - {{/isNumber}} {{/isMap}} {{/isArray}} {{/complexType}} {{/isDate}} {{/isDateTime}} {{/vars}} - ); - } - return null; - } + ); - static List<{{{classname}}}> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map({{{classname}}}.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : <{{{classname}}}>[]; + static List<{{{classname}}}> listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map<{{{classname}}}>((i) => {{{classname}}}.fromJson(i as Map)).toList(growable: true == growable) + : <{{{classname}}}>[]; static Map mapFromJson(dynamic json) { final map = {}; @@ -196,7 +187,7 @@ class {{{classname}}} { } // maps a json object with a list of {{{classname}}}-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -204,7 +195,6 @@ class {{{classname}}} { .forEach((key, dynamic value) { map[key] = {{{classname}}}.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); @@ -225,4 +215,4 @@ class {{{classname}}} { {{/mostInnerItems}} {{/isContainer}} {{/isEnum}} -{{/vars}} \ No newline at end of file +{{/vars}} diff --git a/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_enum.mustache b/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_enum.mustache index f686a20a2f69..9766ed3c5a90 100644 --- a/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_enum.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_enum.mustache @@ -4,12 +4,12 @@ class {{{classname}}} { const {{{classname}}}._(this.value); /// The underlying value of this enum member. - final {{{dataType}}} value; + final {{{dataType}}}? value; @override String toString() => {{#isString}}value ?? ''{{/isString}}{{^isString}}value == null ? '' : value.toString(){{/isString}}; - {{{dataType}}} toJson() => value; + {{{dataType}}}? toJson() => value; {{#allowableValues}} {{#enumVars}} @@ -29,10 +29,10 @@ class {{{classname}}} { static {{{classname}}} fromJson(dynamic value) => {{{classname}}}TypeTransformer().decode(value); - static List<{{{classname}}}> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map({{{classname}}}.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : <{{{classname}}}>[]; + static List<{{{classname}}}> listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map<{{{classname}}}>((i) => {{{classname}}}.fromJson(i as Map)).toList(growable: true == growable) + : <{{{classname}}}>[]; } /// Transformation class that can [encode] an instance of [{{{classname}}}] to {{{dataType}}}, @@ -42,33 +42,23 @@ class {{{classname}}}TypeTransformer { const {{{classname}}}TypeTransformer._(); - {{{dataType}}} encode({{{classname}}} data) => data.value; + {{{dataType}}}? encode({{{classname}}} data) => data.value; /// Decodes a [dynamic value][data] to a {{{classname}}}. /// - /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, - /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] - /// cannot be decoded successfully, then an [UnimplementedError] is thrown. - /// - /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, - /// and users are still using an old app with the old code. - {{{classname}}} decode(dynamic data, {bool allowNull}) { - if (data != null) { - switch (data.toString()) { - {{#allowableValues}} - {{#enumVars}} - case {{#isString}}r{{/isString}}{{{value}}}: return {{{classname}}}.{{{name}}}; - {{/enumVars}} - {{/allowableValues}} - default: - if (allowNull == false) { - throw ArgumentError('Unknown enum value to decode: $data'); - } - } + /// If the [dynamic value][data] cannot be decoded successfully, then an [UnimplementedError] is thrown. + {{{classname}}} decode(dynamic data) { + {{#allowableValues}} + {{#enumVars}} + if (data == {{#isString}}r{{/isString}}{{{value}}}) { + return {{{classname}}}.{{{name}}}; } - return null; + {{/enumVars}} + {{/allowableValues}} + throw ArgumentError('Unknown enum value to decode: $data'); + } /// Singleton [{{{classname}}}TypeTransformer] instance. - static {{{classname}}}TypeTransformer _instance; + static {{{classname}}}TypeTransformer? _instance; } diff --git a/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_enum_inline.mustache b/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_enum_inline.mustache index d01b1676aadd..fac964639e8c 100644 --- a/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_enum_inline.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_enum_inline.mustache @@ -4,12 +4,12 @@ class {{{enumName}}} { const {{{enumName}}}._(this.value); /// The underlying value of this enum member. - final {{{dataType}}} value; + final {{{dataType}}}? value; @override String toString() => {{#isString}}value ?? ''{{/isString}}{{^isString}}value == null ? '' : value.toString(){{/isString}}; - {{{dataType}}} toJson() => value; + {{{dataType}}}? toJson() => value; {{#allowableValues}} {{#enumVars}} @@ -29,10 +29,10 @@ class {{{enumName}}} { static {{{enumName}}} fromJson(dynamic value) => {{{enumName}}}TypeTransformer().decode(value); - static List<{{{enumName}}}> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map({{{enumName}}}.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : <{{{enumName}}}>[]; + static List<{{{enumName}}}> listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map<{{{enumName}}}>((i) => {{{enumName}}}.fromJson(i as Map)).toList(growable: true == growable) + : <{{{enumName}}}>[]; } /// Transformation class that can [encode] an instance of [{{{enumName}}}] to {{{dataType}}}, @@ -42,33 +42,22 @@ class {{{enumName}}}TypeTransformer { const {{{enumName}}}TypeTransformer._(); - {{{dataType}}} encode({{{enumName}}} data) => data.value; + {{{dataType}}}? encode({{{enumName}}} data) => data.value; /// Decodes a [dynamic value][data] to a {{{enumName}}}. /// - /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, - /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] - /// cannot be decoded successfully, then an [UnimplementedError] is thrown. - /// - /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, - /// and users are still using an old app with the old code. - {{{enumName}}} decode(dynamic data, {bool allowNull}) { - if (data != null) { - switch (data.toString()) { - {{#allowableValues}} - {{#enumVars}} - case {{#isString}}r{{/isString}}{{{value}}}: return {{{enumName}}}.{{{name}}}; - {{/enumVars}} - {{/allowableValues}} - default: - if (allowNull == false) { - throw ArgumentError('Unknown enum value to decode: $data'); - } - } + /// If the [dynamic value][data] cannot be decoded successfully, then an [UnimplementedError] is thrown. + {{{enumName}}} decode(dynamic data) { + {{#allowableValues}} + {{#enumVars}} + if (data == {{#isString}}r{{/isString}}{{{value}}}) { + return {{{enumName}}}.{{{name}}}; } - return null; + {{/enumVars}} + {{/allowableValues}} + throw ArgumentError('Unknown enum value to decode: $data'); } /// Singleton [{{{enumName}}}TypeTransformer] instance. - static {{{enumName}}}TypeTransformer _instance; + static {{{enumName}}}TypeTransformer? _instance; } diff --git a/modules/openapi-generator/src/main/resources/dart2/travis.mustache b/modules/openapi-generator/src/main/resources/dart2/travis.mustache index 1a3af66d54c7..86197dbb22c8 100644 --- a/modules/openapi-generator/src/main/resources/dart2/travis.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/travis.mustache @@ -6,7 +6,7 @@ language: dart dart: # Install a specific stable release -- "2.2.0" +- "2.14.2" install: - pub get From 7444a1093aef620c5fdd043b7208bf731c97bd2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kate=20D=C3=B6en?= Date: Wed, 6 Oct 2021 14:31:59 +0200 Subject: [PATCH 2/2] Update dart2 client samples --- .../doc/FakeApi.md | 70 +-- .../doc/PetApi.md | 28 +- .../doc/StoreApi.md | 7 +- .../doc/UserApi.md | 42 +- .../lib/src/api/fake_api.dart | 330 ++++++++++++-- .../lib/src/api/pet_api.dart | 132 +++++- .../lib/src/api/store_api.dart | 33 +- .../lib/src/api/user_api.dart | 198 ++++++++- .../lib/src/model/enum_test.dart | 4 +- .../petstore_client_lib_fake/doc/FakeApi.md | 70 +-- .../petstore_client_lib_fake/doc/PetApi.md | 28 +- .../petstore_client_lib_fake/doc/StoreApi.md | 7 +- .../petstore_client_lib_fake/doc/UserApi.md | 42 +- .../lib/src/api/fake_api.dart | 330 ++++++++++++-- .../lib/src/api/pet_api.dart | 132 +++++- .../lib/src/api/store_api.dart | 33 +- .../lib/src/api/user_api.dart | 198 ++++++++- .../lib/src/model/enum_test.dart | 4 +- .../petstore_client_lib/doc/PetApi.md | 14 +- .../petstore_client_lib/doc/StoreApi.md | 7 +- .../petstore_client_lib/doc/UserApi.md | 42 +- .../petstore_client_lib/lib/api/pet_api.dart | 38 +- .../lib/api/store_api.dart | 19 +- .../petstore_client_lib/lib/api/user_api.dart | 114 ++++- .../petstore_client_lib_fake/doc/FakeApi.md | 70 +-- .../petstore_client_lib_fake/doc/PetApi.md | 28 +- .../petstore_client_lib_fake/doc/StoreApi.md | 7 +- .../petstore_client_lib_fake/doc/UserApi.md | 42 +- .../lib/api/fake_api.dart | 190 +++++++- .../lib/api/pet_api.dart | 76 +++- .../lib/api/store_api.dart | 19 +- .../lib/api/user_api.dart | 114 ++++- .../lib/model/enum_test.dart | 4 +- .../client/petstore/dart2/petstore/README.md | 37 -- .../client/petstore/dart2/petstore/pom.xml | 73 --- .../petstore/dart2/petstore/pubspec.lock | 418 ------------------ .../petstore/dart2/petstore/pubspec.yaml | 19 - .../dart2/petstore/test/fake_client.dart | 134 ------ .../petstore/test/file_upload_response.json | 1 - .../petstore/test/inventory_response.json | 1 - .../dart2/petstore/test/order_model_test.dart | 9 - .../petstore/test/pet_faked_client_test.dart | 223 ---------- .../dart2/petstore/test/pet_test.dart | 101 ----- .../dart2/petstore/test/random_id.dart | 7 - .../test/store_faked_client_test.dart | 83 ---- .../dart2/petstore/test/store_test.dart | 42 -- .../petstore/test/user_faked_client_test.dart | 180 -------- .../dart2/petstore/test/user_test.dart | 79 ---- .../dart2/petstore_client_lib/.gitignore | 32 +- .../dart2/petstore_client_lib/.travis.yml | 2 +- .../dart2/petstore_client_lib/README.md | 2 +- .../dart2/petstore_client_lib/doc/PetApi.md | 14 +- .../dart2/petstore_client_lib/doc/StoreApi.md | 7 +- .../dart2/petstore_client_lib/doc/UserApi.md | 42 +- .../dart2/petstore_client_lib/lib/api.dart | 2 +- .../petstore_client_lib/lib/api/pet_api.dart | 112 ++--- .../lib/api/store_api.dart | 50 +-- .../petstore_client_lib/lib/api/user_api.dart | 119 +++-- .../petstore_client_lib/lib/api_client.dart | 41 +- .../lib/api_exception.dart | 8 +- .../petstore_client_lib/lib/api_helper.dart | 32 +- .../lib/auth/api_key_auth.dart | 6 +- .../lib/auth/authentication.dart | 2 +- .../lib/auth/http_basic_auth.dart | 6 +- .../lib/auth/http_bearer_auth.dart | 2 +- .../petstore_client_lib/lib/auth/oauth.dart | 4 +- .../lib/model/api_response.dart | 43 +- .../lib/model/category.dart | 37 +- .../petstore_client_lib/lib/model/order.dart | 104 ++--- .../petstore_client_lib/lib/model/pet.dart | 98 ++-- .../petstore_client_lib/lib/model/tag.dart | 37 +- .../petstore_client_lib/lib/model/user.dart | 75 ++-- .../dart2/petstore_client_lib/pom.xml | 73 --- .../dart2/petstore_client_lib/pubspec.yaml | 4 +- .../test/api_response_test.dart | 36 -- .../test/category_test.dart | 31 -- .../petstore_client_lib/test/order_test.dart | 52 --- .../test/pet_api_test.dart | 82 ---- .../petstore_client_lib/test/pet_test.dart | 52 --- .../test/store_api_test.dart | 54 --- .../petstore_client_lib/test/tag_test.dart | 31 -- .../test/user_api_test.dart | 82 ---- .../petstore_client_lib/test/user_test.dart | 62 --- .../dart2/petstore_client_lib_fake/.gitignore | 32 +- .../petstore_client_lib_fake/.travis.yml | 2 +- .../dart2/petstore_client_lib_fake/README.md | 2 +- .../petstore_client_lib_fake/doc/FakeApi.md | 70 +-- .../doc/NullableClass.md | 12 +- .../petstore_client_lib_fake/doc/PetApi.md | 28 +- .../petstore_client_lib_fake/doc/StoreApi.md | 7 +- .../petstore_client_lib_fake/doc/UserApi.md | 42 +- .../petstore_client_lib_fake/lib/api.dart | 2 +- .../lib/api/another_fake_api.dart | 16 +- .../lib/api/default_api.dart | 11 +- .../lib/api/fake_api.dart | 272 +++++------- .../lib/api/fake_classname_tags123_api.dart | 16 +- .../lib/api/pet_api.dart | 135 +++--- .../lib/api/store_api.dart | 50 +-- .../lib/api/user_api.dart | 119 +++-- .../lib/api_client.dart | 41 +- .../lib/api_exception.dart | 8 +- .../lib/api_helper.dart | 32 +- .../lib/auth/api_key_auth.dart | 6 +- .../lib/auth/authentication.dart | 2 +- .../lib/auth/http_basic_auth.dart | 6 +- .../lib/auth/http_bearer_auth.dart | 2 +- .../lib/auth/oauth.dart | 4 +- .../model/additional_properties_class.dart | 37 +- .../lib/model/animal.dart | 37 +- .../lib/model/api_response.dart | 43 +- .../model/array_of_array_of_number_only.dart | 33 +- .../lib/model/array_of_number_only.dart | 31 +- .../lib/model/array_test.dart | 49 +- .../lib/model/capitalization.dart | 63 ++- .../lib/model/cat.dart | 43 +- .../lib/model/cat_all_of.dart | 31 +- .../lib/model/category.dart | 35 +- .../lib/model/class_model.dart | 31 +- .../lib/model/deprecated_object.dart | 31 +- .../lib/model/dog.dart | 43 +- .../lib/model/dog_all_of.dart | 31 +- .../lib/model/enum_arrays.dart | 115 ++--- .../lib/model/enum_class.dart | 48 +- .../lib/model/enum_test.dart | 233 ++++------ .../lib/model/file_schema_test_class.dart | 33 +- .../lib/model/foo.dart | 31 +- .../lib/model/format_test.dart | 119 +++-- .../lib/model/has_only_read_only.dart | 37 +- .../lib/model/health_check_result.dart | 31 +- .../lib/model/inline_response_default.dart | 29 +- .../lib/model/map_test.dart | 92 ++-- ...rties_and_additional_properties_class.dart | 43 +- .../lib/model/model200_response.dart | 37 +- .../lib/model/model_client.dart | 31 +- .../lib/model/model_file.dart | 31 +- .../lib/model/model_list.dart | 31 +- .../lib/model/model_return.dart | 31 +- .../lib/model/name.dart | 51 +-- .../lib/model/nullable_class.dart | 101 ++--- .../lib/model/number_only.dart | 33 +- .../model/object_with_deprecated_fields.dart | 49 +- .../lib/model/order.dart | 104 ++--- .../lib/model/outer_composite.dart | 45 +- .../lib/model/outer_enum.dart | 48 +- .../lib/model/outer_enum_default_value.dart | 48 +- .../lib/model/outer_enum_integer.dart | 48 +- .../outer_enum_integer_default_value.dart | 48 +- .../outer_object_with_enum_property.dart | 29 +- .../lib/model/pet.dart | 98 ++-- .../lib/model/read_only_first.dart | 37 +- .../lib/model/special_model_name.dart | 31 +- .../lib/model/tag.dart | 37 +- .../lib/model/user.dart | 75 ++-- .../dart2/petstore_client_lib_fake/pom.xml | 73 --- .../petstore_client_lib_fake/pubspec.yaml | 4 +- .../additional_properties_class_test.dart | 31 -- .../test/animal_test.dart | 31 -- .../test/another_fake_api_test.dart | 29 -- .../test/api_response_test.dart | 36 -- .../array_of_array_of_number_only_test.dart | 26 -- .../test/array_of_number_only_test.dart | 26 -- .../test/array_test_test.dart | 36 -- .../test/capitalization_test.dart | 52 --- .../test/cat_all_of_test.dart | 26 -- .../test/cat_test.dart | 36 -- .../test/category_test.dart | 31 -- .../test/class_model_test.dart | 26 -- .../test/default_api_test.dart | 25 -- .../test/deprecated_object_test.dart | 26 -- .../test/dog_all_of_test.dart | 26 -- .../test/dog_test.dart | 36 -- .../test/enum_arrays_test.dart | 31 -- .../test/enum_class_test.dart | 20 - .../test/enum_test_test.dart | 61 --- .../test/fake_api_test.dart | 138 ------ .../test/fake_classname_tags123_api_test.dart | 29 -- .../test/file_schema_test_class_test.dart | 31 -- .../test/foo_test.dart | 26 -- .../test/format_test_test.dart | 103 ----- .../test/has_only_read_only_test.dart | 31 -- .../test/health_check_result_test.dart | 26 -- .../test/inline_response_default_test.dart | 26 -- .../test/map_test_test.dart | 41 -- ..._and_additional_properties_class_test.dart | 36 -- .../test/model200_response_test.dart | 31 -- .../test/model_client_test.dart | 26 -- .../test/model_file_test.dart | 27 -- .../test/model_list_test.dart | 26 -- .../test/model_return_test.dart | 26 -- .../test/name_test.dart | 41 -- .../test/nullable_class_test.dart | 81 ---- .../test/number_only_test.dart | 26 -- .../object_with_deprecated_fields_test.dart | 41 -- .../test/order_test.dart | 52 --- .../test/outer_composite_test.dart | 36 -- .../test/outer_enum_default_value_test.dart | 20 - ...outer_enum_integer_default_value_test.dart | 20 - .../test/outer_enum_integer_test.dart | 20 - .../test/outer_enum_test.dart | 20 - .../outer_object_with_enum_property_test.dart | 26 -- .../test/pet_api_test.dart | 89 ---- .../test/pet_test.dart | 52 --- .../test/read_only_first_test.dart | 31 -- .../test/special_model_name_test.dart | 26 -- .../test/store_api_test.dart | 54 --- .../test/tag_test.dart | 31 -- .../test/user_api_test.dart | 82 ---- .../test/user_test.dart | 62 --- .../.gitignore | 32 +- .../.travis.yml | 2 +- .../README.md | 2 +- .../doc/FakeApi.md | 70 +-- .../doc/NullableClass.md | 12 +- .../doc/PetApi.md | 28 +- .../doc/StoreApi.md | 7 +- .../doc/UserApi.md | 42 +- .../lib/api.dart | 2 +- .../lib/api/another_fake_api.dart | 16 +- .../lib/api/default_api.dart | 11 +- .../lib/api/fake_api.dart | 282 +++++------- .../lib/api/fake_classname_tags123_api.dart | 16 +- .../lib/api/pet_api.dart | 139 +++--- .../lib/api/store_api.dart | 51 +-- .../lib/api/user_api.dart | 125 +++--- .../lib/api_client.dart | 19 +- .../lib/api_exception.dart | 8 +- .../lib/api_helper.dart | 32 +- .../lib/auth/api_key_auth.dart | 6 +- .../lib/auth/authentication.dart | 2 +- .../lib/auth/http_basic_auth.dart | 6 +- .../lib/auth/http_bearer_auth.dart | 2 +- .../lib/auth/oauth.dart | 4 +- .../model/additional_properties_class.dart | 11 +- .../lib/model/animal.dart | 12 +- .../lib/model/api_response.dart | 18 +- .../model/array_of_array_of_number_only.dart | 7 +- .../lib/model/array_of_number_only.dart | 7 +- .../lib/model/array_test.dart | 15 +- .../lib/model/capitalization.dart | 35 +- .../lib/model/cat.dart | 17 +- .../lib/model/cat_all_of.dart | 8 +- .../lib/model/category.dart | 10 +- .../lib/model/class_model.dart | 8 +- .../lib/model/deprecated_object.dart | 8 +- .../lib/model/dog.dart | 17 +- .../lib/model/dog_all_of.dart | 8 +- .../lib/model/enum_arrays.dart | 12 +- .../lib/model/enum_class.dart | 2 +- .../lib/model/enum_test.dart | 43 +- .../lib/model/file_schema_test_class.dart | 12 +- .../lib/model/foo.dart | 7 +- .../lib/model/format_test.dart | 106 ++--- .../lib/model/has_only_read_only.dart | 13 +- .../lib/model/health_check_result.dart | 8 +- .../lib/model/inline_response_default.dart | 8 +- .../lib/model/map_test.dart | 19 +- ...rties_and_additional_properties_class.dart | 17 +- .../lib/model/model200_response.dart | 13 +- .../lib/model/model_client.dart | 8 +- .../lib/model/model_file.dart | 10 +- .../lib/model/model_list.dart | 8 +- .../lib/model/model_return.dart | 8 +- .../lib/model/name.dart | 23 +- .../lib/model/nullable_class.dart | 57 ++- .../lib/model/number_only.dart | 8 +- .../model/object_with_deprecated_fields.dart | 22 +- .../lib/model/order.dart | 34 +- .../lib/model/outer_composite.dart | 18 +- .../lib/model/outer_enum.dart | 2 +- .../lib/model/outer_enum_default_value.dart | 2 +- .../lib/model/outer_enum_integer.dart | 2 +- .../outer_enum_integer_default_value.dart | 2 +- .../outer_object_with_enum_property.dart | 8 +- .../lib/model/pet.dart | 31 +- .../lib/model/read_only_first.dart | 13 +- .../lib/model/special_model_name.dart | 8 +- .../lib/model/tag.dart | 13 +- .../lib/model/user.dart | 45 +- .../pom.xml | 88 ---- .../pubspec.yaml | 10 +- .../additional_properties_class_test.dart | 31 -- .../test/animal_test.dart | 31 -- .../test/another_fake_api_test.dart | 29 -- .../test/api_response_test.dart | 36 -- .../array_of_array_of_number_only_test.dart | 26 -- .../test/array_of_number_only_test.dart | 26 -- .../test/array_test_test.dart | 36 -- .../test/capitalization_test.dart | 52 --- .../test/cat_all_of_test.dart | 26 -- .../test/cat_test.dart | 36 -- .../test/category_test.dart | 31 -- .../test/class_model_test.dart | 26 -- .../test/default_api_test.dart | 25 -- .../test/deprecated_object_test.dart | 26 -- .../test/dog_all_of_test.dart | 26 -- .../test/dog_test.dart | 36 -- .../test/enum_arrays_test.dart | 31 -- .../test/enum_class_test.dart | 20 - .../test/enum_test_test.dart | 61 --- .../test/fake_api_test.dart | 138 ------ .../test/fake_classname_tags123_api_test.dart | 29 -- .../test/file_schema_test_class_test.dart | 31 -- .../test/foo_test.dart | 26 -- .../test/format_test_test.dart | 103 ----- .../test/has_only_read_only_test.dart | 31 -- .../test/health_check_result_test.dart | 26 -- .../test/inline_response_default_test.dart | 26 -- .../test/map_test_test.dart | 41 -- ..._and_additional_properties_class_test.dart | 36 -- .../test/model200_response_test.dart | 31 -- .../test/model_client_test.dart | 26 -- .../test/model_file_test.dart | 27 -- .../test/model_list_test.dart | 26 -- .../test/model_return_test.dart | 26 -- .../test/name_test.dart | 41 -- .../test/nullable_class_test.dart | 81 ---- .../test/number_only_test.dart | 26 -- .../object_with_deprecated_fields_test.dart | 41 -- .../test/order_test.dart | 52 --- .../test/outer_composite_test.dart | 36 -- .../test/outer_enum_default_value_test.dart | 20 - ...outer_enum_integer_default_value_test.dart | 20 - .../test/outer_enum_integer_test.dart | 20 - .../test/outer_enum_test.dart | 20 - .../outer_object_with_enum_property_test.dart | 26 -- .../test/pet_api_test.dart | 89 ---- .../test/pet_test.dart | 52 --- .../test/read_only_first_test.dart | 31 -- .../test/special_model_name_test.dart | 26 -- .../test/store_api_test.dart | 54 --- .../test/tag_test.dart | 31 -- .../test/user_api_test.dart | 82 ---- .../test/user_test.dart | 62 --- 333 files changed, 4607 insertions(+), 9959 deletions(-) delete mode 100644 samples/openapi3/client/petstore/dart2/petstore/README.md delete mode 100644 samples/openapi3/client/petstore/dart2/petstore/pom.xml delete mode 100644 samples/openapi3/client/petstore/dart2/petstore/pubspec.lock delete mode 100644 samples/openapi3/client/petstore/dart2/petstore/pubspec.yaml delete mode 100644 samples/openapi3/client/petstore/dart2/petstore/test/fake_client.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore/test/file_upload_response.json delete mode 100644 samples/openapi3/client/petstore/dart2/petstore/test/inventory_response.json delete mode 100644 samples/openapi3/client/petstore/dart2/petstore/test/order_model_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore/test/pet_faked_client_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore/test/pet_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore/test/random_id.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore/test/store_faked_client_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore/test/store_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore/test/user_faked_client_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore/test/user_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/pom.xml delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/api_response_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/category_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/order_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_api_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/store_api_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/tag_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_api_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/pom.xml delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/additional_properties_class_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/animal_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/another_fake_api_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/api_response_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_array_of_number_only_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_number_only_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_test_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/capitalization_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_all_of_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/category_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/class_model_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/default_api_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/deprecated_object_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_all_of_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_arrays_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_class_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_test_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_api_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_classname_tags123_api_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/file_schema_test_class_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/foo_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/format_test_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/has_only_read_only_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/health_check_result_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_response_default_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/map_test_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model200_response_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_client_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_file_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_list_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_return_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/name_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/nullable_class_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/number_only_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/object_with_deprecated_fields_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/order_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_composite_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_default_value_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_default_value_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_object_with_enum_property_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_api_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/read_only_first_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/special_model_name_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/store_api_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/tag_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_api_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/pom.xml delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/additional_properties_class_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/animal_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/another_fake_api_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/api_response_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_of_array_of_number_only_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_of_number_only_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_test_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/capitalization_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/cat_all_of_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/cat_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/category_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/class_model_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/default_api_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/deprecated_object_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/dog_all_of_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/dog_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_arrays_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_class_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_test_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/fake_api_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/fake_classname_tags123_api_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/file_schema_test_class_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/foo_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/format_test_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/has_only_read_only_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/health_check_result_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/inline_response_default_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/map_test_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model200_response_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_client_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_file_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_list_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_return_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/name_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/nullable_class_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/number_only_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/object_with_deprecated_fields_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/order_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_composite_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_default_value_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_integer_default_value_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_integer_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_object_with_enum_property_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/pet_api_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/pet_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/read_only_first_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/special_model_name_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/store_api_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/tag_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/user_api_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/user_test.dart diff --git a/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/doc/FakeApi.md b/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/doc/FakeApi.md index 740e5ee66833..8a7b517f9929 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/doc/FakeApi.md +++ b/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/doc/FakeApi.md @@ -66,7 +66,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) # **fakeHttpSignatureTest** -> fakeHttpSignatureTest(pet, query1, header1) +> Map fakeHttpSignatureTest(pet, query1, header1) test http signature authentication @@ -83,7 +83,8 @@ final String query1 = query1_example; // String | query parameter final String header1 = header1_example; // String | header parameter try { - api.fakeHttpSignatureTest(pet, query1, header1); + final response = api.fakeHttpSignatureTest(pet, query1, header1); + print(response); } catch on DioError (e) { print('Exception when calling FakeApi->fakeHttpSignatureTest: $e\n'); } @@ -99,7 +100,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -328,7 +329,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) # **testBodyWithBinary** -> testBodyWithBinary(body) +> Map testBodyWithBinary(body) @@ -342,7 +343,8 @@ final api = Openapi().getFakeApi(); final MultipartFile body = BINARY_DATA_HERE; // MultipartFile | image to upload try { - api.testBodyWithBinary(body); + final response = api.testBodyWithBinary(body); + print(response); } catch on DioError (e) { print('Exception when calling FakeApi->testBodyWithBinary: $e\n'); } @@ -356,7 +358,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -370,7 +372,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) # **testBodyWithFileSchema** -> testBodyWithFileSchema(fileSchemaTestClass) +> Map testBodyWithFileSchema(fileSchemaTestClass) @@ -384,7 +386,8 @@ final api = Openapi().getFakeApi(); final FileSchemaTestClass fileSchemaTestClass = ; // FileSchemaTestClass | try { - api.testBodyWithFileSchema(fileSchemaTestClass); + final response = api.testBodyWithFileSchema(fileSchemaTestClass); + print(response); } catch on DioError (e) { print('Exception when calling FakeApi->testBodyWithFileSchema: $e\n'); } @@ -398,7 +401,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -412,7 +415,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) # **testBodyWithQueryParams** -> testBodyWithQueryParams(query, user) +> Map testBodyWithQueryParams(query, user) @@ -425,7 +428,8 @@ final String query = query_example; // String | final User user = ; // User | try { - api.testBodyWithQueryParams(query, user); + final response = api.testBodyWithQueryParams(query, user); + print(response); } catch on DioError (e) { print('Exception when calling FakeApi->testBodyWithQueryParams: $e\n'); } @@ -440,7 +444,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -497,7 +501,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) # **testEndpointParameters** -> testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) +> Map testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -527,7 +531,8 @@ final String password = password_example; // String | None final String callback = callback_example; // String | None try { - api.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); + final response = api.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); + print(response); } catch on DioError (e) { print('Exception when calling FakeApi->testEndpointParameters: $e\n'); } @@ -554,7 +559,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -568,7 +573,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) # **testEnumParameters** -> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) +> Map testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) To test enum parameters @@ -589,7 +594,8 @@ final BuiltList enumFormStringArray = ; // BuiltList | Form para final String enumFormString = enumFormString_example; // String | Form parameter enum test (string) try { - api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + final response = api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + print(response); } catch on DioError (e) { print('Exception when calling FakeApi->testEnumParameters: $e\n'); } @@ -610,7 +616,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -624,7 +630,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) # **testGroupParameters** -> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) +> Map testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) Fake endpoint to test group parameters (optional) @@ -646,7 +652,8 @@ final bool booleanGroup = true; // bool | Boolean in group parameters final int int64Group = 789; // int | Integer in group parameters try { - api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + final response = api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + print(response); } catch on DioError (e) { print('Exception when calling FakeApi->testGroupParameters: $e\n'); } @@ -665,7 +672,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -679,7 +686,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) # **testInlineAdditionalProperties** -> testInlineAdditionalProperties(requestBody) +> Map testInlineAdditionalProperties(requestBody) test inline additionalProperties @@ -691,7 +698,8 @@ final api = Openapi().getFakeApi(); final BuiltMap requestBody = ; // BuiltMap | request body try { - api.testInlineAdditionalProperties(requestBody); + final response = api.testInlineAdditionalProperties(requestBody); + print(response); } catch on DioError (e) { print('Exception when calling FakeApi->testInlineAdditionalProperties: $e\n'); } @@ -705,7 +713,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -719,7 +727,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) # **testJsonFormData** -> testJsonFormData(param, param2) +> Map testJsonFormData(param, param2) test json serialization of form data @@ -732,7 +740,8 @@ final String param = param_example; // String | field1 final String param2 = param2_example; // String | field2 try { - api.testJsonFormData(param, param2); + final response = api.testJsonFormData(param, param2); + print(response); } catch on DioError (e) { print('Exception when calling FakeApi->testJsonFormData: $e\n'); } @@ -747,7 +756,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -761,7 +770,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) # **testQueryParameterCollectionFormat** -> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) +> Map testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) @@ -781,7 +790,8 @@ final String allowEmpty = allowEmpty_example; // String | final BuiltMap language = ; // BuiltMap | try { - api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); + final response = api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); + print(response); } catch on DioError (e) { print('Exception when calling FakeApi->testQueryParameterCollectionFormat: $e\n'); } @@ -801,7 +811,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization diff --git a/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/doc/PetApi.md b/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/doc/PetApi.md index 6afc643ea56a..aa5855adc7c8 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/doc/PetApi.md +++ b/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/doc/PetApi.md @@ -21,7 +21,7 @@ Method | HTTP request | Description # **addPet** -> addPet(pet) +> Map addPet(pet) Add a new pet to the store @@ -35,7 +35,8 @@ final api = Openapi().getPetApi(); final Pet pet = ; // Pet | Pet object that needs to be added to the store try { - api.addPet(pet); + final response = api.addPet(pet); + print(response); } catch on DioError (e) { print('Exception when calling PetApi->addPet: $e\n'); } @@ -49,7 +50,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -63,7 +64,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) # **deletePet** -> deletePet(petId, apiKey) +> Map deletePet(petId, apiKey) Deletes a pet @@ -78,7 +79,8 @@ final int petId = 789; // int | Pet id to delete final String apiKey = apiKey_example; // String | try { - api.deletePet(petId, apiKey); + final response = api.deletePet(petId, apiKey); + print(response); } catch on DioError (e) { print('Exception when calling PetApi->deletePet: $e\n'); } @@ -93,7 +95,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -244,7 +246,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) # **updatePet** -> updatePet(pet) +> Map updatePet(pet) Update an existing pet @@ -258,7 +260,8 @@ final api = Openapi().getPetApi(); final Pet pet = ; // Pet | Pet object that needs to be added to the store try { - api.updatePet(pet); + final response = api.updatePet(pet); + print(response); } catch on DioError (e) { print('Exception when calling PetApi->updatePet: $e\n'); } @@ -272,7 +275,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -286,7 +289,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) # **updatePetWithForm** -> updatePetWithForm(petId, name, status) +> Map updatePetWithForm(petId, name, status) Updates a pet in the store with form data @@ -302,7 +305,8 @@ final String name = name_example; // String | Updated name of the pet final String status = status_example; // String | Updated status of the pet try { - api.updatePetWithForm(petId, name, status); + final response = api.updatePetWithForm(petId, name, status); + print(response); } catch on DioError (e) { print('Exception when calling PetApi->updatePetWithForm: $e\n'); } @@ -318,7 +322,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization diff --git a/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/doc/StoreApi.md b/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/doc/StoreApi.md index 5c8a683579e2..35cd9192f754 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/doc/StoreApi.md +++ b/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/doc/StoreApi.md @@ -16,7 +16,7 @@ Method | HTTP request | Description # **deleteOrder** -> deleteOrder(orderId) +> Map deleteOrder(orderId) Delete purchase order by ID @@ -30,7 +30,8 @@ final api = Openapi().getStoreApi(); final String orderId = orderId_example; // String | ID of the order that needs to be deleted try { - api.deleteOrder(orderId); + final response = api.deleteOrder(orderId); + print(response); } catch on DioError (e) { print('Exception when calling StoreApi->deleteOrder: $e\n'); } @@ -44,7 +45,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization diff --git a/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/doc/UserApi.md b/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/doc/UserApi.md index e3af05ffb087..63d49fb5f285 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/doc/UserApi.md +++ b/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/doc/UserApi.md @@ -20,7 +20,7 @@ Method | HTTP request | Description # **createUser** -> createUser(user) +> Map createUser(user) Create user @@ -34,7 +34,8 @@ final api = Openapi().getUserApi(); final User user = ; // User | Created user object try { - api.createUser(user); + final response = api.createUser(user); + print(response); } catch on DioError (e) { print('Exception when calling UserApi->createUser: $e\n'); } @@ -48,7 +49,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -62,7 +63,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) # **createUsersWithArrayInput** -> createUsersWithArrayInput(user) +> Map createUsersWithArrayInput(user) Creates list of users with given input array @@ -74,7 +75,8 @@ final api = Openapi().getUserApi(); final BuiltList user = ; // BuiltList | List of user object try { - api.createUsersWithArrayInput(user); + final response = api.createUsersWithArrayInput(user); + print(response); } catch on DioError (e) { print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); } @@ -88,7 +90,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -102,7 +104,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) # **createUsersWithListInput** -> createUsersWithListInput(user) +> Map createUsersWithListInput(user) Creates list of users with given input array @@ -114,7 +116,8 @@ final api = Openapi().getUserApi(); final BuiltList user = ; // BuiltList | List of user object try { - api.createUsersWithListInput(user); + final response = api.createUsersWithListInput(user); + print(response); } catch on DioError (e) { print('Exception when calling UserApi->createUsersWithListInput: $e\n'); } @@ -128,7 +131,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -142,7 +145,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) # **deleteUser** -> deleteUser(username) +> Map deleteUser(username) Delete user @@ -156,7 +159,8 @@ final api = Openapi().getUserApi(); final String username = username_example; // String | The name that needs to be deleted try { - api.deleteUser(username); + final response = api.deleteUser(username); + print(response); } catch on DioError (e) { print('Exception when calling UserApi->deleteUser: $e\n'); } @@ -170,7 +174,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -268,7 +272,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) # **logoutUser** -> logoutUser() +> Map logoutUser() Logs out current logged in user session @@ -279,7 +283,8 @@ import 'package:openapi/api.dart'; final api = Openapi().getUserApi(); try { - api.logoutUser(); + final response = api.logoutUser(); + print(response); } catch on DioError (e) { print('Exception when calling UserApi->logoutUser: $e\n'); } @@ -290,7 +295,7 @@ This endpoint does not need any parameter. ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -304,7 +309,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) # **updateUser** -> updateUser(username, user) +> Map updateUser(username, user) Updated user @@ -319,7 +324,8 @@ final String username = username_example; // String | name that need to be delet final User user = ; // User | Updated user object try { - api.updateUser(username, user); + final response = api.updateUser(username, user); + print(response); } catch on DioError (e) { print('Exception when calling UserApi->updateUser: $e\n'); } @@ -334,7 +340,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization diff --git a/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/lib/src/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/lib/src/api/fake_api.dart index d8640836000a..bcaf84800bd1 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/lib/src/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/lib/src/api/fake_api.dart @@ -113,9 +113,9 @@ class FakeApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> fakeHttpSignatureTest({ + Future>> fakeHttpSignatureTest({ required Pet pet, String? query1, String? header1, @@ -179,7 +179,34 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// fakeOuterBooleanSerialize @@ -644,9 +671,9 @@ class FakeApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> testBodyWithBinary({ + Future>> testBodyWithBinary({ MultipartFile? body, CancelToken? cancelToken, Map? headers, @@ -694,7 +721,34 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// testBodyWithFileSchema @@ -709,9 +763,9 @@ class FakeApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> testBodyWithFileSchema({ + Future>> testBodyWithFileSchema({ required FileSchemaTestClass fileSchemaTestClass, CancelToken? cancelToken, Map? headers, @@ -760,7 +814,34 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// testBodyWithQueryParams @@ -776,9 +857,9 @@ class FakeApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> testBodyWithQueryParams({ + Future>> testBodyWithQueryParams({ required String query, required User user, CancelToken? cancelToken, @@ -834,7 +915,34 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// To test \"client\" model @@ -955,9 +1063,9 @@ class FakeApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> testEndpointParameters({ + Future>> testEndpointParameters({ required num number, required double double_, required String patternWithoutDelimiter, @@ -1039,7 +1147,34 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// To test enum parameters @@ -1061,9 +1196,9 @@ class FakeApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> testEnumParameters({ + Future>> testEnumParameters({ BuiltList? enumHeaderStringArray, String? enumHeaderString = '-efg', BuiltList? enumQueryStringArray, @@ -1132,7 +1267,34 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Fake endpoint to test group parameters (optional) @@ -1152,9 +1314,9 @@ class FakeApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> testGroupParameters({ + Future>> testGroupParameters({ required int requiredStringGroup, required bool requiredBooleanGroup, required int requiredInt64Group, @@ -1205,7 +1367,34 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// test inline additionalProperties @@ -1220,9 +1409,9 @@ class FakeApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> testInlineAdditionalProperties({ + Future>> testInlineAdditionalProperties({ required BuiltMap requestBody, CancelToken? cancelToken, Map? headers, @@ -1271,7 +1460,34 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// test json serialization of form data @@ -1287,9 +1503,9 @@ class FakeApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> testJsonFormData({ + Future>> testJsonFormData({ required String param, required String param2, CancelToken? cancelToken, @@ -1341,7 +1557,34 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// testQueryParameterCollectionFormat @@ -1362,9 +1605,9 @@ class FakeApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> testQueryParameterCollectionFormat({ + Future>> testQueryParameterCollectionFormat({ required BuiltList pipe, required BuiltList ioutil, required BuiltList http, @@ -1411,7 +1654,34 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } } diff --git a/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/lib/src/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/lib/src/api/pet_api.dart index a1d8a0fc2d7a..9b381b4b2793 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/lib/src/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/lib/src/api/pet_api.dart @@ -32,9 +32,9 @@ class PetApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> addPet({ + Future>> addPet({ required Pet pet, CancelToken? cancelToken, Map? headers, @@ -88,7 +88,34 @@ class PetApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Deletes a pet @@ -104,9 +131,9 @@ class PetApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> deletePet({ + Future>> deletePet({ required int petId, String? apiKey, CancelToken? cancelToken, @@ -143,7 +170,34 @@ class PetApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Finds Pets by status @@ -408,9 +462,9 @@ class PetApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> updatePet({ + Future>> updatePet({ required Pet pet, CancelToken? cancelToken, Map? headers, @@ -464,7 +518,34 @@ class PetApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Updates a pet in the store with form data @@ -481,9 +562,9 @@ class PetApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> updatePetWithForm({ + Future>> updatePetWithForm({ required int petId, String? name, String? status, @@ -541,7 +622,34 @@ class PetApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// uploads an image diff --git a/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/lib/src/api/store_api.dart b/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/lib/src/api/store_api.dart index bb10a12cbe55..c3ba931fc8d4 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/lib/src/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/lib/src/api/store_api.dart @@ -30,9 +30,9 @@ class StoreApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> deleteOrder({ + Future>> deleteOrder({ required String orderId, CancelToken? cancelToken, Map? headers, @@ -62,7 +62,34 @@ class StoreApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Returns pet inventories by status diff --git a/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/lib/src/api/user_api.dart b/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/lib/src/api/user_api.dart index e628b862c029..bfabfdf86bfc 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/lib/src/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/lib/src/api/user_api.dart @@ -31,9 +31,9 @@ class UserApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> createUser({ + Future>> createUser({ required User user, CancelToken? cancelToken, Map? headers, @@ -82,7 +82,34 @@ class UserApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Creates list of users with given input array @@ -97,9 +124,9 @@ class UserApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> createUsersWithArrayInput({ + Future>> createUsersWithArrayInput({ required BuiltList user, CancelToken? cancelToken, Map? headers, @@ -148,7 +175,34 @@ class UserApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Creates list of users with given input array @@ -163,9 +217,9 @@ class UserApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> createUsersWithListInput({ + Future>> createUsersWithListInput({ required BuiltList user, CancelToken? cancelToken, Map? headers, @@ -214,7 +268,34 @@ class UserApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Delete user @@ -229,9 +310,9 @@ class UserApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> deleteUser({ + Future>> deleteUser({ required String username, CancelToken? cancelToken, Map? headers, @@ -261,7 +342,34 @@ class UserApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Get user by user name @@ -427,9 +535,9 @@ class UserApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> logoutUser({ + Future>> logoutUser({ CancelToken? cancelToken, Map? headers, Map? extra, @@ -458,7 +566,34 @@ class UserApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Updated user @@ -474,9 +609,9 @@ class UserApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> updateUser({ + Future>> updateUser({ required String username, required User user, CancelToken? cancelToken, @@ -526,7 +661,34 @@ class UserApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } } diff --git a/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/lib/src/model/enum_test.dart b/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/lib/src/model/enum_test.dart index 7ca76d22fe0f..9fbe49730914 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/lib/src/model/enum_test.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/lib/src/model/enum_test.dart @@ -237,9 +237,9 @@ class EnumTestEnumIntegerEnum extends EnumClass { class EnumTestEnumNumberEnum extends EnumClass { - @BuiltValueEnumConst(wireName: r'1.1') + @BuiltValueEnumConst(wireName: r1.1) static const EnumTestEnumNumberEnum number1Period1 = _$enumTestEnumNumberEnum_number1Period1; - @BuiltValueEnumConst(wireName: r'-1.2') + @BuiltValueEnumConst(wireName: r-1.2) static const EnumTestEnumNumberEnum numberNegative1Period2 = _$enumTestEnumNumberEnum_numberNegative1Period2; static Serializer get serializer => _$enumTestEnumNumberEnumSerializer; diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/FakeApi.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/FakeApi.md index 740e5ee66833..8a7b517f9929 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/FakeApi.md +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/FakeApi.md @@ -66,7 +66,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) # **fakeHttpSignatureTest** -> fakeHttpSignatureTest(pet, query1, header1) +> Map fakeHttpSignatureTest(pet, query1, header1) test http signature authentication @@ -83,7 +83,8 @@ final String query1 = query1_example; // String | query parameter final String header1 = header1_example; // String | header parameter try { - api.fakeHttpSignatureTest(pet, query1, header1); + final response = api.fakeHttpSignatureTest(pet, query1, header1); + print(response); } catch on DioError (e) { print('Exception when calling FakeApi->fakeHttpSignatureTest: $e\n'); } @@ -99,7 +100,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -328,7 +329,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) # **testBodyWithBinary** -> testBodyWithBinary(body) +> Map testBodyWithBinary(body) @@ -342,7 +343,8 @@ final api = Openapi().getFakeApi(); final MultipartFile body = BINARY_DATA_HERE; // MultipartFile | image to upload try { - api.testBodyWithBinary(body); + final response = api.testBodyWithBinary(body); + print(response); } catch on DioError (e) { print('Exception when calling FakeApi->testBodyWithBinary: $e\n'); } @@ -356,7 +358,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -370,7 +372,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) # **testBodyWithFileSchema** -> testBodyWithFileSchema(fileSchemaTestClass) +> Map testBodyWithFileSchema(fileSchemaTestClass) @@ -384,7 +386,8 @@ final api = Openapi().getFakeApi(); final FileSchemaTestClass fileSchemaTestClass = ; // FileSchemaTestClass | try { - api.testBodyWithFileSchema(fileSchemaTestClass); + final response = api.testBodyWithFileSchema(fileSchemaTestClass); + print(response); } catch on DioError (e) { print('Exception when calling FakeApi->testBodyWithFileSchema: $e\n'); } @@ -398,7 +401,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -412,7 +415,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) # **testBodyWithQueryParams** -> testBodyWithQueryParams(query, user) +> Map testBodyWithQueryParams(query, user) @@ -425,7 +428,8 @@ final String query = query_example; // String | final User user = ; // User | try { - api.testBodyWithQueryParams(query, user); + final response = api.testBodyWithQueryParams(query, user); + print(response); } catch on DioError (e) { print('Exception when calling FakeApi->testBodyWithQueryParams: $e\n'); } @@ -440,7 +444,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -497,7 +501,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) # **testEndpointParameters** -> testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) +> Map testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -527,7 +531,8 @@ final String password = password_example; // String | None final String callback = callback_example; // String | None try { - api.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); + final response = api.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); + print(response); } catch on DioError (e) { print('Exception when calling FakeApi->testEndpointParameters: $e\n'); } @@ -554,7 +559,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -568,7 +573,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) # **testEnumParameters** -> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) +> Map testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) To test enum parameters @@ -589,7 +594,8 @@ final BuiltList enumFormStringArray = ; // BuiltList | Form para final String enumFormString = enumFormString_example; // String | Form parameter enum test (string) try { - api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + final response = api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + print(response); } catch on DioError (e) { print('Exception when calling FakeApi->testEnumParameters: $e\n'); } @@ -610,7 +616,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -624,7 +630,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) # **testGroupParameters** -> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) +> Map testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) Fake endpoint to test group parameters (optional) @@ -646,7 +652,8 @@ final bool booleanGroup = true; // bool | Boolean in group parameters final int int64Group = 789; // int | Integer in group parameters try { - api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + final response = api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + print(response); } catch on DioError (e) { print('Exception when calling FakeApi->testGroupParameters: $e\n'); } @@ -665,7 +672,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -679,7 +686,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) # **testInlineAdditionalProperties** -> testInlineAdditionalProperties(requestBody) +> Map testInlineAdditionalProperties(requestBody) test inline additionalProperties @@ -691,7 +698,8 @@ final api = Openapi().getFakeApi(); final BuiltMap requestBody = ; // BuiltMap | request body try { - api.testInlineAdditionalProperties(requestBody); + final response = api.testInlineAdditionalProperties(requestBody); + print(response); } catch on DioError (e) { print('Exception when calling FakeApi->testInlineAdditionalProperties: $e\n'); } @@ -705,7 +713,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -719,7 +727,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) # **testJsonFormData** -> testJsonFormData(param, param2) +> Map testJsonFormData(param, param2) test json serialization of form data @@ -732,7 +740,8 @@ final String param = param_example; // String | field1 final String param2 = param2_example; // String | field2 try { - api.testJsonFormData(param, param2); + final response = api.testJsonFormData(param, param2); + print(response); } catch on DioError (e) { print('Exception when calling FakeApi->testJsonFormData: $e\n'); } @@ -747,7 +756,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -761,7 +770,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) # **testQueryParameterCollectionFormat** -> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) +> Map testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) @@ -781,7 +790,8 @@ final String allowEmpty = allowEmpty_example; // String | final BuiltMap language = ; // BuiltMap | try { - api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); + final response = api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); + print(response); } catch on DioError (e) { print('Exception when calling FakeApi->testQueryParameterCollectionFormat: $e\n'); } @@ -801,7 +811,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/PetApi.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/PetApi.md index 6afc643ea56a..aa5855adc7c8 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/PetApi.md +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/PetApi.md @@ -21,7 +21,7 @@ Method | HTTP request | Description # **addPet** -> addPet(pet) +> Map addPet(pet) Add a new pet to the store @@ -35,7 +35,8 @@ final api = Openapi().getPetApi(); final Pet pet = ; // Pet | Pet object that needs to be added to the store try { - api.addPet(pet); + final response = api.addPet(pet); + print(response); } catch on DioError (e) { print('Exception when calling PetApi->addPet: $e\n'); } @@ -49,7 +50,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -63,7 +64,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) # **deletePet** -> deletePet(petId, apiKey) +> Map deletePet(petId, apiKey) Deletes a pet @@ -78,7 +79,8 @@ final int petId = 789; // int | Pet id to delete final String apiKey = apiKey_example; // String | try { - api.deletePet(petId, apiKey); + final response = api.deletePet(petId, apiKey); + print(response); } catch on DioError (e) { print('Exception when calling PetApi->deletePet: $e\n'); } @@ -93,7 +95,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -244,7 +246,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) # **updatePet** -> updatePet(pet) +> Map updatePet(pet) Update an existing pet @@ -258,7 +260,8 @@ final api = Openapi().getPetApi(); final Pet pet = ; // Pet | Pet object that needs to be added to the store try { - api.updatePet(pet); + final response = api.updatePet(pet); + print(response); } catch on DioError (e) { print('Exception when calling PetApi->updatePet: $e\n'); } @@ -272,7 +275,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -286,7 +289,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) # **updatePetWithForm** -> updatePetWithForm(petId, name, status) +> Map updatePetWithForm(petId, name, status) Updates a pet in the store with form data @@ -302,7 +305,8 @@ final String name = name_example; // String | Updated name of the pet final String status = status_example; // String | Updated status of the pet try { - api.updatePetWithForm(petId, name, status); + final response = api.updatePetWithForm(petId, name, status); + print(response); } catch on DioError (e) { print('Exception when calling PetApi->updatePetWithForm: $e\n'); } @@ -318,7 +322,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/StoreApi.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/StoreApi.md index 5c8a683579e2..35cd9192f754 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/StoreApi.md +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/StoreApi.md @@ -16,7 +16,7 @@ Method | HTTP request | Description # **deleteOrder** -> deleteOrder(orderId) +> Map deleteOrder(orderId) Delete purchase order by ID @@ -30,7 +30,8 @@ final api = Openapi().getStoreApi(); final String orderId = orderId_example; // String | ID of the order that needs to be deleted try { - api.deleteOrder(orderId); + final response = api.deleteOrder(orderId); + print(response); } catch on DioError (e) { print('Exception when calling StoreApi->deleteOrder: $e\n'); } @@ -44,7 +45,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/UserApi.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/UserApi.md index e3af05ffb087..63d49fb5f285 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/UserApi.md +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/UserApi.md @@ -20,7 +20,7 @@ Method | HTTP request | Description # **createUser** -> createUser(user) +> Map createUser(user) Create user @@ -34,7 +34,8 @@ final api = Openapi().getUserApi(); final User user = ; // User | Created user object try { - api.createUser(user); + final response = api.createUser(user); + print(response); } catch on DioError (e) { print('Exception when calling UserApi->createUser: $e\n'); } @@ -48,7 +49,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -62,7 +63,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) # **createUsersWithArrayInput** -> createUsersWithArrayInput(user) +> Map createUsersWithArrayInput(user) Creates list of users with given input array @@ -74,7 +75,8 @@ final api = Openapi().getUserApi(); final BuiltList user = ; // BuiltList | List of user object try { - api.createUsersWithArrayInput(user); + final response = api.createUsersWithArrayInput(user); + print(response); } catch on DioError (e) { print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); } @@ -88,7 +90,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -102,7 +104,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) # **createUsersWithListInput** -> createUsersWithListInput(user) +> Map createUsersWithListInput(user) Creates list of users with given input array @@ -114,7 +116,8 @@ final api = Openapi().getUserApi(); final BuiltList user = ; // BuiltList | List of user object try { - api.createUsersWithListInput(user); + final response = api.createUsersWithListInput(user); + print(response); } catch on DioError (e) { print('Exception when calling UserApi->createUsersWithListInput: $e\n'); } @@ -128,7 +131,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -142,7 +145,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) # **deleteUser** -> deleteUser(username) +> Map deleteUser(username) Delete user @@ -156,7 +159,8 @@ final api = Openapi().getUserApi(); final String username = username_example; // String | The name that needs to be deleted try { - api.deleteUser(username); + final response = api.deleteUser(username); + print(response); } catch on DioError (e) { print('Exception when calling UserApi->deleteUser: $e\n'); } @@ -170,7 +174,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -268,7 +272,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) # **logoutUser** -> logoutUser() +> Map logoutUser() Logs out current logged in user session @@ -279,7 +283,8 @@ import 'package:openapi/api.dart'; final api = Openapi().getUserApi(); try { - api.logoutUser(); + final response = api.logoutUser(); + print(response); } catch on DioError (e) { print('Exception when calling UserApi->logoutUser: $e\n'); } @@ -290,7 +295,7 @@ This endpoint does not need any parameter. ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization @@ -304,7 +309,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) # **updateUser** -> updateUser(username, user) +> Map updateUser(username, user) Updated user @@ -319,7 +324,8 @@ final String username = username_example; // String | name that need to be delet final User user = ; // User | Updated user object try { - api.updateUser(username, user); + final response = api.updateUser(username, user); + print(response); } catch on DioError (e) { print('Exception when calling UserApi->updateUser: $e\n'); } @@ -334,7 +340,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map<String, dynamic>** ### Authorization diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/fake_api.dart index d600aba3181f..e7c372919982 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/fake_api.dart @@ -113,9 +113,9 @@ class FakeApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> fakeHttpSignatureTest({ + Future>> fakeHttpSignatureTest({ required Pet pet, String? query1, String? header1, @@ -179,7 +179,34 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// fakeOuterBooleanSerialize @@ -644,9 +671,9 @@ class FakeApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> testBodyWithBinary({ + Future>> testBodyWithBinary({ MultipartFile? body, CancelToken? cancelToken, Map? headers, @@ -694,7 +721,34 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// testBodyWithFileSchema @@ -709,9 +763,9 @@ class FakeApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> testBodyWithFileSchema({ + Future>> testBodyWithFileSchema({ required FileSchemaTestClass fileSchemaTestClass, CancelToken? cancelToken, Map? headers, @@ -760,7 +814,34 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// testBodyWithQueryParams @@ -776,9 +857,9 @@ class FakeApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> testBodyWithQueryParams({ + Future>> testBodyWithQueryParams({ required String query, required User user, CancelToken? cancelToken, @@ -834,7 +915,34 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// To test \"client\" model @@ -955,9 +1063,9 @@ class FakeApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> testEndpointParameters({ + Future>> testEndpointParameters({ required num number, required double double_, required String patternWithoutDelimiter, @@ -1039,7 +1147,34 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// To test enum parameters @@ -1061,9 +1196,9 @@ class FakeApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> testEnumParameters({ + Future>> testEnumParameters({ BuiltList? enumHeaderStringArray, String? enumHeaderString = '-efg', BuiltList? enumQueryStringArray, @@ -1132,7 +1267,34 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Fake endpoint to test group parameters (optional) @@ -1152,9 +1314,9 @@ class FakeApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> testGroupParameters({ + Future>> testGroupParameters({ required int requiredStringGroup, required bool requiredBooleanGroup, required int requiredInt64Group, @@ -1205,7 +1367,34 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// test inline additionalProperties @@ -1220,9 +1409,9 @@ class FakeApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> testInlineAdditionalProperties({ + Future>> testInlineAdditionalProperties({ required BuiltMap requestBody, CancelToken? cancelToken, Map? headers, @@ -1271,7 +1460,34 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// test json serialization of form data @@ -1287,9 +1503,9 @@ class FakeApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> testJsonFormData({ + Future>> testJsonFormData({ required String param, required String param2, CancelToken? cancelToken, @@ -1341,7 +1557,34 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// testQueryParameterCollectionFormat @@ -1362,9 +1605,9 @@ class FakeApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> testQueryParameterCollectionFormat({ + Future>> testQueryParameterCollectionFormat({ required BuiltList pipe, required BuiltList ioutil, required BuiltList http, @@ -1411,7 +1654,34 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } } diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/pet_api.dart index 50ab6268859d..e3081c5669b1 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/pet_api.dart @@ -32,9 +32,9 @@ class PetApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> addPet({ + Future>> addPet({ required Pet pet, CancelToken? cancelToken, Map? headers, @@ -88,7 +88,34 @@ class PetApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Deletes a pet @@ -104,9 +131,9 @@ class PetApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> deletePet({ + Future>> deletePet({ required int petId, String? apiKey, CancelToken? cancelToken, @@ -143,7 +170,34 @@ class PetApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Finds Pets by status @@ -408,9 +462,9 @@ class PetApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> updatePet({ + Future>> updatePet({ required Pet pet, CancelToken? cancelToken, Map? headers, @@ -464,7 +518,34 @@ class PetApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Updates a pet in the store with form data @@ -481,9 +562,9 @@ class PetApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> updatePetWithForm({ + Future>> updatePetWithForm({ required int petId, String? name, String? status, @@ -541,7 +622,34 @@ class PetApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// uploads an image diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/store_api.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/store_api.dart index 93d5ccbe97cc..ce26498abe7d 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/store_api.dart @@ -30,9 +30,9 @@ class StoreApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> deleteOrder({ + Future>> deleteOrder({ required String orderId, CancelToken? cancelToken, Map? headers, @@ -62,7 +62,34 @@ class StoreApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Returns pet inventories by status diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/user_api.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/user_api.dart index 6faaed6336d1..89d60062b970 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/user_api.dart @@ -31,9 +31,9 @@ class UserApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> createUser({ + Future>> createUser({ required User user, CancelToken? cancelToken, Map? headers, @@ -82,7 +82,34 @@ class UserApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Creates list of users with given input array @@ -97,9 +124,9 @@ class UserApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> createUsersWithArrayInput({ + Future>> createUsersWithArrayInput({ required BuiltList user, CancelToken? cancelToken, Map? headers, @@ -148,7 +175,34 @@ class UserApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Creates list of users with given input array @@ -163,9 +217,9 @@ class UserApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> createUsersWithListInput({ + Future>> createUsersWithListInput({ required BuiltList user, CancelToken? cancelToken, Map? headers, @@ -214,7 +268,34 @@ class UserApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Delete user @@ -229,9 +310,9 @@ class UserApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> deleteUser({ + Future>> deleteUser({ required String username, CancelToken? cancelToken, Map? headers, @@ -261,7 +342,34 @@ class UserApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Get user by user name @@ -427,9 +535,9 @@ class UserApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> logoutUser({ + Future>> logoutUser({ CancelToken? cancelToken, Map? headers, Map? extra, @@ -458,7 +566,34 @@ class UserApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Updated user @@ -474,9 +609,9 @@ class UserApi { /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// - /// Returns a [Future] + /// Returns a [Future] containing a [Response] with a [Map] as data /// Throws [DioError] if API call or serialization fails - Future> updateUser({ + Future>> updateUser({ required String username, required User user, CancelToken? cancelToken, @@ -526,7 +661,34 @@ class UserApi { onReceiveProgress: onReceiveProgress, ); - return _response; + Map _responseData; + + try { + const _responseType = FullType(Built, [FullType(Map)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Map; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } } diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/enum_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/enum_test.dart index 7ca76d22fe0f..9fbe49730914 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/enum_test.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/enum_test.dart @@ -237,9 +237,9 @@ class EnumTestEnumIntegerEnum extends EnumClass { class EnumTestEnumNumberEnum extends EnumClass { - @BuiltValueEnumConst(wireName: r'1.1') + @BuiltValueEnumConst(wireName: r1.1) static const EnumTestEnumNumberEnum number1Period1 = _$enumTestEnumNumberEnum_number1Period1; - @BuiltValueEnumConst(wireName: r'-1.2') + @BuiltValueEnumConst(wireName: r-1.2) static const EnumTestEnumNumberEnum numberNegative1Period2 = _$enumTestEnumNumberEnum_numberNegative1Period2; static Serializer get serializer => _$enumTestEnumNumberEnumSerializer; 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 a93f8fe393b3..31204f0cef97 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 @@ -63,7 +63,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) # **deletePet** -> deletePet(petId, apiKey) +> Map deletePet(petId, apiKey) Deletes a pet @@ -78,7 +78,8 @@ var petId = 789; // int | Pet id to delete var apiKey = apiKey_example; // String | try { - api_instance.deletePet(petId, apiKey); + var result = api_instance.deletePet(petId, apiKey); + print(result); } catch (e) { print('Exception when calling PetApi->deletePet: $e\n'); } @@ -93,7 +94,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -287,7 +288,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) # **updatePetWithForm** -> updatePetWithForm(petId, name, status) +> Map updatePetWithForm(petId, name, status) Updates a pet in the store with form data @@ -303,7 +304,8 @@ var name = name_example; // String | Updated name of the pet var status = status_example; // String | Updated status of the pet try { - api_instance.updatePetWithForm(petId, name, status); + var result = api_instance.updatePetWithForm(petId, name, status); + print(result); } catch (e) { print('Exception when calling PetApi->updatePetWithForm: $e\n'); } @@ -319,7 +321,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### 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 fb3dddd9fb3c..d6277aa80376 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 @@ -16,7 +16,7 @@ Method | HTTP request | Description # **deleteOrder** -> deleteOrder(orderId) +> Map deleteOrder(orderId) Delete purchase order by ID @@ -30,7 +30,8 @@ var api_instance = new StoreApi(); var orderId = orderId_example; // String | ID of the order that needs to be deleted try { - api_instance.deleteOrder(orderId); + var result = api_instance.deleteOrder(orderId); + print(result); } catch (e) { print('Exception when calling StoreApi->deleteOrder: $e\n'); } @@ -44,7 +45,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### 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 efb3cf578df7..f17d8685caa1 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 @@ -20,7 +20,7 @@ Method | HTTP request | Description # **createUser** -> createUser(user) +> Map createUser(user) Create user @@ -38,7 +38,8 @@ var api_instance = new UserApi(); var user = new User(); // User | Created user object try { - api_instance.createUser(user); + var result = api_instance.createUser(user); + print(result); } catch (e) { print('Exception when calling UserApi->createUser: $e\n'); } @@ -52,7 +53,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -66,7 +67,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) # **createUsersWithArrayInput** -> createUsersWithArrayInput(user) +> Map createUsersWithArrayInput(user) Creates list of users with given input array @@ -82,7 +83,8 @@ var api_instance = new UserApi(); var user = [new BuiltList()]; // BuiltList | List of user object try { - api_instance.createUsersWithArrayInput(user); + var result = api_instance.createUsersWithArrayInput(user); + print(result); } catch (e) { print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); } @@ -96,7 +98,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -110,7 +112,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) # **createUsersWithListInput** -> createUsersWithListInput(user) +> Map createUsersWithListInput(user) Creates list of users with given input array @@ -126,7 +128,8 @@ var api_instance = new UserApi(); var user = [new BuiltList()]; // BuiltList | List of user object try { - api_instance.createUsersWithListInput(user); + var result = api_instance.createUsersWithListInput(user); + print(result); } catch (e) { print('Exception when calling UserApi->createUsersWithListInput: $e\n'); } @@ -140,7 +143,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -154,7 +157,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) # **deleteUser** -> deleteUser(username) +> Map deleteUser(username) Delete user @@ -172,7 +175,8 @@ var api_instance = new UserApi(); var username = username_example; // String | The name that needs to be deleted try { - api_instance.deleteUser(username); + var result = api_instance.deleteUser(username); + print(result); } catch (e) { print('Exception when calling UserApi->deleteUser: $e\n'); } @@ -186,7 +190,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -284,7 +288,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) # **logoutUser** -> logoutUser() +> Map logoutUser() Logs out current logged in user session @@ -299,7 +303,8 @@ import 'package:openapi/api.dart'; var api_instance = new UserApi(); try { - api_instance.logoutUser(); + var result = api_instance.logoutUser(); + print(result); } catch (e) { print('Exception when calling UserApi->logoutUser: $e\n'); } @@ -310,7 +315,7 @@ This endpoint does not need any parameter. ### Return type -void (empty response body) +**Map** ### Authorization @@ -324,7 +329,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) # **updateUser** -> updateUser(username, user) +> Map updateUser(username, user) Updated user @@ -343,7 +348,8 @@ var username = username_example; // String | name that need to be deleted var user = new User(); // User | Updated user object try { - api_instance.updateUser(username, user); + var result = api_instance.updateUser(username, user); + print(result); } catch (e) { print('Exception when calling UserApi->updateUser: $e\n'); } @@ -358,7 +364,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization 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 70fc2b2dbe66..88ffb8ff8b9e 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 @@ -89,7 +89,7 @@ class PetApi { /// Deletes a pet /// /// - Future> deletePet( + Future>> deletePet( int petId, { String apiKey, CancelToken cancelToken, @@ -130,7 +130,22 @@ class PetApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Finds Pets by status @@ -387,7 +402,7 @@ class PetApi { /// Updates a pet in the store with form data /// /// - Future> updatePetWithForm( + Future>> updatePetWithForm( int petId, { String name, String status, @@ -433,7 +448,22 @@ class PetApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// uploads an image 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 80b074645c82..d8a6fecc416d 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 @@ -23,7 +23,7 @@ class StoreApi { /// Delete purchase order by ID /// /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - Future> deleteOrder( + Future>> deleteOrder( String orderId, { CancelToken cancelToken, Map headers, @@ -57,7 +57,22 @@ class StoreApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Returns pet inventories by status 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 fef22be0b977..7c4d0f2845f6 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 @@ -23,7 +23,7 @@ class UserApi { /// Create user /// /// This can only be done by the logged in user. - Future> createUser( + Future>> createUser( User user, { CancelToken cancelToken, Map headers, @@ -67,13 +67,28 @@ class UserApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Creates list of users with given input array /// /// - Future> createUsersWithArrayInput( + Future>> createUsersWithArrayInput( BuiltList user, { CancelToken cancelToken, Map headers, @@ -117,13 +132,28 @@ class UserApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Creates list of users with given input array /// /// - Future> createUsersWithListInput( + Future>> createUsersWithListInput( BuiltList user, { CancelToken cancelToken, Map headers, @@ -167,13 +197,28 @@ class UserApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Delete user /// /// This can only be done by the logged in user. - Future> deleteUser( + Future>> deleteUser( String username, { CancelToken cancelToken, Map headers, @@ -214,7 +259,22 @@ class UserApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Get user by user name @@ -331,7 +391,7 @@ class UserApi { /// Logs out current logged in user session /// /// - Future> logoutUser({ + Future>> logoutUser({ CancelToken cancelToken, Map headers, Map extra, @@ -371,13 +431,28 @@ class UserApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Updated user /// /// This can only be done by the logged in user. - Future> updateUser( + Future>> updateUser( String username, User user, { CancelToken cancelToken, @@ -422,7 +497,22 @@ class UserApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } } 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 46b337cdc187..316de9339f1b 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 @@ -66,7 +66,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) # **fakeHttpSignatureTest** -> fakeHttpSignatureTest(pet, query1, header1) +> Map fakeHttpSignatureTest(pet, query1, header1) test http signature authentication @@ -83,7 +83,8 @@ var query1 = query1_example; // String | query parameter var header1 = header1_example; // String | header parameter try { - api_instance.fakeHttpSignatureTest(pet, query1, header1); + var result = api_instance.fakeHttpSignatureTest(pet, query1, header1); + print(result); } catch (e) { print('Exception when calling FakeApi->fakeHttpSignatureTest: $e\n'); } @@ -99,7 +100,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -328,7 +329,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) # **testBodyWithBinary** -> testBodyWithBinary(body) +> Map testBodyWithBinary(body) @@ -342,7 +343,8 @@ var api_instance = new FakeApi(); var body = new Uint8List(); // Uint8List | image to upload try { - api_instance.testBodyWithBinary(body); + var result = api_instance.testBodyWithBinary(body); + print(result); } catch (e) { print('Exception when calling FakeApi->testBodyWithBinary: $e\n'); } @@ -356,7 +358,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -370,7 +372,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) # **testBodyWithFileSchema** -> testBodyWithFileSchema(fileSchemaTestClass) +> Map testBodyWithFileSchema(fileSchemaTestClass) @@ -384,7 +386,8 @@ var api_instance = new FakeApi(); var fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | try { - api_instance.testBodyWithFileSchema(fileSchemaTestClass); + var result = api_instance.testBodyWithFileSchema(fileSchemaTestClass); + print(result); } catch (e) { print('Exception when calling FakeApi->testBodyWithFileSchema: $e\n'); } @@ -398,7 +401,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -412,7 +415,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) # **testBodyWithQueryParams** -> testBodyWithQueryParams(query, user) +> Map testBodyWithQueryParams(query, user) @@ -425,7 +428,8 @@ var query = query_example; // String | var user = new User(); // User | try { - api_instance.testBodyWithQueryParams(query, user); + var result = api_instance.testBodyWithQueryParams(query, user); + print(result); } catch (e) { print('Exception when calling FakeApi->testBodyWithQueryParams: $e\n'); } @@ -440,7 +444,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -497,7 +501,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) # **testEndpointParameters** -> testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) +> Map testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -527,7 +531,8 @@ var password = password_example; // String | None var callback = callback_example; // String | None try { - api_instance.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); + var result = api_instance.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); + print(result); } catch (e) { print('Exception when calling FakeApi->testEndpointParameters: $e\n'); } @@ -554,7 +559,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -568,7 +573,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) # **testEnumParameters** -> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) +> Map testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) To test enum parameters @@ -589,7 +594,8 @@ var enumFormStringArray = []; // BuiltList | Form parameter enum test (s var enumFormString = enumFormString_example; // String | Form parameter enum test (string) try { - api_instance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + var result = api_instance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + print(result); } catch (e) { print('Exception when calling FakeApi->testEnumParameters: $e\n'); } @@ -610,7 +616,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -624,7 +630,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) # **testGroupParameters** -> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) +> Map testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) Fake endpoint to test group parameters (optional) @@ -646,7 +652,8 @@ var booleanGroup = true; // bool | Boolean in group parameters var int64Group = 789; // int | Integer in group parameters try { - api_instance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + var result = api_instance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + print(result); } catch (e) { print('Exception when calling FakeApi->testGroupParameters: $e\n'); } @@ -665,7 +672,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -679,7 +686,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) # **testInlineAdditionalProperties** -> testInlineAdditionalProperties(requestBody) +> Map testInlineAdditionalProperties(requestBody) test inline additionalProperties @@ -691,7 +698,8 @@ var api_instance = new FakeApi(); var requestBody = new BuiltMap(); // BuiltMap | request body try { - api_instance.testInlineAdditionalProperties(requestBody); + var result = api_instance.testInlineAdditionalProperties(requestBody); + print(result); } catch (e) { print('Exception when calling FakeApi->testInlineAdditionalProperties: $e\n'); } @@ -705,7 +713,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -719,7 +727,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) # **testJsonFormData** -> testJsonFormData(param, param2) +> Map testJsonFormData(param, param2) test json serialization of form data @@ -732,7 +740,8 @@ var param = param_example; // String | field1 var param2 = param2_example; // String | field2 try { - api_instance.testJsonFormData(param, param2); + var result = api_instance.testJsonFormData(param, param2); + print(result); } catch (e) { print('Exception when calling FakeApi->testJsonFormData: $e\n'); } @@ -747,7 +756,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -761,7 +770,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) # **testQueryParameterCollectionFormat** -> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) +> Map testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) @@ -781,7 +790,8 @@ var allowEmpty = allowEmpty_example; // String | var language = ; // BuiltMap | try { - api_instance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); + var result = api_instance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); + print(result); } catch (e) { print('Exception when calling FakeApi->testQueryParameterCollectionFormat: $e\n'); } @@ -801,7 +811,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization 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 1a13704db188..cd3043dbc128 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 @@ -21,7 +21,7 @@ Method | HTTP request | Description # **addPet** -> addPet(pet) +> Map addPet(pet) Add a new pet to the store @@ -35,7 +35,8 @@ var api_instance = new PetApi(); var pet = new Pet(); // Pet | Pet object that needs to be added to the store try { - api_instance.addPet(pet); + var result = api_instance.addPet(pet); + print(result); } catch (e) { print('Exception when calling PetApi->addPet: $e\n'); } @@ -49,7 +50,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -63,7 +64,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) # **deletePet** -> deletePet(petId, apiKey) +> Map deletePet(petId, apiKey) Deletes a pet @@ -78,7 +79,8 @@ var petId = 789; // int | Pet id to delete var apiKey = apiKey_example; // String | try { - api_instance.deletePet(petId, apiKey); + var result = api_instance.deletePet(petId, apiKey); + print(result); } catch (e) { print('Exception when calling PetApi->deletePet: $e\n'); } @@ -93,7 +95,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -244,7 +246,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) # **updatePet** -> updatePet(pet) +> Map updatePet(pet) Update an existing pet @@ -258,7 +260,8 @@ var api_instance = new PetApi(); var pet = new Pet(); // Pet | Pet object that needs to be added to the store try { - api_instance.updatePet(pet); + var result = api_instance.updatePet(pet); + print(result); } catch (e) { print('Exception when calling PetApi->updatePet: $e\n'); } @@ -272,7 +275,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -286,7 +289,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) # **updatePetWithForm** -> updatePetWithForm(petId, name, status) +> Map updatePetWithForm(petId, name, status) Updates a pet in the store with form data @@ -302,7 +305,8 @@ var name = name_example; // String | Updated name of the pet var status = status_example; // String | Updated status of the pet try { - api_instance.updatePetWithForm(petId, name, status); + var result = api_instance.updatePetWithForm(petId, name, status); + print(result); } catch (e) { print('Exception when calling PetApi->updatePetWithForm: $e\n'); } @@ -318,7 +322,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### 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 d1cc77910a9e..989484c2341d 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 @@ -16,7 +16,7 @@ Method | HTTP request | Description # **deleteOrder** -> deleteOrder(orderId) +> Map deleteOrder(orderId) Delete purchase order by ID @@ -30,7 +30,8 @@ var api_instance = new StoreApi(); var orderId = orderId_example; // String | ID of the order that needs to be deleted try { - api_instance.deleteOrder(orderId); + var result = api_instance.deleteOrder(orderId); + print(result); } catch (e) { print('Exception when calling StoreApi->deleteOrder: $e\n'); } @@ -44,7 +45,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### 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 0ef486c0809f..9789b2d941ae 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 @@ -20,7 +20,7 @@ Method | HTTP request | Description # **createUser** -> createUser(user) +> Map createUser(user) Create user @@ -34,7 +34,8 @@ var api_instance = new UserApi(); var user = new User(); // User | Created user object try { - api_instance.createUser(user); + var result = api_instance.createUser(user); + print(result); } catch (e) { print('Exception when calling UserApi->createUser: $e\n'); } @@ -48,7 +49,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -62,7 +63,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) # **createUsersWithArrayInput** -> createUsersWithArrayInput(user) +> Map createUsersWithArrayInput(user) Creates list of users with given input array @@ -74,7 +75,8 @@ var api_instance = new UserApi(); var user = [new BuiltList()]; // BuiltList | List of user object try { - api_instance.createUsersWithArrayInput(user); + var result = api_instance.createUsersWithArrayInput(user); + print(result); } catch (e) { print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); } @@ -88,7 +90,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -102,7 +104,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) # **createUsersWithListInput** -> createUsersWithListInput(user) +> Map createUsersWithListInput(user) Creates list of users with given input array @@ -114,7 +116,8 @@ var api_instance = new UserApi(); var user = [new BuiltList()]; // BuiltList | List of user object try { - api_instance.createUsersWithListInput(user); + var result = api_instance.createUsersWithListInput(user); + print(result); } catch (e) { print('Exception when calling UserApi->createUsersWithListInput: $e\n'); } @@ -128,7 +131,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -142,7 +145,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) # **deleteUser** -> deleteUser(username) +> Map deleteUser(username) Delete user @@ -156,7 +159,8 @@ var api_instance = new UserApi(); var username = username_example; // String | The name that needs to be deleted try { - api_instance.deleteUser(username); + var result = api_instance.deleteUser(username); + print(result); } catch (e) { print('Exception when calling UserApi->deleteUser: $e\n'); } @@ -170,7 +174,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -268,7 +272,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) # **logoutUser** -> logoutUser() +> Map logoutUser() Logs out current logged in user session @@ -279,7 +283,8 @@ import 'package:openapi/api.dart'; var api_instance = new UserApi(); try { - api_instance.logoutUser(); + var result = api_instance.logoutUser(); + print(result); } catch (e) { print('Exception when calling UserApi->logoutUser: $e\n'); } @@ -290,7 +295,7 @@ This endpoint does not need any parameter. ### Return type -void (empty response body) +**Map** ### Authorization @@ -304,7 +309,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) # **updateUser** -> updateUser(username, user) +> Map updateUser(username, user) Updated user @@ -319,7 +324,8 @@ var username = username_example; // String | name that need to be deleted var user = new User(); // User | Updated user object try { - api_instance.updateUser(username, user); + var result = api_instance.updateUser(username, user); + print(result); } catch (e) { print('Exception when calling UserApi->updateUser: $e\n'); } @@ -334,7 +340,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization 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 6df5299a4779..64a0a740847b 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 @@ -85,7 +85,7 @@ class FakeApi { /// test http signature authentication /// /// - Future> fakeHttpSignatureTest( + Future>> fakeHttpSignatureTest( Pet pet, { String query1, String header1, @@ -133,7 +133,22 @@ class FakeApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// @@ -414,7 +429,7 @@ class FakeApi { /// /// /// For this test, the body has to be a binary file. - Future> testBodyWithBinary( + Future>> testBodyWithBinary( Uint8List body, { CancelToken cancelToken, Map headers, @@ -450,13 +465,28 @@ class FakeApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// /// /// For this test, the body for this request must reference a schema named `File`. - Future> testBodyWithFileSchema( + Future>> testBodyWithFileSchema( FileSchemaTestClass fileSchemaTestClass, { CancelToken cancelToken, Map headers, @@ -493,13 +523,28 @@ class FakeApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// /// /// - Future> testBodyWithQueryParams( + Future>> testBodyWithQueryParams( String query, User user, { CancelToken cancelToken, @@ -540,7 +585,22 @@ class FakeApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// To test \"client\" model @@ -604,7 +664,7 @@ class FakeApi { /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - Future> testEndpointParameters( + Future>> testEndpointParameters( num number, double double_, String patternWithoutDelimiter, @@ -673,13 +733,28 @@ class FakeApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// To test enum parameters /// /// To test enum parameters - Future> testEnumParameters({ + Future>> testEnumParameters({ BuiltList enumHeaderStringArray, String enumHeaderString, BuiltList enumQueryStringArray, @@ -733,13 +808,28 @@ class FakeApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Fake endpoint to test group parameters (optional) /// /// Fake endpoint to test group parameters (optional) - Future> testGroupParameters( + Future>> testGroupParameters( int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { @@ -791,13 +881,28 @@ class FakeApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// test inline additionalProperties /// /// - Future> testInlineAdditionalProperties( + Future>> testInlineAdditionalProperties( BuiltMap requestBody, { CancelToken cancelToken, Map headers, @@ -834,13 +939,28 @@ class FakeApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// test json serialization of form data /// /// - Future> testJsonFormData( + Future>> testJsonFormData( String param, String param2, { CancelToken cancelToken, @@ -880,13 +1000,28 @@ class FakeApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// /// /// To test the collection format in query parameters - Future> testQueryParameterCollectionFormat( + Future>> testQueryParameterCollectionFormat( BuiltList pipe, BuiltList ioutil, BuiltList http, @@ -935,7 +1070,22 @@ class FakeApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } } 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 9cc7beeb57ed..671204510726 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 @@ -26,7 +26,7 @@ class PetApi { /// Add a new pet to the store /// /// - Future> addPet( + Future>> addPet( Pet pet, { CancelToken cancelToken, Map headers, @@ -68,13 +68,28 @@ class PetApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Deletes a pet /// /// - Future> deletePet( + Future>> deletePet( int petId, { String apiKey, CancelToken cancelToken, @@ -115,7 +130,22 @@ class PetApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Finds Pets by status @@ -309,7 +339,7 @@ class PetApi { /// Update an existing pet /// /// - Future> updatePet( + Future>> updatePet( Pet pet, { CancelToken cancelToken, Map headers, @@ -351,13 +381,28 @@ class PetApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Updates a pet in the store with form data /// /// - Future> updatePetWithForm( + Future>> updatePetWithForm( int petId, { String name, String status, @@ -403,7 +448,22 @@ class PetApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// uploads an image 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 14fa8b601219..f205b5b5b38d 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 @@ -23,7 +23,7 @@ class StoreApi { /// Delete purchase order by ID /// /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - Future> deleteOrder( + Future>> deleteOrder( String orderId, { CancelToken cancelToken, Map headers, @@ -57,7 +57,22 @@ class StoreApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Returns pet inventories by status 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 86032dba94ae..67ae75723b01 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 @@ -23,7 +23,7 @@ class UserApi { /// Create user /// /// This can only be done by the logged in user. - Future> createUser( + Future>> createUser( User user, { CancelToken cancelToken, Map headers, @@ -60,13 +60,28 @@ class UserApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Creates list of users with given input array /// /// - Future> createUsersWithArrayInput( + Future>> createUsersWithArrayInput( BuiltList user, { CancelToken cancelToken, Map headers, @@ -103,13 +118,28 @@ class UserApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Creates list of users with given input array /// /// - Future> createUsersWithListInput( + Future>> createUsersWithListInput( BuiltList user, { CancelToken cancelToken, Map headers, @@ -146,13 +176,28 @@ class UserApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Delete user /// /// This can only be done by the logged in user. - Future> deleteUser( + Future>> deleteUser( String username, { CancelToken cancelToken, Map headers, @@ -186,7 +231,22 @@ class UserApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Get user by user name @@ -303,7 +363,7 @@ class UserApi { /// Logs out current logged in user session /// /// - Future> logoutUser({ + Future>> logoutUser({ CancelToken cancelToken, Map headers, Map extra, @@ -336,13 +396,28 @@ class UserApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } /// Updated user /// /// This can only be done by the logged in user. - Future> updateUser( + Future>> updateUser( String username, User user, { CancelToken cancelToken, @@ -380,7 +455,22 @@ class UserApi { options: _request, ); - return _response; + const _responseType = FullType(Built, [FullType(Map)]); + final Map _responseData = _serializers.deserialize( + _response.data, + specifiedType: _responseType, + ) as Map; + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + request: _response.request, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); } } diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/enum_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/enum_test.dart index 4df59b2cc374..d57b1ae14633 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/enum_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/enum_test.dart @@ -226,9 +226,9 @@ class EnumTestEnumIntegerEnum extends EnumClass { class EnumTestEnumNumberEnum extends EnumClass { - @BuiltValueEnumConst(wireName: r'1.1') + @BuiltValueEnumConst(wireName: r1.1) static const EnumTestEnumNumberEnum number1Period1 = _$enumTestEnumNumberEnum_number1Period1; - @BuiltValueEnumConst(wireName: r'-1.2') + @BuiltValueEnumConst(wireName: r-1.2) static const EnumTestEnumNumberEnum numberNegative1Period2 = _$enumTestEnumNumberEnum_numberNegative1Period2; static Serializer get serializer => _$enumTestEnumNumberEnumSerializer; diff --git a/samples/openapi3/client/petstore/dart2/petstore/README.md b/samples/openapi3/client/petstore/dart2/petstore/README.md deleted file mode 100644 index 2139c301745c..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# Background - -## Current state of tests - -TL;DR currently the only tests are e2e tests that were adapted to use a faked http client. While pushing data around as a smoke test has some value, more testing is required. In particular we need comprehensive unit/integration tests. - -- an old set of e2e tests are skipped for CI, as they hit a live endpoint and so are inherently flaky - - `pet_test.dart` - - `store_test.dart` - - `user_test.dart` -- the above set of tests were adapted to use a faked http client - - the tests are not really well suited to being used with a stubbed client, many are basically just testing the endpoint logic - - while not a great set of tests, they do have some value as a smoke test for template changes -- the adapted tests and files that contain test data: - - `pet_test_fake_client.dart` - - `store_test_fake_client.dart` - - `user_test_fake_client.dart` - - `fake_client.dart` - - `file_upload_response.json` - -## Assumptions - -- the tests will be run as part of CI and so have access to dart:io - -# Running - -## If not already done, resolve dependencies - -`pub get` - -## To run tests in a single file: - -`pub run test test/pet_test.dart` - -## To run all tests in the test folder: - -`pub run test` diff --git a/samples/openapi3/client/petstore/dart2/petstore/pom.xml b/samples/openapi3/client/petstore/dart2/petstore/pom.xml deleted file mode 100644 index c4ce7b4d68e7..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore/pom.xml +++ /dev/null @@ -1,73 +0,0 @@ - - 4.0.0 - org.openapitools - Dart2PetstoreClientTests - pom - 1.0.0-SNAPSHOT - Dart2 Petstore Client - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory} - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - export-dartfmt - pre-install-test - - exec - - - export - - DART_FMT_PATH=/usr/local/bin/dartfmt - - - - - pub-get - pre-integration-test - - exec - - - pub - - get - - - - - pub-test - integration-test - - exec - - - pub - - run - test - - - - - - - - diff --git a/samples/openapi3/client/petstore/dart2/petstore/pubspec.lock b/samples/openapi3/client/petstore/dart2/petstore/pubspec.lock deleted file mode 100644 index 9b351ff283a1..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore/pubspec.lock +++ /dev/null @@ -1,418 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - _fe_analyzer_shared: - dependency: transitive - description: - name: _fe_analyzer_shared - url: "https://pub.intern.sk" - source: hosted - version: "14.0.0" - analyzer: - dependency: transitive - description: - name: analyzer - url: "https://pub.intern.sk" - source: hosted - version: "0.41.2" - args: - dependency: transitive - description: - name: args - url: "https://pub.intern.sk" - source: hosted - version: "2.1.1" - async: - dependency: transitive - description: - name: async - url: "https://pub.intern.sk" - source: hosted - version: "2.7.0" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - url: "https://pub.intern.sk" - source: hosted - version: "2.1.0" - build: - dependency: transitive - description: - name: build - url: "https://pub.intern.sk" - source: hosted - version: "1.6.2" - built_collection: - dependency: transitive - description: - name: built_collection - url: "https://pub.intern.sk" - source: hosted - version: "5.1.0" - built_value: - dependency: transitive - description: - name: built_value - url: "https://pub.intern.sk" - source: hosted - version: "8.1.1" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.intern.sk" - source: hosted - version: "1.3.1" - cli_util: - dependency: transitive - description: - name: cli_util - url: "https://pub.intern.sk" - source: hosted - version: "0.3.3" - clock: - dependency: transitive - description: - name: clock - url: "https://pub.intern.sk" - source: hosted - version: "1.1.0" - code_builder: - dependency: transitive - description: - name: code_builder - url: "https://pub.intern.sk" - source: hosted - version: "3.7.0" - collection: - dependency: "direct dev" - description: - name: collection - url: "https://pub.intern.sk" - source: hosted - version: "1.15.0" - convert: - dependency: transitive - description: - name: convert - url: "https://pub.intern.sk" - source: hosted - version: "3.0.1" - coverage: - dependency: transitive - description: - name: coverage - url: "https://pub.intern.sk" - source: hosted - version: "0.15.2" - crypto: - dependency: transitive - description: - name: crypto - url: "https://pub.intern.sk" - source: hosted - version: "3.0.1" - dart_style: - dependency: transitive - description: - name: dart_style - url: "https://pub.intern.sk" - source: hosted - version: "1.3.12" - file: - dependency: transitive - description: - name: file - url: "https://pub.intern.sk" - source: hosted - version: "6.1.2" - fixnum: - dependency: transitive - description: - name: fixnum - url: "https://pub.intern.sk" - source: hosted - version: "1.0.0" - glob: - dependency: transitive - description: - name: glob - url: "https://pub.intern.sk" - source: hosted - version: "2.0.1" - http: - dependency: "direct dev" - description: - name: http - url: "https://pub.intern.sk" - source: hosted - version: "0.13.3" - http_multi_server: - dependency: transitive - description: - name: http_multi_server - url: "https://pub.intern.sk" - source: hosted - version: "3.0.1" - http_parser: - dependency: transitive - description: - name: http_parser - url: "https://pub.intern.sk" - source: hosted - version: "4.0.0" - intl: - dependency: transitive - description: - name: intl - url: "https://pub.intern.sk" - source: hosted - version: "0.17.0" - io: - dependency: transitive - description: - name: io - url: "https://pub.intern.sk" - source: hosted - version: "1.0.3" - js: - dependency: transitive - description: - name: js - url: "https://pub.intern.sk" - source: hosted - version: "0.6.3" - logging: - dependency: transitive - description: - name: logging - url: "https://pub.intern.sk" - source: hosted - version: "1.0.1" - matcher: - dependency: transitive - description: - name: matcher - url: "https://pub.intern.sk" - source: hosted - version: "0.12.10" - meta: - dependency: "direct dev" - description: - name: meta - url: "https://pub.intern.sk" - source: hosted - version: "1.6.0" - mime: - dependency: transitive - description: - name: mime - url: "https://pub.intern.sk" - source: hosted - version: "1.0.0" - mockito: - dependency: "direct dev" - description: - name: mockito - url: "https://pub.intern.sk" - source: hosted - version: "4.1.4" - node_preamble: - dependency: transitive - description: - name: node_preamble - url: "https://pub.intern.sk" - source: hosted - version: "1.4.13" - openapi: - dependency: "direct main" - description: - path: "../petstore_client_lib" - relative: true - source: path - version: "1.0.0" - package_config: - dependency: transitive - description: - name: package_config - url: "https://pub.intern.sk" - source: hosted - version: "1.9.3" - path: - dependency: transitive - description: - name: path - url: "https://pub.intern.sk" - source: hosted - version: "1.8.0" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.intern.sk" - source: hosted - version: "1.11.1" - pool: - dependency: transitive - description: - name: pool - url: "https://pub.intern.sk" - source: hosted - version: "1.5.0" - pub_semver: - dependency: transitive - description: - name: pub_semver - url: "https://pub.intern.sk" - source: hosted - version: "2.0.0" - shelf: - dependency: transitive - description: - name: shelf - url: "https://pub.intern.sk" - source: hosted - version: "1.2.0" - shelf_packages_handler: - dependency: transitive - description: - name: shelf_packages_handler - url: "https://pub.intern.sk" - source: hosted - version: "3.0.0" - shelf_static: - dependency: transitive - description: - name: shelf_static - url: "https://pub.intern.sk" - source: hosted - version: "1.1.0" - shelf_web_socket: - dependency: transitive - description: - name: shelf_web_socket - url: "https://pub.intern.sk" - source: hosted - version: "1.0.1" - source_gen: - dependency: transitive - description: - name: source_gen - url: "https://pub.intern.sk" - source: hosted - version: "0.9.10+3" - source_map_stack_trace: - dependency: transitive - description: - name: source_map_stack_trace - url: "https://pub.intern.sk" - source: hosted - version: "2.1.0" - source_maps: - dependency: transitive - description: - name: source_maps - url: "https://pub.intern.sk" - source: hosted - version: "0.10.10" - source_span: - dependency: transitive - description: - name: source_span - url: "https://pub.intern.sk" - source: hosted - version: "1.8.1" - stack_trace: - dependency: transitive - description: - name: stack_trace - url: "https://pub.intern.sk" - source: hosted - version: "1.10.0" - stream_channel: - dependency: transitive - description: - name: stream_channel - url: "https://pub.intern.sk" - source: hosted - version: "2.1.0" - string_scanner: - dependency: transitive - description: - name: string_scanner - url: "https://pub.intern.sk" - source: hosted - version: "1.1.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - url: "https://pub.intern.sk" - source: hosted - version: "1.2.0" - test: - dependency: "direct dev" - description: - name: test - url: "https://pub.intern.sk" - source: hosted - version: "1.16.5" - test_api: - dependency: transitive - description: - name: test_api - url: "https://pub.intern.sk" - source: hosted - version: "0.2.19" - test_core: - dependency: transitive - description: - name: test_core - url: "https://pub.intern.sk" - source: hosted - version: "0.3.15" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.intern.sk" - source: hosted - version: "1.3.0" - vm_service: - dependency: transitive - description: - name: vm_service - url: "https://pub.intern.sk" - source: hosted - version: "6.2.0" - watcher: - dependency: transitive - description: - name: watcher - url: "https://pub.intern.sk" - source: hosted - version: "1.0.0" - web_socket_channel: - dependency: transitive - description: - name: web_socket_channel - url: "https://pub.intern.sk" - source: hosted - version: "2.1.0" - webkit_inspection_protocol: - dependency: transitive - description: - name: webkit_inspection_protocol - url: "https://pub.intern.sk" - source: hosted - version: "1.0.0" - yaml: - dependency: transitive - description: - name: yaml - url: "https://pub.intern.sk" - source: hosted - version: "3.1.0" -sdks: - dart: ">=2.12.0 <3.0.0" diff --git a/samples/openapi3/client/petstore/dart2/petstore/pubspec.yaml b/samples/openapi3/client/petstore/dart2/petstore/pubspec.yaml deleted file mode 100644 index 6b1e0dcfa3a2..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore/pubspec.yaml +++ /dev/null @@ -1,19 +0,0 @@ -name: petstore_client -version: 1.0.0 -description: Petstore client using OpenAPI library - -publish_to: none - -environment: - sdk: '>=2.11.0 <3.0.0' - -dependencies: - openapi: - path: ../petstore_client_lib - -dev_dependencies: - meta: <1.7.0 - test: ^1.8.0 - mockito: ^4.1.1 - http: ^0.13.0 - collection: ^1.14.12 diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/fake_client.dart b/samples/openapi3/client/petstore/dart2/petstore/test/fake_client.dart deleted file mode 100644 index ed60f386aa41..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore/test/fake_client.dart +++ /dev/null @@ -1,134 +0,0 @@ -import 'dart:convert'; - -import 'package:collection/collection.dart'; -import 'package:http/http.dart'; -import 'package:mockito/mockito.dart'; - -/// A fake client that checks for expected values and returns given responses -/// -/// Checks for the expected values (url, headers, body) and throws if not found -/// -/// If exception is non-null the request will throw the exception, after other -/// checks are performed -class FakeClient extends Fake implements Client { - FakeClient({ - this.throwException, - this.expectedPostRequestBody, - this.postResponseBody, - this.expectedGetRequestBody, - this.getResponseBody, - this.deleteResponseBody, - this.expectedPutRequestBody, - this.putResponseBody, - this.sendResponseBody, - String expectedUrl, - this.expectedHeaders = null, - }) : this.expectedUrl = Uri.parse(expectedUrl); - - Exception throwException; - Object expectedPostRequestBody; - String postResponseBody; - String expectedGetRequestBody; - String getResponseBody; - String deleteResponseBody; - String expectedPutRequestBody; - String putResponseBody; - String sendResponseBody; - Uri expectedUrl; - Map expectedHeaders; - - @override - Future post(Uri url, - {Map headers, Object body, Encoding encoding}) async { - // check that the request was made with expected values - if (url != expectedUrl) { - throw StateError( - 'POST was called with unexpected url: ${url} should be ${expectedUrl}'); - } - if (!MapEquality().equals(headers, expectedHeaders)) { - throw StateError( - 'POST was called with unexpected headers: ${headers} should be ${expectedHeaders}'); - } - // currently we only expect Map (and subtypes) or Strings - if (body is Map) { - if (!MapEquality().equals(body, expectedPostRequestBody)) { - throw StateError( - 'POST was called with unexpected body: ${body} should be ${expectedPostRequestBody}'); - } - } else if (body != expectedPostRequestBody) { - throw StateError( - 'POST was called with unexpected body: ${body} should be ${expectedPostRequestBody}'); - } - - // throw if set to throw - if (throwException != null) throw throwException; - - return Response(postResponseBody, 200); - } - - @override - Future get(Uri url, {Map headers}) async { - // check that the request was made with expected values - if (url != expectedUrl) { - throw StateError( - 'GET was called with unexpected url: ${url} should be ${expectedUrl}'); - } - if (!MapEquality().equals(headers, expectedHeaders)) { - throw StateError( - 'GET was called with unexpected headers: ${headers} should be ${expectedHeaders}'); - } - - // throw if set to throw - if (throwException != null) throw throwException; - - return Response(getResponseBody, 200); - } - - @override - Future delete(Uri url, - {Map headers, Object body, Encoding encoding}) async { - // check that the request was made with expected values - if (url != expectedUrl) { - throw StateError( - 'DELETE was called with unexpected url: ${url} should be ${expectedUrl}'); - } - if (!MapEquality().equals(headers, expectedHeaders)) { - throw StateError( - 'DELETE was called with unexpected headers: ${headers} should be ${expectedHeaders}'); - } - - // throw if set to throw - if (throwException != null) throw throwException; - - return Response(deleteResponseBody, 200); - } - - @override - Future put(Uri url, - {Map headers, Object body, Encoding encoding}) async { - // check that the request was made with expected values - if (url != expectedUrl) { - throw StateError( - 'PUT was called with unexpected url: ${url} should be ${expectedUrl}'); - } - if (!MapEquality().equals(headers, expectedHeaders)) { - throw StateError( - 'PUT was called with unexpected headers: ${headers} should be ${expectedHeaders}'); - } - if (body != expectedPutRequestBody) { - throw StateError( - 'PUT was called with unexpected body: ${body} should be ${expectedPutRequestBody}'); - } - - // throw if set to throw - if (throwException != null) throw throwException; - - return Response(putResponseBody, 200); - } - - @override - Future send(BaseRequest request) async { - List bytes = utf8.encode(sendResponseBody); - return StreamedResponse(Stream.fromIterable([bytes]), 200); - } -} diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/file_upload_response.json b/samples/openapi3/client/petstore/dart2/petstore/test/file_upload_response.json deleted file mode 100644 index 8855b00d9e38..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore/test/file_upload_response.json +++ /dev/null @@ -1 +0,0 @@ -{"code":200,"type":"unknown","message":"additionalMetadata: \nFile uploaded to ./null, 4 bytes"} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/inventory_response.json b/samples/openapi3/client/petstore/dart2/petstore/test/inventory_response.json deleted file mode 100644 index b4388d1e7b35..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore/test/inventory_response.json +++ /dev/null @@ -1 +0,0 @@ -{"mine":1,"sold":18,"string":568,"Dead":2,"test":2,"Nonavailable":1,"custom":3,"pending":20,"available":2212,"notAvailable":26,"avaiflable":1,"AVAILABLE":1,"swimming":1,"availablee":2,"success":1,"105":1,"missing":11,"disabled":1,"Available":1,"]]>":1} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/order_model_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/order_model_test.dart deleted file mode 100644 index 7048659e8942..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore/test/order_model_test.dart +++ /dev/null @@ -1,9 +0,0 @@ -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -void main() { - test('Check if default value is generated', () async { - var order = Order(); - expect(order.complete, equals(false)); - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/pet_faked_client_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/pet_faked_client_test.dart deleted file mode 100644 index 9737df5d4881..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore/test/pet_faked_client_test.dart +++ /dev/null @@ -1,223 +0,0 @@ -import 'dart:io'; - -import 'package:http/http.dart'; -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -import 'fake_client.dart'; -import 'random_id.dart'; - -void main() { - final petApi = PetApi(); - - Pet makePet({ - int id = 1234, - String name = 'Fluffy', - String status = '', - }) { - final category = Category() - ..id = 1234 - ..name = 'eyeColor'; - final tags = [ - Tag() - ..id = 1234 - ..name = 'New York', - Tag() - ..id = 124321 - ..name = 'Jose' - ]; - return Pet(name: name) - ..id = id - ..category = category - ..tags = tags - ..status = PetStatusEnum.fromJson(status) - ..photoUrls = ['https://petstore.com/sample/photo1.jpg']; - } - - /// Setup the fake client then call [petApi.addPet] - Future addPet(Pet pet) async { - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: await petApi.apiClient.serializeAsync(pet), - postResponseBody: await petApi.apiClient.serializeAsync(pet), - expectedHeaders: {'Content-Type': 'application/json'}); - return petApi.addPet(pet); - } - - group('Pet API with faked client', () { - test('adds a new pet and gets it by id', () async { - final id = newId(); - final newPet = makePet(id: id); - - // use the pet api to add a pet - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: await petApi.apiClient.serializeAsync(newPet), - postResponseBody: await petApi.apiClient.serializeAsync(newPet), - expectedHeaders: {'Content-Type': 'application/json'}); - await petApi.addPet(newPet); - - // retrieve the same pet by id - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', - getResponseBody: await petApi.apiClient.serializeAsync(newPet), - ); - final retrievedPet = await petApi.getPetById(id); - - // check that the retrieved id is as expected - expect(retrievedPet.id, equals(id)); - }); - - test('doesn\'t get non-existing pet by id', () { - final id = newId(); - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', - throwException: ApiException(400, 'not found'), - ); - expect(petApi.getPetById(id), throwsA(equals(TypeMatcher()))); - }); - - test('deletes existing pet by id', () async { - final id = newId(); - Pet newPet = makePet(id: id); - - // add a new pet - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: await petApi.apiClient.serializeAsync(newPet), - postResponseBody: await petApi.apiClient.serializeAsync(newPet), - expectedHeaders: {'Content-Type': 'application/json'}); - await petApi.addPet(newPet); - - // delete the pet - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', - expectedHeaders: {'api_key': 'special-key'}, - deleteResponseBody: '', - ); - await petApi.deletePet(id, apiKey: 'special-key'); - - // check for the deleted pet - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', - throwException: ApiException(400, 'Not found'), - ); - expect(petApi.getPetById(id), throwsA(equals(TypeMatcher()))); - }); - - test('updates pet with form', () async { - final id = newId(); - final newPet = makePet(id: id, name: 'Snowy'); - - // add a new pet - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: await petApi.apiClient.serializeAsync(newPet), - postResponseBody: await petApi.apiClient.serializeAsync(newPet), - expectedHeaders: {'Content-Type': 'application/json'}); - await petApi.addPet(newPet); - - // update with form - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', - expectedHeaders: { - 'Content-Type': 'application/x-www-form-urlencoded', - }, - expectedPostRequestBody: {'name': 'Doge', 'status': ''}, - postResponseBody: '', - ); - await petApi.updatePetWithForm(id, name: 'Doge', status: ''); - - // check update worked - newPet.name = 'Doge'; - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', - getResponseBody: await petApi.apiClient.serializeAsync(newPet), - ); - final pet = await petApi.getPetById(id); - expect(pet.name, equals('Doge')); - }); - - test('updates existing pet', () async { - final id = newId(); - final name = 'Snowy'; - final newPet = makePet(id: id); - final updatePet = makePet(id: id, name: name); - - // add a new pet - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: await petApi.apiClient.serializeAsync(newPet), - postResponseBody: await petApi.apiClient.serializeAsync(newPet), - expectedHeaders: {'Content-Type': 'application/json'}); - await petApi.addPet(newPet); - - // update the same pet - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPutRequestBody: await petApi.apiClient.serializeAsync(updatePet), - putResponseBody: await petApi.apiClient.serializeAsync(updatePet), - expectedHeaders: {'Content-Type': 'application/json'}); - await petApi.updatePet(updatePet); - - // check update worked - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', - getResponseBody: await petApi.apiClient.serializeAsync(updatePet), - ); - final pet = await petApi.getPetById(id); - expect(pet.name, equals(name)); - }); - - test('finds pets by status', () async { - final id1 = newId(); - final id2 = newId(); - final id3 = newId(); - final status = '${PetStatusEnum.available}'; - final pet1 = makePet(id: id1, status: status); - final pet2 = makePet(id: id2, status: status); - final pet3 = makePet(id: id3, status: '${PetStatusEnum.sold}'); - - await addPet(pet1); - await addPet(pet2); - await addPet(pet3); - - // retrieve pets by status - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet/findByStatus?status=$status', - getResponseBody: await petApi.apiClient.serializeAsync([pet1, pet2]), - ); - final pets = await petApi.findPetsByStatus([status]); - - // tests serialisation and deserialisation of enum - final petsByStatus = pets.where((p) => p.status == PetStatusEnum.available); - expect(petsByStatus.length, equals(2)); - final petIds = pets.map((pet) => pet.id).toList(); - expect(petIds, contains(id1)); - expect(petIds, contains(id2)); - expect(petIds, isNot(contains(id3))); - }); - - test('uploads a pet image', () async { - final id = newId(); - final newPet = makePet(id: id); - // get some test data (recorded from live response) - final uploadResponse = await File('test/file_upload_response.json').readAsString(); - - // add a new pet - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: await petApi.apiClient.serializeAsync(newPet), - postResponseBody: await petApi.apiClient.serializeAsync(newPet), - expectedHeaders: {'Content-Type': 'application/json'}); - await petApi.addPet(newPet); - - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - sendResponseBody: uploadResponse, - ); - final file = new MultipartFile.fromBytes('file', [104, 101, 108, 108, 111]); - await petApi.uploadFile(id, file: file); - }); - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/pet_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/pet_test.dart deleted file mode 100644 index cbd26c68c7ee..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore/test/pet_test.dart +++ /dev/null @@ -1,101 +0,0 @@ -@Skip('Needs real petstore') -import 'package:http/http.dart'; -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -import 'random_id.dart'; - -void main() { - var petApi = PetApi(); - - Pet makePet({ - int id = 1234, - String name = 'Fluffy', - String status = '', - }) { - final category = Category() - ..id = 1234 - ..name = 'eyeColor'; - final tags = [ - Tag() - ..id = 1234 - ..name = 'New York', - Tag() - ..id = 124321 - ..name = 'Jose' - ]; - - return Pet( - id: id, - category: category, - name: name, //required field - tags: tags, - photoUrls: ['https://petstore.com/sample/photo1.jpg'] //required field - ) - ..status = PetStatusEnum.fromJson(status) - ..photoUrls = ['https://petstore.com/sample/photo1.jpg']; - } - - group('Pet API with live client', () { - test('adds a new pet and gets it by id', () async { - var id = newId(); - await petApi.addPet(makePet(id: id)); - var pet = await petApi.getPetById(id); - expect(pet.id, equals(id)); - }); - - test('doesn\'t get non-existing pet by id', () { - expect(petApi.getPetById(newId()), throwsA(equals(TypeMatcher()))); - }); - - test('deletes existing pet by id', () async { - var id = newId(); - await petApi.addPet(makePet(id: id)); - await petApi.deletePet(id, apiKey: 'special-key'); - expect(petApi.getPetById(id), throwsA(equals(TypeMatcher()))); - }); - - test('updates pet with form', () async { - var id = newId(); - - await petApi.addPet(makePet(id: id, name: 'Snowy')); - await petApi.updatePetWithForm(id, name: 'Doge', status: ''); - var pet = await petApi.getPetById(id); - expect(pet.name, equals('Doge')); - }); - - test('updates existing pet', () async { - var id = newId(); - var name = 'Snowy'; - - await petApi.addPet(makePet(id: id)); - await petApi.updatePet(makePet(id: id, name: name)); - var pet = await petApi.getPetById(id); - expect(pet.name, equals(name)); - }); - - test('finds pets by status', () async { - var id1 = newId(); - var id2 = newId(); - var id3 = newId(); - var status = '${PetStatusEnum.available}'; - - await petApi.addPet(makePet(id: id1, status: status)); - await petApi.addPet(makePet(id: id2, status: status)); - await petApi.addPet(makePet(id: id3, status: '${PetStatusEnum.sold}')); - - var pets = await petApi.findPetsByStatus([status]); - var petIds = pets.map((pet) => pet.id).toList(); - expect(petIds, contains(id1)); - expect(petIds, contains(id2)); - expect(petIds, isNot(contains(id3))); - }); - - test('uploads a pet image', () async { - var id = newId(); - await petApi.addPet(makePet(id: id)); - var file = new MultipartFile.fromBytes('file', [104, 101, 108, 108, 111]); - await petApi.uploadFile(id, additionalMetadata: '', file: file); - }); - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/random_id.dart b/samples/openapi3/client/petstore/dart2/petstore/test/random_id.dart deleted file mode 100644 index ca67ac209934..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore/test/random_id.dart +++ /dev/null @@ -1,7 +0,0 @@ -import 'dart:math'; - -final _random = new Random(); - -int newId() { - return _random.nextInt(999999); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/store_faked_client_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/store_faked_client_test.dart deleted file mode 100644 index 541d08b8c6a7..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore/test/store_faked_client_test.dart +++ /dev/null @@ -1,83 +0,0 @@ -import 'dart:io'; - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -import 'fake_client.dart'; -import 'random_id.dart'; - -void main() { - var storeApi = new StoreApi(); - - Order makeOrder({int id}) { - return Order() - ..id = id - ..petId = 1234 - ..quantity = 1 - ..shipDate = DateTime.now() - ..status - ..complete = false; - } - - group('Store API with faked client', () { - test('places an order and gets it by id', () async { - final id = newId(); - final newOrder = makeOrder(id: id); - - // use the store api to add an order - storeApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/store/order', - expectedPostRequestBody: await storeApi.apiClient.serializeAsync(newOrder), - postResponseBody: await storeApi.apiClient.serializeAsync(newOrder), - expectedHeaders: {"Content-Type": "application/json"}); - await storeApi.placeOrder(newOrder); - - // retrieve the same order by id - storeApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/store/order/$id', - getResponseBody: await storeApi.apiClient.serializeAsync(newOrder), - ); - final placedOrder = await storeApi.getOrderById(id); - expect(placedOrder.id, equals(id)); - }); - - test('deletes an order', () async { - final id = newId(); - final newOrder = makeOrder(id: id); - - // use the store api to add an order - storeApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/store/order', - expectedPostRequestBody: await storeApi.apiClient.serializeAsync(newOrder), - postResponseBody: await storeApi.apiClient.serializeAsync(newOrder), - expectedHeaders: {"Content-Type": "application/json"}); - await storeApi.placeOrder(newOrder); - - // delete the same order - storeApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/store/order/$id', - deleteResponseBody: '', - ); - await storeApi.deleteOrder(id.toString()); - - // try and retrieve the order - storeApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/store/order/$id', - throwException: ApiException(400, 'Not found'), - ); - expect(storeApi.getOrderById(id), throwsA(equals(TypeMatcher()))); - }); - - test('gets the store inventory', () async { - // get some test data (recorded from live response) - final inventoryResponse = await File('test/inventory_response.json').readAsString(); - // use the store api to get the inventory - storeApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/store/inventory', - getResponseBody: inventoryResponse, - ); - Map inventory = await storeApi.getInventory(); - expect(inventory.length, isNot(equals(0))); - }); - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/store_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/store_test.dart deleted file mode 100644 index a5b19cd1de59..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore/test/store_test.dart +++ /dev/null @@ -1,42 +0,0 @@ -@Skip('Needs real petstore') -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -import 'random_id.dart'; - -void main() { - var storeApi = new StoreApi(); - - Order makeOrder({int id}) { - return Order() - ..id = id - ..petId = 1234 - ..quantity = 1 - ..shipDate = DateTime.now() - ..status - ..complete = false; - } - - group('Store API with live client', () { - test('places an order and gets it by id', () async { - var id = newId(); - - await storeApi.placeOrder(makeOrder(id: id)); - var order = await storeApi.getOrderById(id); - expect(order.id, equals(id)); - }); - - test('deletes an order', () async { - var id = newId(); - - await storeApi.placeOrder(makeOrder(id: id)); - await storeApi.deleteOrder(id.toString()); - expect(storeApi.getOrderById(id), throwsA(equals(TypeMatcher()))); - }); - - test('gets the store inventory', () async { - Map inventory = await storeApi.getInventory(); - expect(inventory.length, isNot(equals(0))); - }); - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/user_faked_client_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/user_faked_client_test.dart deleted file mode 100644 index f81379351924..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore/test/user_faked_client_test.dart +++ /dev/null @@ -1,180 +0,0 @@ -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -import 'fake_client.dart'; -import 'random_id.dart'; - -void main() { - var userApi = new UserApi(); - - User makeUser( - {int id, String userName = 'username', String password = 'password'}) { - return User() - ..id = id - ..username = userName - ..firstName = 'firstname' - ..lastName = 'lastname' - ..email = 'email' - ..password = password - ..phone = 'phone' - ..userStatus = 0; - } - - group('User API with faked client', () { - test('creates a user', () async { - final id = newId(); - final username = 'Mally45'; - final newUser = makeUser(id: id, userName: username); - - // use the user api to create a user - userApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/user', - expectedPostRequestBody: - await userApi.apiClient.serializeAsync(newUser), - expectedHeaders: {'Content-Type': 'application/json'}, - postResponseBody: await userApi.apiClient.serializeAsync(newUser), - ); - await userApi.createUser(newUser); - - // retrieve the same user - userApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/user/$username', - getResponseBody: await userApi.apiClient.serializeAsync(newUser), - ); - var user = await userApi.getUserByName(username); - expect(user.id, equals(id)); - }); - - test('creates users with list input', () async { - final firstId = newId(); - final joe = 'Joe'; - - final sally = 'Sally'; - final secondId = newId(); - - final users = [ - makeUser(id: firstId, userName: joe), - makeUser(id: secondId, userName: sally), - ]; - - // use the user api to create a list of users - userApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/user/createWithList', - expectedPostRequestBody: await userApi.apiClient.serializeAsync(users), - expectedHeaders: {'Content-Type': 'application/json'}, - postResponseBody: await userApi.apiClient.serializeAsync(users), - ); - await userApi.createUsersWithListInput(users); - - // retrieve the users - userApi.apiClient.client = FakeClient( - expectedUrl: - 'http://petstore.swagger.io/v2/user/${users.elementAt(0).username}', - getResponseBody: await userApi.apiClient.serializeAsync( - users.elementAt(0), - ), - ); - final firstUser = await userApi.getUserByName(joe); - userApi.apiClient.client = FakeClient( - expectedUrl: - 'http://petstore.swagger.io/v2/user/${users.elementAt(1).username}', - getResponseBody: await userApi.apiClient.serializeAsync( - users.elementAt(1), - ), - ); - final secondUser = await userApi.getUserByName(sally); - expect(firstUser.id, equals(firstId)); - expect(secondUser.id, equals(secondId)); - }); - - test('updates a user', () async { - final username = 'Arkjam89'; - final email = 'test@example.com'; - final newUser = makeUser(id: newId(), userName: username); - - // use the user api to create a user - userApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/user', - expectedPostRequestBody: - await userApi.apiClient.serializeAsync(newUser), - expectedHeaders: {'Content-Type': 'application/json'}, - postResponseBody: await userApi.apiClient.serializeAsync(newUser), - ); - await userApi.createUser(newUser); - newUser.email = email; - - // use the user api to update the user - userApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/user/${newUser.username}', - expectedPutRequestBody: await userApi.apiClient.serializeAsync(newUser), - expectedHeaders: {'Content-Type': 'application/json'}, - putResponseBody: await userApi.apiClient.serializeAsync(newUser), - ); - await userApi.updateUser(username, newUser); - - // retrieve the same user - userApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/user/${newUser.username}', - getResponseBody: await userApi.apiClient.serializeAsync(newUser), - ); - var foundUser = await userApi.getUserByName(username); - expect(foundUser.email, equals(email)); - }); - - test('deletes a user', () async { - final username = 'Riddlem325'; - final newUser = makeUser(id: newId(), userName: username); - - // use the user api to create a user - userApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/user', - expectedPostRequestBody: - await userApi.apiClient.serializeAsync(newUser), - expectedHeaders: {'Content-Type': 'application/json'}, - postResponseBody: await userApi.apiClient.serializeAsync(newUser), - ); - await userApi.createUser(newUser); - - // delete the same user - userApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/user/${newUser.username}', - deleteResponseBody: '', - ); - await userApi.deleteUser(username); - - // try and retrieve the user - userApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/user/${newUser.username}', - throwException: ApiException(400, 'Not found'), - ); - expect(userApi.getUserByName(username), - throwsA(TypeMatcher())); - }); - - test('logs a user in', () async { - final username = 'sgarad625'; - final password = 'lokimoki1'; - final newUser = - makeUser(id: newId(), userName: username, password: password); - - // use the user api to create a user - userApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/user', - expectedPostRequestBody: - await userApi.apiClient.serializeAsync(newUser), - expectedHeaders: {'Content-Type': 'application/json'}, - postResponseBody: await userApi.apiClient.serializeAsync(newUser), - ); - await userApi.createUser(newUser); - - // use the user api to login - userApi.apiClient.client = FakeClient( - expectedUrl: - 'http://petstore.swagger.io/v2/user/login?username=${newUser.username}&password=${newUser.password}', - getResponseBody: 'logged in user session:', - ); - final result = await userApi.loginUser(username, password); - expect(result, contains('logged in user session:')); - }); - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/user_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/user_test.dart deleted file mode 100644 index d604363622d6..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore/test/user_test.dart +++ /dev/null @@ -1,79 +0,0 @@ -@Skip('Needs real petstore') -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -import 'random_id.dart'; - -void main() { - var userApi = new UserApi(); - - User makeUser({int id, String userName = 'username', String password = 'password'}) { - return User() - ..id = id - ..username = userName - ..firstName = 'firstname' - ..lastName = 'lastname' - ..email = 'email' - ..password = password - ..phone = 'phone' - ..userStatus = 0; - } - - group('User API with live client', () { - test('creates a user', () async { - var id = newId(); - var username = 'Mally45'; - await userApi.createUser(makeUser(id: id, userName: username)); - var user = await userApi.getUserByName(username); - expect(user.id, equals(id)); - }); - - test('creates users with list input', () async { - var firstId = newId(); - var joe = 'Joe'; - - var sally = 'Sally'; - var secondId = newId(); - - var users = [ - makeUser(id: firstId, userName: joe), - makeUser(id: secondId, userName: sally), - ]; - - await userApi.createUsersWithListInput(users); - var firstUser = await userApi.getUserByName(joe); - var secondUser = await userApi.getUserByName(sally); - expect(firstUser.id, equals(firstId)); - expect(secondUser.id, equals(secondId)); - }); - - test('updates a user', () async { - var username = 'Arkjam89'; - var email = 'test@example.com'; - var user = makeUser(id: newId(), userName: username); - - await userApi.createUser(user); - user.email = email; - await userApi.updateUser(username, user); - var foundUser = await userApi.getUserByName(username); - expect(foundUser.email, equals(email)); - }); - - test('deletes a user', () async { - var username = 'Riddlem325'; - await userApi.createUser(makeUser(id: newId(), userName: username)); - await userApi.deleteUser(username); - expect(userApi.getUserByName(username), throwsA(TypeMatcher())); - }); - - test('logs a user in', () async { - var username = 'sgarad625'; - var password = 'lokimoki1'; - var user = makeUser(id: newId(), userName: username, password: password); - - await userApi.createUser(user); - var result = await userApi.loginUser(username, password); - expect(result, contains('logged in user session:')); - }); - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/.gitignore b/samples/openapi3/client/petstore/dart2/petstore_client_lib/.gitignore index 8b7331fd822c..1be28ced0940 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/.gitignore +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/.gitignore @@ -1,27 +1,17 @@ -# See https://www.dartlang.org/tools/private-files.html +# See https://dart.dev/guides/libraries/private-files -# Files and directories created by pub -.buildlog +.dart_tool/ .packages -.project -.pub/ build/ -**/packages/ +pubspec.lock # Except for application packages -# Files created by dart2js -# (Most Dart developers will use pub build to compile Dart, use/modify these -# rules if you intend to use dart2js directly -# Convention is to use extension '.dart.js' for Dart compiled to Javascript to -# differentiate from explicit Javascript files) -*.dart.js -*.part.js -*.js.deps -*.js.map -*.info.json - -# Directory created by dartdoc doc/api/ -# Don't commit pubspec lock file -# (Library packages only! Remove pattern if developing an application package) -pubspec.lock +# IntelliJ +*.iml +*.ipr +*.iws +.idea/ + +# Mac +.DS_Store diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/.travis.yml b/samples/openapi3/client/petstore/dart2/petstore_client_lib/.travis.yml index 1a3af66d54c7..86197dbb22c8 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/.travis.yml +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/.travis.yml @@ -6,7 +6,7 @@ language: dart dart: # Install a specific stable release -- "2.2.0" +- "2.14.2" install: - pub get diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/README.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib/README.md index b41b8970d0c2..5e981c61070f 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/README.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/README.md @@ -8,7 +8,7 @@ This Dart package is automatically generated by the [OpenAPI Generator](https:// ## Requirements -Dart 2.0 or later +Dart 2.14 or later ## Installation & Usage diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/PetApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/PetApi.md index 3100f670bc78..14a6916be1ed 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/PetApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/PetApi.md @@ -63,7 +63,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) # **deletePet** -> deletePet(petId, apiKey) +> Map deletePet(petId, apiKey) Deletes a pet @@ -78,7 +78,8 @@ final petId = 789; // int | Pet id to delete final apiKey = apiKey_example; // String | try { - api_instance.deletePet(petId, apiKey); + final result = api_instance.deletePet(petId, apiKey); + print(result); } catch (e) { print('Exception when calling PetApi->deletePet: $e\n'); } @@ -93,7 +94,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -287,7 +288,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) # **updatePetWithForm** -> updatePetWithForm(petId, name, status) +> Map updatePetWithForm(petId, name, status) Updates a pet in the store with form data @@ -303,7 +304,8 @@ final name = name_example; // String | Updated name of the pet final status = status_example; // String | Updated status of the pet try { - api_instance.updatePetWithForm(petId, name, status); + final result = api_instance.updatePetWithForm(petId, name, status); + print(result); } catch (e) { print('Exception when calling PetApi->updatePetWithForm: $e\n'); } @@ -319,7 +321,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/StoreApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/StoreApi.md index 1f0790985794..a84349e6188f 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/StoreApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/StoreApi.md @@ -16,7 +16,7 @@ Method | HTTP request | Description # **deleteOrder** -> deleteOrder(orderId) +> Map deleteOrder(orderId) Delete purchase order by ID @@ -30,7 +30,8 @@ final api_instance = StoreApi(); final orderId = orderId_example; // String | ID of the order that needs to be deleted try { - api_instance.deleteOrder(orderId); + final result = api_instance.deleteOrder(orderId); + print(result); } catch (e) { print('Exception when calling StoreApi->deleteOrder: $e\n'); } @@ -44,7 +45,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/UserApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/UserApi.md index 7907143ecaa6..895ae2783d9a 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/UserApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/UserApi.md @@ -20,7 +20,7 @@ Method | HTTP request | Description # **createUser** -> createUser(user) +> Map createUser(user) Create user @@ -38,7 +38,8 @@ final api_instance = UserApi(); final user = User(); // User | Created user object try { - api_instance.createUser(user); + final result = api_instance.createUser(user); + print(result); } catch (e) { print('Exception when calling UserApi->createUser: $e\n'); } @@ -52,7 +53,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -66,7 +67,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) # **createUsersWithArrayInput** -> createUsersWithArrayInput(user) +> Map createUsersWithArrayInput(user) Creates list of users with given input array @@ -82,7 +83,8 @@ final api_instance = UserApi(); final user = [List()]; // List | List of user object try { - api_instance.createUsersWithArrayInput(user); + final result = api_instance.createUsersWithArrayInput(user); + print(result); } catch (e) { print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); } @@ -96,7 +98,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -110,7 +112,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) # **createUsersWithListInput** -> createUsersWithListInput(user) +> Map createUsersWithListInput(user) Creates list of users with given input array @@ -126,7 +128,8 @@ final api_instance = UserApi(); final user = [List()]; // List | List of user object try { - api_instance.createUsersWithListInput(user); + final result = api_instance.createUsersWithListInput(user); + print(result); } catch (e) { print('Exception when calling UserApi->createUsersWithListInput: $e\n'); } @@ -140,7 +143,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -154,7 +157,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) # **deleteUser** -> deleteUser(username) +> Map deleteUser(username) Delete user @@ -172,7 +175,8 @@ final api_instance = UserApi(); final username = username_example; // String | The name that needs to be deleted try { - api_instance.deleteUser(username); + final result = api_instance.deleteUser(username); + print(result); } catch (e) { print('Exception when calling UserApi->deleteUser: $e\n'); } @@ -186,7 +190,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -284,7 +288,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) # **logoutUser** -> logoutUser() +> Map logoutUser() Logs out current logged in user session @@ -299,7 +303,8 @@ import 'package:openapi/api.dart'; final api_instance = UserApi(); try { - api_instance.logoutUser(); + final result = api_instance.logoutUser(); + print(result); } catch (e) { print('Exception when calling UserApi->logoutUser: $e\n'); } @@ -310,7 +315,7 @@ This endpoint does not need any parameter. ### Return type -void (empty response body) +**Map** ### Authorization @@ -324,7 +329,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) # **updateUser** -> updateUser(username, user) +> Map updateUser(username, user) Updated user @@ -343,7 +348,8 @@ final username = username_example; // String | name that need to be deleted final user = User(); // User | Updated user object try { - api_instance.updateUser(username, user); + final result = api_instance.updateUser(username, user); + print(result); } catch (e) { print('Exception when calling UserApi->updateUser: $e\n'); } @@ -358,7 +364,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api.dart index e67b60f2670f..c98ba2e71c9c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart index 2b7e10416d27..a623f0ad5bf4 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -12,7 +12,7 @@ part of openapi.api; class PetApi { - PetApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + PetApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; @@ -25,16 +25,11 @@ class PetApi { /// * [Pet] pet (required): /// Pet object that needs to be added to the store Future addPetWithHttpInfo(Pet pet,) async { - // Verify required params are set. - if (pet == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: pet'); - } - // ignore: prefer_const_declarations final path = r'/pet'; // ignore: prefer_final_locals - Object postBody = pet; + Object? postBody = pet; final queryParams = []; final headerParams = {}; @@ -62,7 +57,7 @@ class PetApi { /// /// * [Pet] pet (required): /// Pet object that needs to be added to the store - Future addPet(Pet pet,) async { + Future addPet(Pet pet,) async { final response = await addPetWithHttpInfo(pet,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -70,10 +65,9 @@ class PetApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet; } - return Future.value(); } /// Deletes a pet @@ -86,18 +80,13 @@ class PetApi { /// Pet id to delete /// /// * [String] apiKey: - Future deletePetWithHttpInfo(int petId, { String apiKey, }) async { - // Verify required params are set. - if (petId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); - } - + Future deletePetWithHttpInfo(int petId, { String? apiKey, }) async { // ignore: prefer_const_declarations final path = r'/pet/{petId}' .replaceAll('{petId}', petId.toString()); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -131,11 +120,17 @@ class PetApi { /// Pet id to delete /// /// * [String] apiKey: - Future deletePet(int petId, { String apiKey, }) async { + Future?> deletePet(int petId, { String? apiKey, }) async { final response = await deletePetWithHttpInfo(petId, apiKey: apiKey, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// Finds Pets by status @@ -149,16 +144,11 @@ class PetApi { /// * [List] status (required): /// Status values that need to be considered for filter Future findPetsByStatusWithHttpInfo(List status,) async { - // Verify required params are set. - if (status == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: status'); - } - // ignore: prefer_const_declarations final path = r'/pet/findByStatus'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -190,7 +180,7 @@ class PetApi { /// /// * [List] status (required): /// Status values that need to be considered for filter - Future> findPetsByStatus(List status,) async { + Future?> findPetsByStatus(List status,) async { final response = await findPetsByStatusWithHttpInfo(status,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -198,13 +188,12 @@ class PetApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { final responseBody = await _decodeBodyBytes(response); return (await apiClient.deserializeAsync(responseBody, 'List') as List) .cast() .toList(growable: false); } - return Future>.value(); } /// Finds Pets by tags @@ -218,16 +207,11 @@ class PetApi { /// * [List] tags (required): /// Tags to filter by Future findPetsByTagsWithHttpInfo(List tags,) async { - // Verify required params are set. - if (tags == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: tags'); - } - // ignore: prefer_const_declarations final path = r'/pet/findByTags'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -259,7 +243,7 @@ class PetApi { /// /// * [List] tags (required): /// Tags to filter by - Future> findPetsByTags(List tags,) async { + Future?> findPetsByTags(List tags,) async { final response = await findPetsByTagsWithHttpInfo(tags,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -267,13 +251,12 @@ class PetApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { final responseBody = await _decodeBodyBytes(response); return (await apiClient.deserializeAsync(responseBody, 'List') as List) .cast() .toList(growable: false); } - return Future>.value(); } /// Find pet by ID @@ -287,17 +270,12 @@ class PetApi { /// * [int] petId (required): /// ID of pet to return Future getPetByIdWithHttpInfo(int petId,) async { - // Verify required params are set. - if (petId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); - } - // ignore: prefer_const_declarations final path = r'/pet/{petId}' .replaceAll('{petId}', petId.toString()); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -327,7 +305,7 @@ class PetApi { /// /// * [int] petId (required): /// ID of pet to return - Future getPetById(int petId,) async { + Future getPetById(int petId,) async { final response = await getPetByIdWithHttpInfo(petId,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -335,10 +313,9 @@ class PetApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet; } - return Future.value(); } /// Update an existing pet @@ -350,16 +327,11 @@ class PetApi { /// * [Pet] pet (required): /// Pet object that needs to be added to the store Future updatePetWithHttpInfo(Pet pet,) async { - // Verify required params are set. - if (pet == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: pet'); - } - // ignore: prefer_const_declarations final path = r'/pet'; // ignore: prefer_final_locals - Object postBody = pet; + Object? postBody = pet; final queryParams = []; final headerParams = {}; @@ -387,7 +359,7 @@ class PetApi { /// /// * [Pet] pet (required): /// Pet object that needs to be added to the store - Future updatePet(Pet pet,) async { + Future updatePet(Pet pet,) async { final response = await updatePetWithHttpInfo(pet,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -395,10 +367,9 @@ class PetApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet; } - return Future.value(); } /// Updates a pet in the store with form data @@ -415,18 +386,13 @@ class PetApi { /// /// * [String] status: /// Updated status of the pet - Future updatePetWithFormWithHttpInfo(int petId, { String name, String status, }) async { - // Verify required params are set. - if (petId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); - } - + Future updatePetWithFormWithHttpInfo(int petId, { String? name, String? status, }) async { // ignore: prefer_const_declarations final path = r'/pet/{petId}' .replaceAll('{petId}', petId.toString()); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -466,11 +432,17 @@ class PetApi { /// /// * [String] status: /// Updated status of the pet - Future updatePetWithForm(int petId, { String name, String status, }) async { + Future?> updatePetWithForm(int petId, { String? name, String? status, }) async { final response = await updatePetWithFormWithHttpInfo(petId, name: name, status: status, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// uploads an image @@ -487,18 +459,13 @@ class PetApi { /// /// * [MultipartFile] file: /// file to upload - Future uploadFileWithHttpInfo(int petId, { String additionalMetadata, MultipartFile file, }) async { - // Verify required params are set. - if (petId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); - } - + Future uploadFileWithHttpInfo(int petId, { String? additionalMetadata, MultipartFile? file, }) async { // ignore: prefer_const_declarations final path = r'/pet/{petId}/uploadImage' .replaceAll('{petId}', petId.toString()); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -546,7 +513,7 @@ class PetApi { /// /// * [MultipartFile] file: /// file to upload - Future uploadFile(int petId, { String additionalMetadata, MultipartFile file, }) async { + Future uploadFile(int petId, { String? additionalMetadata, MultipartFile? file, }) async { final response = await uploadFileWithHttpInfo(petId, additionalMetadata: additionalMetadata, file: file, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -554,9 +521,8 @@ class PetApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ApiResponse',) as ApiResponse; } - return Future.value(); } } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart index 9a02b1f95106..441bb41bc7d8 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -12,7 +12,7 @@ part of openapi.api; class StoreApi { - StoreApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + StoreApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; @@ -27,17 +27,12 @@ class StoreApi { /// * [String] orderId (required): /// ID of the order that needs to be deleted Future deleteOrderWithHttpInfo(String orderId,) async { - // Verify required params are set. - if (orderId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: orderId'); - } - // ignore: prefer_const_declarations final path = r'/store/order/{orderId}' .replaceAll('{orderId}', orderId); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -67,11 +62,17 @@ class StoreApi { /// /// * [String] orderId (required): /// ID of the order that needs to be deleted - Future deleteOrder(String orderId,) async { + Future?> deleteOrder(String orderId,) async { final response = await deleteOrderWithHttpInfo(orderId,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// Returns pet inventories by status @@ -84,7 +85,7 @@ class StoreApi { final path = r'/store/inventory'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -109,7 +110,7 @@ class StoreApi { /// Returns pet inventories by status /// /// Returns a map of status codes to quantities - Future> getInventory() async { + Future?> getInventory() async { final response = await getInventoryWithHttpInfo(); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -117,10 +118,9 @@ class StoreApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return Map.from(await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map'),); } - return Future>.value(); } /// Find purchase order by ID @@ -134,17 +134,12 @@ class StoreApi { /// * [int] orderId (required): /// ID of pet that needs to be fetched Future getOrderByIdWithHttpInfo(int orderId,) async { - // Verify required params are set. - if (orderId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: orderId'); - } - // ignore: prefer_const_declarations final path = r'/store/order/{orderId}' .replaceAll('{orderId}', orderId.toString()); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -174,7 +169,7 @@ class StoreApi { /// /// * [int] orderId (required): /// ID of pet that needs to be fetched - Future getOrderById(int orderId,) async { + Future getOrderById(int orderId,) async { final response = await getOrderByIdWithHttpInfo(orderId,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -182,10 +177,9 @@ class StoreApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order; } - return Future.value(); } /// Place an order for a pet @@ -197,16 +191,11 @@ class StoreApi { /// * [Order] order (required): /// order placed for purchasing the pet Future placeOrderWithHttpInfo(Order order,) async { - // Verify required params are set. - if (order == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: order'); - } - // ignore: prefer_const_declarations final path = r'/store/order'; // ignore: prefer_final_locals - Object postBody = order; + Object? postBody = order; final queryParams = []; final headerParams = {}; @@ -234,7 +223,7 @@ class StoreApi { /// /// * [Order] order (required): /// order placed for purchasing the pet - Future placeOrder(Order order,) async { + Future placeOrder(Order order,) async { final response = await placeOrderWithHttpInfo(order,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -242,9 +231,8 @@ class StoreApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order; } - return Future.value(); } } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart index 22f0fb7b25f2..dd2f5144890e 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -12,7 +12,7 @@ part of openapi.api; class UserApi { - UserApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + UserApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; @@ -27,16 +27,11 @@ class UserApi { /// * [User] user (required): /// Created user object Future createUserWithHttpInfo(User user,) async { - // Verify required params are set. - if (user == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); - } - // ignore: prefer_const_declarations final path = r'/user'; // ignore: prefer_final_locals - Object postBody = user; + Object? postBody = user; final queryParams = []; final headerParams = {}; @@ -66,11 +61,17 @@ class UserApi { /// /// * [User] user (required): /// Created user object - Future createUser(User user,) async { + Future?> createUser(User user,) async { final response = await createUserWithHttpInfo(user,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// Creates list of users with given input array @@ -82,16 +83,11 @@ class UserApi { /// * [List] user (required): /// List of user object Future createUsersWithArrayInputWithHttpInfo(List user,) async { - // Verify required params are set. - if (user == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); - } - // ignore: prefer_const_declarations final path = r'/user/createWithArray'; // ignore: prefer_final_locals - Object postBody = user; + Object? postBody = user; final queryParams = []; final headerParams = {}; @@ -119,11 +115,17 @@ class UserApi { /// /// * [List] user (required): /// List of user object - Future createUsersWithArrayInput(List user,) async { + Future?> createUsersWithArrayInput(List user,) async { final response = await createUsersWithArrayInputWithHttpInfo(user,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// Creates list of users with given input array @@ -135,16 +137,11 @@ class UserApi { /// * [List] user (required): /// List of user object Future createUsersWithListInputWithHttpInfo(List user,) async { - // Verify required params are set. - if (user == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); - } - // ignore: prefer_const_declarations final path = r'/user/createWithList'; // ignore: prefer_final_locals - Object postBody = user; + Object? postBody = user; final queryParams = []; final headerParams = {}; @@ -172,11 +169,17 @@ class UserApi { /// /// * [List] user (required): /// List of user object - Future createUsersWithListInput(List user,) async { + Future?> createUsersWithListInput(List user,) async { final response = await createUsersWithListInputWithHttpInfo(user,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// Delete user @@ -190,17 +193,12 @@ class UserApi { /// * [String] username (required): /// The name that needs to be deleted Future deleteUserWithHttpInfo(String username,) async { - // Verify required params are set. - if (username == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); - } - // ignore: prefer_const_declarations final path = r'/user/{username}' .replaceAll('{username}', username); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -230,11 +228,17 @@ class UserApi { /// /// * [String] username (required): /// The name that needs to be deleted - Future deleteUser(String username,) async { + Future?> deleteUser(String username,) async { final response = await deleteUserWithHttpInfo(username,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// Get user by user name @@ -246,17 +250,12 @@ class UserApi { /// * [String] username (required): /// The name that needs to be fetched. Use user1 for testing. Future getUserByNameWithHttpInfo(String username,) async { - // Verify required params are set. - if (username == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); - } - // ignore: prefer_const_declarations final path = r'/user/{username}' .replaceAll('{username}', username); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -284,7 +283,7 @@ class UserApi { /// /// * [String] username (required): /// The name that needs to be fetched. Use user1 for testing. - Future getUserByName(String username,) async { + Future getUserByName(String username,) async { final response = await getUserByNameWithHttpInfo(username,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -292,10 +291,9 @@ class UserApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'User',) as User; } - return Future.value(); } /// Logs user into the system @@ -310,19 +308,11 @@ class UserApi { /// * [String] password (required): /// The password for login in clear text Future loginUserWithHttpInfo(String username, String password,) async { - // Verify required params are set. - if (username == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); - } - if (password == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: password'); - } - // ignore: prefer_const_declarations final path = r'/user/login'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -356,7 +346,7 @@ class UserApi { /// /// * [String] password (required): /// The password for login in clear text - Future loginUser(String username, String password,) async { + Future loginUser(String username, String password,) async { final response = await loginUserWithHttpInfo(username, password,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -364,10 +354,9 @@ class UserApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'String',) as String; } - return Future.value(); } /// Logs out current logged in user session @@ -378,7 +367,7 @@ class UserApi { final path = r'/user/logout'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -401,11 +390,17 @@ class UserApi { } /// Logs out current logged in user session - Future logoutUser() async { + Future?> logoutUser() async { final response = await logoutUserWithHttpInfo(); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// Updated user @@ -422,20 +417,12 @@ class UserApi { /// * [User] user (required): /// Updated user object Future updateUserWithHttpInfo(String username, User user,) async { - // Verify required params are set. - if (username == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); - } - if (user == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); - } - // ignore: prefer_const_declarations final path = r'/user/{username}' .replaceAll('{username}', username); // ignore: prefer_final_locals - Object postBody = user; + Object? postBody = user; final queryParams = []; final headerParams = {}; @@ -468,10 +455,16 @@ class UserApi { /// /// * [User] user (required): /// Updated user object - Future updateUser(String username, User user,) async { + Future?> updateUser(String username, User user,) async { final response = await updateUserWithHttpInfo(username, user,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart index 93057a79a7bf..45cdc6288bba 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -27,12 +27,7 @@ class ApiClient { Client get client => _client; /// Requests to use a new HTTP [Client] in this class. - /// - /// If the [newClient] is null, an [ArgumentError] is thrown. set client(Client newClient) { - if (newClient == null) { - throw ArgumentError('New client instance cannot be null.'); - } _client = newClient; } @@ -49,7 +44,7 @@ class ApiClient { /// or deleted. Map get authentications => Map.unmodifiable(_authentications); - T getAuthentication(String name) { + T? getAuthentication(String name) { final authentication = _authentications[name]; return authentication is T ? authentication : null; } @@ -60,10 +55,10 @@ class ApiClient { String path, String method, List queryParams, - Object body, + Object? body, Map headerParams, Map formParams, - String nullableContentType, + String? nullableContentType, List authNames, ) async { _updateParamsForAuth(authNames, queryParams, headerParams); @@ -142,12 +137,12 @@ class ApiClient { throw ApiException(HttpStatus.badRequest, 'Invalid HTTP operation: $method $path',); } - Future deserializeAsync(String json, String targetType, {bool growable}) async => + Future deserializeAsync(String json, String targetType, {bool? growable}) async => // ignore: deprecated_member_use_from_same_package deserialize(json, targetType, growable: growable); @Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use deserializeAsync() instead.') - dynamic deserialize(String json, String targetType, {bool growable}) { + dynamic deserialize(String json, String targetType, {bool? growable}) { // Remove all spaces. Necessary for regular expressions as well. targetType = targetType.replaceAll(' ', ''); // ignore: parameter_assignments @@ -158,10 +153,10 @@ class ApiClient { } // ignore: deprecated_member_use_from_same_package - Future serializeAsync(Object value) async => serialize(value); + Future serializeAsync(Object? value) async => serialize(value); @Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use serializeAsync() instead.') - String serialize(Object value) => value == null ? '' : json.encode(value); + String serialize(Object? value) => value == null ? '' : json.encode(value); /// Update query and header parameters based on authentication settings. /// @param authNames The authentications to apply @@ -179,7 +174,7 @@ class ApiClient { } } - static dynamic _deserialize(dynamic value, String targetType, {bool growable}) { + static dynamic _deserialize(dynamic value, String targetType, {bool? growable}) { try { switch (targetType) { case 'String': @@ -207,21 +202,21 @@ class ApiClient { case 'User': return User.fromJson(value); default: - Match match; + Match? match; if (value is List && (match = _regList.firstMatch(targetType)) != null) { - targetType = match[1]; // ignore: parameter_assignments + targetType = match![1]!; // ignore: parameter_assignments return value .map((dynamic v) => _deserialize(v, targetType, growable: growable)) - .toList(growable: growable); + .toList(growable: growable == true); } if (value is Set && (match = _regSet.firstMatch(targetType)) != null) { - targetType = match[1]; // ignore: parameter_assignments + targetType = match![1]!; // ignore: parameter_assignments return value .map((dynamic v) => _deserialize(v, targetType, growable: growable)) .toSet(); } if (value is Map && (match = _regMap.firstMatch(targetType)) != null) { - targetType = match[1]; // ignore: parameter_assignments + targetType = match![1]!; // ignore: parameter_assignments return Map.fromIterables( value.keys.cast(), value.values.map((dynamic v) => _deserialize(v, targetType, growable: growable)), @@ -238,8 +233,8 @@ class ApiClient { /// Primarily intended for use in an isolate. class DeserializationMessage { const DeserializationMessage({ - @required this.json, - @required this.targetType, + required this.json, + required this.targetType, this.growable, }); @@ -250,7 +245,7 @@ class DeserializationMessage { final String targetType; /// Whether to make deserialized lists or maps growable. - final bool growable; + final bool? growable; } /// Primarily intended for use in an isolate. @@ -269,4 +264,4 @@ Future deserializeAsync(DeserializationMessage message) async { } /// Primarily intended for use in an isolate. -Future serializeAsync(Object value) async => value == null ? '' : json.encode(value); +Future serializeAsync(Object? value) async => value == null ? '' : json.encode(value); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_exception.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_exception.dart index 8ffc340b4c9d..a01cb9f94a8c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_exception.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_exception.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,9 +16,9 @@ class ApiException implements Exception { ApiException.withInner(this.code, this.message, this.innerException, this.stackTrace); int code = 0; - String message; - Exception innerException; - StackTrace stackTrace; + String? message; + Exception? innerException; + StackTrace? stackTrace; @override String toString() { diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_helper.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_helper.dart index cf97058bec28..9f7e83abbcc7 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_helper.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_helper.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -14,16 +14,16 @@ class QueryParam { const QueryParam(this.name, this.value); final String name; - final String value; + final String? value; @override - String toString() => '${Uri.encodeQueryComponent(name)}=${Uri.encodeQueryComponent(value)}'; + String toString() => '${Uri.encodeQueryComponent(name)}=${Uri.encodeQueryComponent(value ?? 'null')}'; } // Ported from the Java version. Iterable _convertParametersForCollectionFormat( - String collectionFormat, - String name, + String? collectionFormat, + String? name, dynamic value, ) { final params = []; @@ -68,39 +68,27 @@ String parameterToString(dynamic value) { Future _decodeBodyBytes(Response response) async { final contentType = response.headers['content-type']; return contentType != null && contentType.toLowerCase().startsWith('application/json') - ? response.bodyBytes == null ? null : utf8.decode(response.bodyBytes) + ? utf8.decode(response.bodyBytes) : response.body; } -/// Returns a valid [T] value found at the specified Map [key], null otherwise. -T mapValueOfType(dynamic map, String key) { - final dynamic value = map is Map ? map[key] : null; - return value is T ? value : null; -} - -/// Returns a valid Map found at the specified Map [key], null otherwise. -Map mapCastOfType(dynamic map, String key) { - final dynamic value = map is Map ? map[key] : null; - return value is Map ? value.cast() : null; -} - /// Returns a valid [DateTime] found at the specified Map [key], null otherwise. -DateTime mapDateTime(dynamic map, String key, [String pattern]) { +DateTime mapDateTime(dynamic map, String key, [String? pattern]) { final dynamic value = map is Map ? map[key] : null; if (value != null) { - int millis; + int? millis; if (value is int) { millis = value; } else if (value is String) { if (pattern == _dateEpochMarker) { millis = int.tryParse(value); } else { - return DateTime.tryParse(value); + return DateTime.parse(value); } } if (millis != null) { return DateTime.fromMillisecondsSinceEpoch(millis, isUtc: true); } } - return null; + return DateTime(1970); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart index 0c2303af09e9..abd569b5fb74 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,8 +16,8 @@ class ApiKeyAuth implements Authentication { final String location; final String paramName; - String apiKeyPrefix; - String apiKey; + String? apiKeyPrefix; + String? apiKey; @override void applyToParams(List queryParams, Map headerParams) { diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart index 4257e1900069..6a5eb38902e7 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart index 0494f402d958..cb0211bd2559 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -11,8 +11,8 @@ part of openapi.api; class HttpBasicAuth implements Authentication { - String username; - String password; + String? username; + String? password; @override void applyToParams(List queryParams, Map headerParams) { diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart index 23e243523dd8..8d2f6ddb0f89 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart index 9299ac13f5bf..1aecb2d3e671 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -13,7 +13,7 @@ part of openapi.api; class OAuth implements Authentication { OAuth({this.accessToken}); - String accessToken; + String? accessToken; @override void applyToParams(List queryParams, Map headerParams) { diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart index bfd43366211f..734fd7dfc050 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -18,11 +18,12 @@ class ApiResponse { this.message, }); - int code; - String type; + int? code; - String message; + String? type; + + String? message; @override bool operator ==(Object other) => identical(this, other) || other is ApiResponse && @@ -32,10 +33,9 @@ class ApiResponse { @override int get hashCode => - // ignore: unnecessary_parenthesis - (code == null ? 0 : code.hashCode) + - (type == null ? 0 : type.hashCode) + - (message == null ? 0 : message.hashCode); + code.hashCode + + type.hashCode + + message.hashCode; @override String toString() => 'ApiResponse[code=$code, type=$type, message=$message]'; @@ -57,22 +57,16 @@ class ApiResponse { /// Returns a new [ApiResponse] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static ApiResponse fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return ApiResponse( - code: mapValueOfType(json, r'code'), - type: mapValueOfType(json, r'type'), - message: mapValueOfType(json, r'message'), - ); - } - return null; - } + static ApiResponse fromJson(Map json) => ApiResponse( + code: json[r'code'] as int, + type: json[r'type'] as String, + message: json[r'message'] as String, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(ApiResponse.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => ApiResponse.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -85,7 +79,7 @@ class ApiResponse { } // maps a json object with a list of ApiResponse-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -93,7 +87,6 @@ class ApiResponse { .forEach((key, dynamic value) { map[key] = ApiResponse.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/category.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/category.dart index 50ad28ee0069..4b743901eac2 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/category.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/category.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -17,9 +17,10 @@ class Category { this.name, }); - int id; - String name; + int? id; + + String? name; @override bool operator ==(Object other) => identical(this, other) || other is Category && @@ -28,9 +29,8 @@ class Category { @override int get hashCode => - // ignore: unnecessary_parenthesis - (id == null ? 0 : id.hashCode) + - (name == null ? 0 : name.hashCode); + id.hashCode + + name.hashCode; @override String toString() => 'Category[id=$id, name=$name]'; @@ -49,21 +49,15 @@ class Category { /// Returns a new [Category] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static Category fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return Category( - id: mapValueOfType(json, r'id'), - name: mapValueOfType(json, r'name'), - ); - } - return null; - } + static Category fromJson(Map json) => Category( + id: json[r'id'] as int, + name: json[r'name'] as String, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(Category.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => Category.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -76,7 +70,7 @@ class Category { } // maps a json object with a list of Category-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -84,7 +78,6 @@ class Category { .forEach((key, dynamic value) { map[key] = Category.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart index 61d01acfaaa8..94761631bf4e 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -21,18 +21,19 @@ class Order { this.complete = false, }); - int id; - int petId; + int? id; - int quantity; + int? petId; - DateTime shipDate; + int? quantity; + + DateTime? shipDate; /// Order Status - OrderStatusEnum status; + OrderStatusEnum? status; - bool complete; + bool? complete; @override bool operator ==(Object other) => identical(this, other) || other is Order && @@ -45,13 +46,12 @@ class Order { @override int get hashCode => - // ignore: unnecessary_parenthesis - (id == null ? 0 : id.hashCode) + - (petId == null ? 0 : petId.hashCode) + - (quantity == null ? 0 : quantity.hashCode) + - (shipDate == null ? 0 : shipDate.hashCode) + - (status == null ? 0 : status.hashCode) + - (complete == null ? 0 : complete.hashCode); + id.hashCode + + petId.hashCode + + quantity.hashCode + + shipDate.hashCode + + status.hashCode + + complete.hashCode; @override String toString() => 'Order[id=$id, petId=$petId, quantity=$quantity, shipDate=$shipDate, status=$status, complete=$complete]'; @@ -68,7 +68,7 @@ class Order { json[r'quantity'] = quantity; } if (shipDate != null) { - json[r'shipDate'] = shipDate.toUtc().toIso8601String(); + json[r'shipDate'] = shipDate!.toUtc().toIso8601String(); } if (status != null) { json[r'status'] = status; @@ -82,25 +82,19 @@ class Order { /// Returns a new [Order] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static Order fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return Order( - id: mapValueOfType(json, r'id'), - petId: mapValueOfType(json, r'petId'), - quantity: mapValueOfType(json, r'quantity'), + static Order fromJson(Map json) => Order( + id: json[r'id'] as int, + petId: json[r'petId'] as int, + quantity: json[r'quantity'] as int, shipDate: mapDateTime(json, r'shipDate', ''), status: OrderStatusEnum.fromJson(json[r'status']), - complete: mapValueOfType(json, r'complete'), - ); - } - return null; - } + complete: json[r'complete'] as bool, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(Order.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => Order.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -113,7 +107,7 @@ class Order { } // maps a json object with a list of Order-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -121,7 +115,6 @@ class Order { .forEach((key, dynamic value) { map[key] = Order.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); @@ -136,12 +129,12 @@ class OrderStatusEnum { const OrderStatusEnum._(this.value); /// The underlying value of this enum member. - final String value; + final String? value; @override String toString() => value ?? ''; - String toJson() => value; + String? toJson() => value; static const placed = OrderStatusEnum._(r'placed'); static const approved = OrderStatusEnum._(r'approved'); @@ -157,10 +150,10 @@ class OrderStatusEnum { static OrderStatusEnum fromJson(dynamic value) => OrderStatusEnumTypeTransformer().decode(value); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(OrderStatusEnum.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => OrderStatusEnum.fromJson(i as Map)).toList(growable: true == growable) + : []; } /// Transformation class that can [encode] an instance of [OrderStatusEnum] to String, @@ -170,33 +163,26 @@ class OrderStatusEnumTypeTransformer { const OrderStatusEnumTypeTransformer._(); - String encode(OrderStatusEnum data) => data.value; + String? encode(OrderStatusEnum data) => data.value; /// Decodes a [dynamic value][data] to a OrderStatusEnum. /// - /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, - /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] - /// cannot be decoded successfully, then an [UnimplementedError] is thrown. - /// - /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, - /// and users are still using an old app with the old code. - OrderStatusEnum decode(dynamic data, {bool allowNull}) { - if (data != null) { - switch (data.toString()) { - case r'placed': return OrderStatusEnum.placed; - case r'approved': return OrderStatusEnum.approved; - case r'delivered': return OrderStatusEnum.delivered; - default: - if (allowNull == false) { - throw ArgumentError('Unknown enum value to decode: $data'); - } - } + /// If the [dynamic value][data] cannot be decoded successfully, then an [UnimplementedError] is thrown. + OrderStatusEnum decode(dynamic data) { + if (data == r'placed') { + return OrderStatusEnum.placed; + } + if (data == r'approved') { + return OrderStatusEnum.approved; + } + if (data == r'delivered') { + return OrderStatusEnum.delivered; } - return null; + throw ArgumentError('Unknown enum value to decode: $data'); } /// Singleton [OrderStatusEnumTypeTransformer] instance. - static OrderStatusEnumTypeTransformer _instance; + static OrderStatusEnumTypeTransformer? _instance; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart index 7b8d3c195e7b..de0a37ffeb13 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -15,24 +15,25 @@ class Pet { Pet({ this.id, this.category, - @required this.name, + required this.name, this.photoUrls = const [], this.tags = const [], this.status, }); - int id; - Category category; + int? id; + + Category? category; String name; List photoUrls; - List tags; + List? tags; /// pet status in the store - PetStatusEnum status; + PetStatusEnum? status; @override bool operator ==(Object other) => identical(this, other) || other is Pet && @@ -45,13 +46,12 @@ class Pet { @override int get hashCode => - // ignore: unnecessary_parenthesis - (id == null ? 0 : id.hashCode) + - (category == null ? 0 : category.hashCode) + - (name == null ? 0 : name.hashCode) + - (photoUrls == null ? 0 : photoUrls.hashCode) + - (tags == null ? 0 : tags.hashCode) + - (status == null ? 0 : status.hashCode); + id.hashCode + + category.hashCode + + name.hashCode + + photoUrls.hashCode + + tags.hashCode + + status.hashCode; @override String toString() => 'Pet[id=$id, category=$category, name=$name, photoUrls=$photoUrls, tags=$tags, status=$status]'; @@ -78,27 +78,21 @@ class Pet { /// Returns a new [Pet] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static Pet fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return Pet( - id: mapValueOfType(json, r'id'), + static Pet fromJson(Map json) => Pet( + id: json[r'id'] as int, category: Category.fromJson(json[r'category']), - name: mapValueOfType(json, r'name'), + name: json[r'name'] as String, photoUrls: json[r'photoUrls'] is List ? (json[r'photoUrls'] as List).cast() - : null, + : [], tags: Tag.listFromJson(json[r'tags']), status: PetStatusEnum.fromJson(json[r'status']), - ); - } - return null; - } + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(Pet.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => Pet.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -111,7 +105,7 @@ class Pet { } // maps a json object with a list of Pet-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -119,7 +113,6 @@ class Pet { .forEach((key, dynamic value) { map[key] = Pet.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); @@ -134,12 +127,12 @@ class PetStatusEnum { const PetStatusEnum._(this.value); /// The underlying value of this enum member. - final String value; + final String? value; @override String toString() => value ?? ''; - String toJson() => value; + String? toJson() => value; static const available = PetStatusEnum._(r'available'); static const pending = PetStatusEnum._(r'pending'); @@ -155,10 +148,10 @@ class PetStatusEnum { static PetStatusEnum fromJson(dynamic value) => PetStatusEnumTypeTransformer().decode(value); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(PetStatusEnum.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => PetStatusEnum.fromJson(i as Map)).toList(growable: true == growable) + : []; } /// Transformation class that can [encode] an instance of [PetStatusEnum] to String, @@ -168,33 +161,26 @@ class PetStatusEnumTypeTransformer { const PetStatusEnumTypeTransformer._(); - String encode(PetStatusEnum data) => data.value; + String? encode(PetStatusEnum data) => data.value; /// Decodes a [dynamic value][data] to a PetStatusEnum. /// - /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, - /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] - /// cannot be decoded successfully, then an [UnimplementedError] is thrown. - /// - /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, - /// and users are still using an old app with the old code. - PetStatusEnum decode(dynamic data, {bool allowNull}) { - if (data != null) { - switch (data.toString()) { - case r'available': return PetStatusEnum.available; - case r'pending': return PetStatusEnum.pending; - case r'sold': return PetStatusEnum.sold; - default: - if (allowNull == false) { - throw ArgumentError('Unknown enum value to decode: $data'); - } - } + /// If the [dynamic value][data] cannot be decoded successfully, then an [UnimplementedError] is thrown. + PetStatusEnum decode(dynamic data) { + if (data == r'available') { + return PetStatusEnum.available; + } + if (data == r'pending') { + return PetStatusEnum.pending; + } + if (data == r'sold') { + return PetStatusEnum.sold; } - return null; + throw ArgumentError('Unknown enum value to decode: $data'); } /// Singleton [PetStatusEnumTypeTransformer] instance. - static PetStatusEnumTypeTransformer _instance; + static PetStatusEnumTypeTransformer? _instance; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart index 193c7004028f..e23a04b1c36e 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -17,9 +17,10 @@ class Tag { this.name, }); - int id; - String name; + int? id; + + String? name; @override bool operator ==(Object other) => identical(this, other) || other is Tag && @@ -28,9 +29,8 @@ class Tag { @override int get hashCode => - // ignore: unnecessary_parenthesis - (id == null ? 0 : id.hashCode) + - (name == null ? 0 : name.hashCode); + id.hashCode + + name.hashCode; @override String toString() => 'Tag[id=$id, name=$name]'; @@ -49,21 +49,15 @@ class Tag { /// Returns a new [Tag] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static Tag fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return Tag( - id: mapValueOfType(json, r'id'), - name: mapValueOfType(json, r'name'), - ); - } - return null; - } + static Tag fromJson(Map json) => Tag( + id: json[r'id'] as int, + name: json[r'name'] as String, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(Tag.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => Tag.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -76,7 +70,7 @@ class Tag { } // maps a json object with a list of Tag-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -84,7 +78,6 @@ class Tag { .forEach((key, dynamic value) { map[key] = Tag.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/user.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/user.dart index d2b94ed6a7ab..8afafd11c536 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/user.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/user.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -23,22 +23,23 @@ class User { this.userStatus, }); - int id; - String username; + int? id; - String firstName; + String? username; - String lastName; + String? firstName; - String email; + String? lastName; - String password; + String? email; - String phone; + String? password; + + String? phone; /// User Status - int userStatus; + int? userStatus; @override bool operator ==(Object other) => identical(this, other) || other is User && @@ -53,15 +54,14 @@ class User { @override int get hashCode => - // ignore: unnecessary_parenthesis - (id == null ? 0 : id.hashCode) + - (username == null ? 0 : username.hashCode) + - (firstName == null ? 0 : firstName.hashCode) + - (lastName == null ? 0 : lastName.hashCode) + - (email == null ? 0 : email.hashCode) + - (password == null ? 0 : password.hashCode) + - (phone == null ? 0 : phone.hashCode) + - (userStatus == null ? 0 : userStatus.hashCode); + id.hashCode + + username.hashCode + + firstName.hashCode + + lastName.hashCode + + email.hashCode + + password.hashCode + + phone.hashCode + + userStatus.hashCode; @override String toString() => 'User[id=$id, username=$username, firstName=$firstName, lastName=$lastName, email=$email, password=$password, phone=$phone, userStatus=$userStatus]'; @@ -98,27 +98,21 @@ class User { /// Returns a new [User] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static User fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return User( - id: mapValueOfType(json, r'id'), - username: mapValueOfType(json, r'username'), - firstName: mapValueOfType(json, r'firstName'), - lastName: mapValueOfType(json, r'lastName'), - email: mapValueOfType(json, r'email'), - password: mapValueOfType(json, r'password'), - phone: mapValueOfType(json, r'phone'), - userStatus: mapValueOfType(json, r'userStatus'), - ); - } - return null; - } - - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(User.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static User fromJson(Map json) => User( + id: json[r'id'] as int, + username: json[r'username'] as String, + firstName: json[r'firstName'] as String, + lastName: json[r'lastName'] as String, + email: json[r'email'] as String, + password: json[r'password'] as String, + phone: json[r'phone'] as String, + userStatus: json[r'userStatus'] as int, + ); + + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => User.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -131,7 +125,7 @@ class User { } // maps a json object with a list of User-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -139,7 +133,6 @@ class User { .forEach((key, dynamic value) { map[key] = User.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/pom.xml b/samples/openapi3/client/petstore/dart2/petstore_client_lib/pom.xml deleted file mode 100644 index 2ff67a1fcef8..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/pom.xml +++ /dev/null @@ -1,73 +0,0 @@ - - 4.0.0 - org.openapitools - Dart2PetstoreClientLibTests - pom - 1.0.0-SNAPSHOT - Dart2 Petstore Client Lib - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory} - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - export-dartfmt - pre-install-test - - exec - - - export - - DART_FMT_PATH=/usr/local/bin/dartfmt - - - - - pub-get - pre-integration-test - - exec - - - pub - - get - - - - - pub-test - integration-test - - exec - - - pub - - run - test - - - - - - - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/pubspec.yaml b/samples/openapi3/client/petstore/dart2/petstore_client_lib/pubspec.yaml index 163b29ec3ecc..c97129058928 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/pubspec.yaml +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/pubspec.yaml @@ -7,12 +7,10 @@ version: '1.0.0' description: 'OpenAPI API client' homepage: 'homepage' environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.14.0 <3.0.0' dependencies: http: '>=0.13.0 <0.14.0' intl: '^0.17.0' - meta: '^1.1.8' dev_dependencies: - test: '>=1.16.0 <1.18.0' diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/api_response_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/api_response_test.dart deleted file mode 100644 index b0c30615b926..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/api_response_test.dart +++ /dev/null @@ -1,36 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ApiResponse -void main() { - final instance = ApiResponse(); - - group('test ApiResponse', () { - // int code - test('to test the property `code`', () async { - // TODO - }); - - // String type - test('to test the property `type`', () async { - // TODO - }); - - // String message - test('to test the property `message`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/category_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/category_test.dart deleted file mode 100644 index 1849d609ebb2..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/category_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Category -void main() { - final instance = Category(); - - group('test Category', () { - // int id - test('to test the property `id`', () async { - // TODO - }); - - // String name - test('to test the property `name`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/order_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/order_test.dart deleted file mode 100644 index 614a14e42bb9..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/order_test.dart +++ /dev/null @@ -1,52 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Order -void main() { - final instance = Order(); - - group('test Order', () { - // int id - test('to test the property `id`', () async { - // TODO - }); - - // int petId - test('to test the property `petId`', () async { - // TODO - }); - - // int quantity - test('to test the property `quantity`', () async { - // TODO - }); - - // DateTime shipDate - test('to test the property `shipDate`', () async { - // TODO - }); - - // Order Status - // String status - test('to test the property `status`', () async { - // TODO - }); - - // bool complete (default value: false) - test('to test the property `complete`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_api_test.dart deleted file mode 100644 index f143f4905306..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_api_test.dart +++ /dev/null @@ -1,82 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for PetApi -void main() { - final instance = PetApi(); - - group('tests for PetApi', () { - // Add a new pet to the store - // - //Future addPet(Pet pet) async - test('test addPet', () async { - // TODO - }); - - // Deletes a pet - // - //Future deletePet(int petId, { String apiKey }) async - test('test deletePet', () async { - // TODO - }); - - // Finds Pets by status - // - // Multiple status values can be provided with comma separated strings - // - //Future> findPetsByStatus(List status) async - test('test findPetsByStatus', () async { - // TODO - }); - - // Finds Pets by tags - // - // Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - // - //Future> findPetsByTags(List tags) async - test('test findPetsByTags', () async { - // TODO - }); - - // Find pet by ID - // - // Returns a single pet - // - //Future getPetById(int petId) async - test('test getPetById', () async { - // TODO - }); - - // Update an existing pet - // - //Future updatePet(Pet pet) async - test('test updatePet', () async { - // TODO - }); - - // Updates a pet in the store with form data - // - //Future updatePetWithForm(int petId, { String name, String status }) async - test('test updatePetWithForm', () async { - // TODO - }); - - // uploads an image - // - //Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async - test('test uploadFile', () async { - // TODO - }); - - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_test.dart deleted file mode 100644 index a3b16fbd7abd..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_test.dart +++ /dev/null @@ -1,52 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Pet -void main() { - final instance = Pet(); - - group('test Pet', () { - // int id - test('to test the property `id`', () async { - // TODO - }); - - // Category category - test('to test the property `category`', () async { - // TODO - }); - - // String name - test('to test the property `name`', () async { - // TODO - }); - - // List photoUrls (default value: const []) - test('to test the property `photoUrls`', () async { - // TODO - }); - - // List tags (default value: const []) - test('to test the property `tags`', () async { - // TODO - }); - - // pet status in the store - // String status - test('to test the property `status`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/store_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/store_api_test.dart deleted file mode 100644 index 4a7ed54abbbc..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/store_api_test.dart +++ /dev/null @@ -1,54 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for StoreApi -void main() { - final instance = StoreApi(); - - group('tests for StoreApi', () { - // Delete purchase order by ID - // - // For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - // - //Future deleteOrder(String orderId) async - test('test deleteOrder', () async { - // TODO - }); - - // Returns pet inventories by status - // - // Returns a map of status codes to quantities - // - //Future> getInventory() async - test('test getInventory', () async { - // TODO - }); - - // Find purchase order by ID - // - // For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - // - //Future getOrderById(int orderId) async - test('test getOrderById', () async { - // TODO - }); - - // Place an order for a pet - // - //Future placeOrder(Order order) async - test('test placeOrder', () async { - // TODO - }); - - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/tag_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/tag_test.dart deleted file mode 100644 index 66ecdfe488dc..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/tag_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Tag -void main() { - final instance = Tag(); - - group('test Tag', () { - // int id - test('to test the property `id`', () async { - // TODO - }); - - // String name - test('to test the property `name`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_api_test.dart deleted file mode 100644 index 73ee89a29451..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_api_test.dart +++ /dev/null @@ -1,82 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for UserApi -void main() { - final instance = UserApi(); - - group('tests for UserApi', () { - // Create user - // - // This can only be done by the logged in user. - // - //Future createUser(User user) async - test('test createUser', () async { - // TODO - }); - - // Creates list of users with given input array - // - //Future createUsersWithArrayInput(List user) async - test('test createUsersWithArrayInput', () async { - // TODO - }); - - // Creates list of users with given input array - // - //Future createUsersWithListInput(List user) async - test('test createUsersWithListInput', () async { - // TODO - }); - - // Delete user - // - // This can only be done by the logged in user. - // - //Future deleteUser(String username) async - test('test deleteUser', () async { - // TODO - }); - - // Get user by user name - // - //Future getUserByName(String username) async - test('test getUserByName', () async { - // TODO - }); - - // Logs user into the system - // - //Future loginUser(String username, String password) async - test('test loginUser', () async { - // TODO - }); - - // Logs out current logged in user session - // - //Future logoutUser() async - test('test logoutUser', () async { - // TODO - }); - - // Updated user - // - // This can only be done by the logged in user. - // - //Future updateUser(String username, User user) async - test('test updateUser', () async { - // TODO - }); - - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_test.dart deleted file mode 100644 index b89cd360489d..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_test.dart +++ /dev/null @@ -1,62 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for User -void main() { - final instance = User(); - - group('test User', () { - // int id - test('to test the property `id`', () async { - // TODO - }); - - // String username - test('to test the property `username`', () async { - // TODO - }); - - // String firstName - test('to test the property `firstName`', () async { - // TODO - }); - - // String lastName - test('to test the property `lastName`', () async { - // TODO - }); - - // String email - test('to test the property `email`', () async { - // TODO - }); - - // String password - test('to test the property `password`', () async { - // TODO - }); - - // String phone - test('to test the property `phone`', () async { - // TODO - }); - - // User Status - // int userStatus - test('to test the property `userStatus`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.gitignore b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.gitignore index 8b7331fd822c..1be28ced0940 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.gitignore +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.gitignore @@ -1,27 +1,17 @@ -# See https://www.dartlang.org/tools/private-files.html +# See https://dart.dev/guides/libraries/private-files -# Files and directories created by pub -.buildlog +.dart_tool/ .packages -.project -.pub/ build/ -**/packages/ +pubspec.lock # Except for application packages -# Files created by dart2js -# (Most Dart developers will use pub build to compile Dart, use/modify these -# rules if you intend to use dart2js directly -# Convention is to use extension '.dart.js' for Dart compiled to Javascript to -# differentiate from explicit Javascript files) -*.dart.js -*.part.js -*.js.deps -*.js.map -*.info.json - -# Directory created by dartdoc doc/api/ -# Don't commit pubspec lock file -# (Library packages only! Remove pattern if developing an application package) -pubspec.lock +# IntelliJ +*.iml +*.ipr +*.iws +.idea/ + +# Mac +.DS_Store diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.travis.yml b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.travis.yml index 1a3af66d54c7..86197dbb22c8 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.travis.yml +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.travis.yml @@ -6,7 +6,7 @@ language: dart dart: # Install a specific stable release -- "2.2.0" +- "2.14.2" install: - pub get diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md index db2f2c26eac2..faa893ff1b1e 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md @@ -8,7 +8,7 @@ This Dart package is automatically generated by the [OpenAPI Generator](https:// ## Requirements -Dart 2.0 or later +Dart 2.14 or later ## Installation & Usage diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md index 869c513b1f26..b22ee07386ec 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md @@ -66,7 +66,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) # **fakeHttpSignatureTest** -> fakeHttpSignatureTest(pet, query1, header1) +> Map fakeHttpSignatureTest(pet, query1, header1) test http signature authentication @@ -80,7 +80,8 @@ final query1 = query1_example; // String | query parameter final header1 = header1_example; // String | header parameter try { - api_instance.fakeHttpSignatureTest(pet, query1, header1); + final result = api_instance.fakeHttpSignatureTest(pet, query1, header1); + print(result); } catch (e) { print('Exception when calling FakeApi->fakeHttpSignatureTest: $e\n'); } @@ -96,7 +97,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -325,7 +326,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) # **testBodyWithBinary** -> testBodyWithBinary(body) +> Map testBodyWithBinary(body) @@ -339,7 +340,8 @@ final api_instance = FakeApi(); final body = MultipartFile(); // MultipartFile | image to upload try { - api_instance.testBodyWithBinary(body); + final result = api_instance.testBodyWithBinary(body); + print(result); } catch (e) { print('Exception when calling FakeApi->testBodyWithBinary: $e\n'); } @@ -353,7 +355,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -367,7 +369,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) # **testBodyWithFileSchema** -> testBodyWithFileSchema(fileSchemaTestClass) +> Map testBodyWithFileSchema(fileSchemaTestClass) @@ -381,7 +383,8 @@ final api_instance = FakeApi(); final fileSchemaTestClass = FileSchemaTestClass(); // FileSchemaTestClass | try { - api_instance.testBodyWithFileSchema(fileSchemaTestClass); + final result = api_instance.testBodyWithFileSchema(fileSchemaTestClass); + print(result); } catch (e) { print('Exception when calling FakeApi->testBodyWithFileSchema: $e\n'); } @@ -395,7 +398,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -409,7 +412,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) # **testBodyWithQueryParams** -> testBodyWithQueryParams(query, user) +> Map testBodyWithQueryParams(query, user) @@ -422,7 +425,8 @@ final query = query_example; // String | final user = User(); // User | try { - api_instance.testBodyWithQueryParams(query, user); + final result = api_instance.testBodyWithQueryParams(query, user); + print(result); } catch (e) { print('Exception when calling FakeApi->testBodyWithQueryParams: $e\n'); } @@ -437,7 +441,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -494,7 +498,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) # **testEndpointParameters** -> testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) +> Map testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -524,7 +528,8 @@ final password = password_example; // String | None final callback = callback_example; // String | None try { - api_instance.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); + final result = api_instance.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); + print(result); } catch (e) { print('Exception when calling FakeApi->testEndpointParameters: $e\n'); } @@ -551,7 +556,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -565,7 +570,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) # **testEnumParameters** -> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) +> Map testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) To test enum parameters @@ -586,7 +591,8 @@ final enumFormStringArray = []; // List | Form parameter enum test (stri final enumFormString = enumFormString_example; // String | Form parameter enum test (string) try { - api_instance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + final result = api_instance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + print(result); } catch (e) { print('Exception when calling FakeApi->testEnumParameters: $e\n'); } @@ -607,7 +613,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -621,7 +627,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) # **testGroupParameters** -> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) +> Map testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) Fake endpoint to test group parameters (optional) @@ -646,7 +652,8 @@ final booleanGroup = true; // bool | Boolean in group parameters final int64Group = 789; // int | Integer in group parameters try { - api_instance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + final result = api_instance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + print(result); } catch (e) { print('Exception when calling FakeApi->testGroupParameters: $e\n'); } @@ -665,7 +672,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -679,7 +686,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) # **testInlineAdditionalProperties** -> testInlineAdditionalProperties(requestBody) +> Map testInlineAdditionalProperties(requestBody) test inline additionalProperties @@ -691,7 +698,8 @@ final api_instance = FakeApi(); final requestBody = Map(); // Map | request body try { - api_instance.testInlineAdditionalProperties(requestBody); + final result = api_instance.testInlineAdditionalProperties(requestBody); + print(result); } catch (e) { print('Exception when calling FakeApi->testInlineAdditionalProperties: $e\n'); } @@ -705,7 +713,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -719,7 +727,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) # **testJsonFormData** -> testJsonFormData(param, param2) +> Map testJsonFormData(param, param2) test json serialization of form data @@ -732,7 +740,8 @@ final param = param_example; // String | field1 final param2 = param2_example; // String | field2 try { - api_instance.testJsonFormData(param, param2); + final result = api_instance.testJsonFormData(param, param2); + print(result); } catch (e) { print('Exception when calling FakeApi->testJsonFormData: $e\n'); } @@ -747,7 +756,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -761,7 +770,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) # **testQueryParameterCollectionFormat** -> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) +> Map testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) @@ -781,7 +790,8 @@ final allowEmpty = allowEmpty_example; // String | final language = ; // Map | try { - api_instance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); + final result = api_instance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); + print(result); } catch (e) { print('Exception when calling FakeApi->testQueryParameterCollectionFormat: $e\n'); } @@ -801,7 +811,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/NullableClass.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/NullableClass.md index 9b2e46df0a09..a3fff4ca709c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/NullableClass.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/NullableClass.md @@ -14,12 +14,12 @@ Name | Type | Description | Notes **stringProp** | **String** | | [optional] **dateProp** | [**DateTime**](DateTime.md) | | [optional] **datetimeProp** | [**DateTime**](DateTime.md) | | [optional] -**arrayNullableProp** | [**List**](Object.md) | | [optional] [default to const []] -**arrayAndItemsNullableProp** | [**List**](Object.md) | | [optional] [default to const []] -**arrayItemsNullable** | [**List**](Object.md) | | [optional] [default to const []] -**objectNullableProp** | [**Map**](Object.md) | | [optional] [default to const {}] -**objectAndItemsNullableProp** | [**Map**](Object.md) | | [optional] [default to const {}] -**objectItemsNullable** | [**Map**](Object.md) | | [optional] [default to const {}] +**arrayNullableProp** | **List>** | | [optional] [default to const []] +**arrayAndItemsNullableProp** | **List>** | | [optional] [default to const []] +**arrayItemsNullable** | **List>** | | [optional] [default to const []] +**objectNullableProp** | **Map** | | [optional] [default to const {}] +**objectAndItemsNullableProp** | **Map** | | [optional] [default to const {}] +**objectItemsNullable** | **Map** | | [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/dart2/petstore_client_lib_fake/doc/PetApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/PetApi.md index 387717e3f917..f6452b7bfc9a 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/PetApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/PetApi.md @@ -21,7 +21,7 @@ Method | HTTP request | Description # **addPet** -> addPet(pet) +> Map addPet(pet) Add a new pet to the store @@ -35,7 +35,8 @@ final api_instance = PetApi(); final pet = Pet(); // Pet | Pet object that needs to be added to the store try { - api_instance.addPet(pet); + final result = api_instance.addPet(pet); + print(result); } catch (e) { print('Exception when calling PetApi->addPet: $e\n'); } @@ -49,7 +50,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -63,7 +64,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) # **deletePet** -> deletePet(petId, apiKey) +> Map deletePet(petId, apiKey) Deletes a pet @@ -78,7 +79,8 @@ final petId = 789; // int | Pet id to delete final apiKey = apiKey_example; // String | try { - api_instance.deletePet(petId, apiKey); + final result = api_instance.deletePet(petId, apiKey); + print(result); } catch (e) { print('Exception when calling PetApi->deletePet: $e\n'); } @@ -93,7 +95,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -244,7 +246,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) # **updatePet** -> updatePet(pet) +> Map updatePet(pet) Update an existing pet @@ -258,7 +260,8 @@ final api_instance = PetApi(); final pet = Pet(); // Pet | Pet object that needs to be added to the store try { - api_instance.updatePet(pet); + final result = api_instance.updatePet(pet); + print(result); } catch (e) { print('Exception when calling PetApi->updatePet: $e\n'); } @@ -272,7 +275,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -286,7 +289,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) # **updatePetWithForm** -> updatePetWithForm(petId, name, status) +> Map updatePetWithForm(petId, name, status) Updates a pet in the store with form data @@ -302,7 +305,8 @@ final name = name_example; // String | Updated name of the pet final status = status_example; // String | Updated status of the pet try { - api_instance.updatePetWithForm(petId, name, status); + final result = api_instance.updatePetWithForm(petId, name, status); + print(result); } catch (e) { print('Exception when calling PetApi->updatePetWithForm: $e\n'); } @@ -318,7 +322,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/StoreApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/StoreApi.md index f43230375e7b..b573d982109a 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/StoreApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/StoreApi.md @@ -16,7 +16,7 @@ Method | HTTP request | Description # **deleteOrder** -> deleteOrder(orderId) +> Map deleteOrder(orderId) Delete purchase order by ID @@ -30,7 +30,8 @@ final api_instance = StoreApi(); final orderId = orderId_example; // String | ID of the order that needs to be deleted try { - api_instance.deleteOrder(orderId); + final result = api_instance.deleteOrder(orderId); + print(result); } catch (e) { print('Exception when calling StoreApi->deleteOrder: $e\n'); } @@ -44,7 +45,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/UserApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/UserApi.md index f318f92ccefd..909b184c1a0c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/UserApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/UserApi.md @@ -20,7 +20,7 @@ Method | HTTP request | Description # **createUser** -> createUser(user) +> Map createUser(user) Create user @@ -34,7 +34,8 @@ final api_instance = UserApi(); final user = User(); // User | Created user object try { - api_instance.createUser(user); + final result = api_instance.createUser(user); + print(result); } catch (e) { print('Exception when calling UserApi->createUser: $e\n'); } @@ -48,7 +49,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -62,7 +63,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) # **createUsersWithArrayInput** -> createUsersWithArrayInput(user) +> Map createUsersWithArrayInput(user) Creates list of users with given input array @@ -74,7 +75,8 @@ final api_instance = UserApi(); final user = [List()]; // List | List of user object try { - api_instance.createUsersWithArrayInput(user); + final result = api_instance.createUsersWithArrayInput(user); + print(result); } catch (e) { print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); } @@ -88,7 +90,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -102,7 +104,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) # **createUsersWithListInput** -> createUsersWithListInput(user) +> Map createUsersWithListInput(user) Creates list of users with given input array @@ -114,7 +116,8 @@ final api_instance = UserApi(); final user = [List()]; // List | List of user object try { - api_instance.createUsersWithListInput(user); + final result = api_instance.createUsersWithListInput(user); + print(result); } catch (e) { print('Exception when calling UserApi->createUsersWithListInput: $e\n'); } @@ -128,7 +131,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -142,7 +145,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) # **deleteUser** -> deleteUser(username) +> Map deleteUser(username) Delete user @@ -156,7 +159,8 @@ final api_instance = UserApi(); final username = username_example; // String | The name that needs to be deleted try { - api_instance.deleteUser(username); + final result = api_instance.deleteUser(username); + print(result); } catch (e) { print('Exception when calling UserApi->deleteUser: $e\n'); } @@ -170,7 +174,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -268,7 +272,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) # **logoutUser** -> logoutUser() +> Map logoutUser() Logs out current logged in user session @@ -279,7 +283,8 @@ import 'package:openapi/api.dart'; final api_instance = UserApi(); try { - api_instance.logoutUser(); + final result = api_instance.logoutUser(); + print(result); } catch (e) { print('Exception when calling UserApi->logoutUser: $e\n'); } @@ -290,7 +295,7 @@ This endpoint does not need any parameter. ### Return type -void (empty response body) +**Map** ### Authorization @@ -304,7 +309,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) # **updateUser** -> updateUser(username, user) +> Map updateUser(username, user) Updated user @@ -319,7 +324,8 @@ final username = username_example; // String | name that need to be deleted final user = User(); // User | Updated user object try { - api_instance.updateUser(username, user); + final result = api_instance.updateUser(username, user); + print(result); } catch (e) { print('Exception when calling UserApi->updateUser: $e\n'); } @@ -334,7 +340,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart index 34d6adae2fa5..1e655a5a9ef3 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/another_fake_api.dart index e74ea06483b1..d573e1e784a2 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/another_fake_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/another_fake_api.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -12,7 +12,7 @@ part of openapi.api; class AnotherFakeApi { - AnotherFakeApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + AnotherFakeApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; @@ -27,16 +27,11 @@ class AnotherFakeApi { /// * [ModelClient] modelClient (required): /// client model Future call123testSpecialTagsWithHttpInfo(ModelClient modelClient,) async { - // Verify required params are set. - if (modelClient == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: modelClient'); - } - // ignore: prefer_const_declarations final path = r'/another-fake/dummy'; // ignore: prefer_final_locals - Object postBody = modelClient; + Object? postBody = modelClient; final queryParams = []; final headerParams = {}; @@ -66,7 +61,7 @@ class AnotherFakeApi { /// /// * [ModelClient] modelClient (required): /// client model - Future call123testSpecialTags(ModelClient modelClient,) async { + Future call123testSpecialTags(ModelClient modelClient,) async { final response = await call123testSpecialTagsWithHttpInfo(modelClient,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -74,9 +69,8 @@ class AnotherFakeApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ModelClient',) as ModelClient; } - return Future.value(); } } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart index 1f3eca5bc847..0cbf96e7a37d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -12,7 +12,7 @@ part of openapi.api; class DefaultApi { - DefaultApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + DefaultApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; @@ -22,7 +22,7 @@ class DefaultApi { final path = r'/foo'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -44,7 +44,7 @@ class DefaultApi { ); } - Future fooGet() async { + Future fooGet() async { final response = await fooGetWithHttpInfo(); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -52,9 +52,8 @@ class DefaultApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'InlineResponseDefault',) as InlineResponseDefault; } - return Future.value(); } } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart index 33c432434040..c868d973e2cc 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -12,7 +12,7 @@ part of openapi.api; class FakeApi { - FakeApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + FakeApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; @@ -24,7 +24,7 @@ class FakeApi { final path = r'/fake/health'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -47,7 +47,7 @@ class FakeApi { } /// Health check endpoint - Future fakeHealthGet() async { + Future fakeHealthGet() async { final response = await fakeHealthGetWithHttpInfo(); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -55,10 +55,9 @@ class FakeApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'HealthCheckResult',) as HealthCheckResult; } - return Future.value(); } /// test http signature authentication @@ -75,17 +74,12 @@ class FakeApi { /// /// * [String] header1: /// header parameter - Future fakeHttpSignatureTestWithHttpInfo(Pet pet, { String query1, String header1, }) async { - // Verify required params are set. - if (pet == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: pet'); - } - + Future fakeHttpSignatureTestWithHttpInfo(Pet pet, { String? query1, String? header1, }) async { // ignore: prefer_const_declarations final path = r'/fake/http-signature-test'; // ignore: prefer_final_locals - Object postBody = pet; + Object? postBody = pet; final queryParams = []; final headerParams = {}; @@ -127,11 +121,17 @@ class FakeApi { /// /// * [String] header1: /// header parameter - Future fakeHttpSignatureTest(Pet pet, { String query1, String header1, }) async { + Future?> fakeHttpSignatureTest(Pet pet, { String? query1, String? header1, }) async { final response = await fakeHttpSignatureTestWithHttpInfo(pet, query1: query1, header1: header1, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// Test serialization of outer boolean types @@ -142,14 +142,12 @@ class FakeApi { /// /// * [bool] body: /// Input boolean as post body - Future fakeOuterBooleanSerializeWithHttpInfo({ bool body, }) async { - // Verify required params are set. - + Future fakeOuterBooleanSerializeWithHttpInfo({ bool? body, }) async { // ignore: prefer_const_declarations final path = r'/fake/outer/boolean'; // ignore: prefer_final_locals - Object postBody = body; + Object? postBody = body; final queryParams = []; final headerParams = {}; @@ -177,7 +175,7 @@ class FakeApi { /// /// * [bool] body: /// Input boolean as post body - Future fakeOuterBooleanSerialize({ bool body, }) async { + Future fakeOuterBooleanSerialize({ bool? body, }) async { final response = await fakeOuterBooleanSerializeWithHttpInfo( body: body, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -185,10 +183,9 @@ class FakeApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'bool',) as bool; } - return Future.value(); } /// Test serialization of object with outer number type @@ -199,14 +196,12 @@ class FakeApi { /// /// * [OuterComposite] outerComposite: /// Input composite as post body - Future fakeOuterCompositeSerializeWithHttpInfo({ OuterComposite outerComposite, }) async { - // Verify required params are set. - + Future fakeOuterCompositeSerializeWithHttpInfo({ OuterComposite? outerComposite, }) async { // ignore: prefer_const_declarations final path = r'/fake/outer/composite'; // ignore: prefer_final_locals - Object postBody = outerComposite; + Object? postBody = outerComposite; final queryParams = []; final headerParams = {}; @@ -234,7 +229,7 @@ class FakeApi { /// /// * [OuterComposite] outerComposite: /// Input composite as post body - Future fakeOuterCompositeSerialize({ OuterComposite outerComposite, }) async { + Future fakeOuterCompositeSerialize({ OuterComposite? outerComposite, }) async { final response = await fakeOuterCompositeSerializeWithHttpInfo( outerComposite: outerComposite, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -242,10 +237,9 @@ class FakeApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'OuterComposite',) as OuterComposite; } - return Future.value(); } /// Test serialization of outer number types @@ -256,14 +250,12 @@ class FakeApi { /// /// * [num] body: /// Input number as post body - Future fakeOuterNumberSerializeWithHttpInfo({ num body, }) async { - // Verify required params are set. - + Future fakeOuterNumberSerializeWithHttpInfo({ num? body, }) async { // ignore: prefer_const_declarations final path = r'/fake/outer/number'; // ignore: prefer_final_locals - Object postBody = body; + Object? postBody = body; final queryParams = []; final headerParams = {}; @@ -291,7 +283,7 @@ class FakeApi { /// /// * [num] body: /// Input number as post body - Future fakeOuterNumberSerialize({ num body, }) async { + Future fakeOuterNumberSerialize({ num? body, }) async { final response = await fakeOuterNumberSerializeWithHttpInfo( body: body, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -299,10 +291,9 @@ class FakeApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'num',) as num; } - return Future.value(); } /// Test serialization of outer string types @@ -313,14 +304,12 @@ class FakeApi { /// /// * [String] body: /// Input string as post body - Future fakeOuterStringSerializeWithHttpInfo({ String body, }) async { - // Verify required params are set. - + Future fakeOuterStringSerializeWithHttpInfo({ String? body, }) async { // ignore: prefer_const_declarations final path = r'/fake/outer/string'; // ignore: prefer_final_locals - Object postBody = body; + Object? postBody = body; final queryParams = []; final headerParams = {}; @@ -348,7 +337,7 @@ class FakeApi { /// /// * [String] body: /// Input string as post body - Future fakeOuterStringSerialize({ String body, }) async { + Future fakeOuterStringSerialize({ String? body, }) async { final response = await fakeOuterStringSerializeWithHttpInfo( body: body, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -356,10 +345,9 @@ class FakeApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'String',) as String; } - return Future.value(); } /// Test serialization of enum (int) properties with examples @@ -371,16 +359,11 @@ class FakeApi { /// * [OuterObjectWithEnumProperty] outerObjectWithEnumProperty (required): /// Input enum (int) as post body Future fakePropertyEnumIntegerSerializeWithHttpInfo(OuterObjectWithEnumProperty outerObjectWithEnumProperty,) async { - // Verify required params are set. - if (outerObjectWithEnumProperty == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: outerObjectWithEnumProperty'); - } - // ignore: prefer_const_declarations final path = r'/fake/property/enum-int'; // ignore: prefer_final_locals - Object postBody = outerObjectWithEnumProperty; + Object? postBody = outerObjectWithEnumProperty; final queryParams = []; final headerParams = {}; @@ -408,7 +391,7 @@ class FakeApi { /// /// * [OuterObjectWithEnumProperty] outerObjectWithEnumProperty (required): /// Input enum (int) as post body - Future fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty,) async { + Future fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty,) async { final response = await fakePropertyEnumIntegerSerializeWithHttpInfo(outerObjectWithEnumProperty,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -416,10 +399,9 @@ class FakeApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'OuterObjectWithEnumProperty',) as OuterObjectWithEnumProperty; } - return Future.value(); } /// For this test, the body has to be a binary file. @@ -431,16 +413,11 @@ class FakeApi { /// * [MultipartFile] body (required): /// image to upload Future testBodyWithBinaryWithHttpInfo(MultipartFile body,) async { - // Verify required params are set. - if (body == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: body'); - } - // ignore: prefer_const_declarations final path = r'/fake/body-with-binary'; // ignore: prefer_final_locals - Object postBody = body; + Object? postBody = body; final queryParams = []; final headerParams = {}; @@ -468,11 +445,17 @@ class FakeApi { /// /// * [MultipartFile] body (required): /// image to upload - Future testBodyWithBinary(MultipartFile body,) async { + Future?> testBodyWithBinary(MultipartFile body,) async { final response = await testBodyWithBinaryWithHttpInfo(body,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// For this test, the body for this request must reference a schema named `File`. @@ -483,16 +466,11 @@ class FakeApi { /// /// * [FileSchemaTestClass] fileSchemaTestClass (required): Future testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass,) async { - // Verify required params are set. - if (fileSchemaTestClass == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: fileSchemaTestClass'); - } - // ignore: prefer_const_declarations final path = r'/fake/body-with-file-schema'; // ignore: prefer_final_locals - Object postBody = fileSchemaTestClass; + Object? postBody = fileSchemaTestClass; final queryParams = []; final headerParams = {}; @@ -519,11 +497,17 @@ class FakeApi { /// Parameters: /// /// * [FileSchemaTestClass] fileSchemaTestClass (required): - Future testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass,) async { + Future?> testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass,) async { final response = await testBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// Performs an HTTP 'PUT /fake/body-with-query-params' operation and returns the [Response]. @@ -533,19 +517,11 @@ class FakeApi { /// /// * [User] user (required): Future testBodyWithQueryParamsWithHttpInfo(String query, User user,) async { - // Verify required params are set. - if (query == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: query'); - } - if (user == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); - } - // ignore: prefer_const_declarations final path = r'/fake/body-with-query-params'; // ignore: prefer_final_locals - Object postBody = user; + Object? postBody = user; final queryParams = []; final headerParams = {}; @@ -574,11 +550,17 @@ class FakeApi { /// * [String] query (required): /// /// * [User] user (required): - Future testBodyWithQueryParams(String query, User user,) async { + Future?> testBodyWithQueryParams(String query, User user,) async { final response = await testBodyWithQueryParamsWithHttpInfo(query, user,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// To test \"client\" model @@ -592,16 +574,11 @@ class FakeApi { /// * [ModelClient] modelClient (required): /// client model Future testClientModelWithHttpInfo(ModelClient modelClient,) async { - // Verify required params are set. - if (modelClient == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: modelClient'); - } - // ignore: prefer_const_declarations final path = r'/fake'; // ignore: prefer_final_locals - Object postBody = modelClient; + Object? postBody = modelClient; final queryParams = []; final headerParams = {}; @@ -631,7 +608,7 @@ class FakeApi { /// /// * [ModelClient] modelClient (required): /// client model - Future testClientModel(ModelClient modelClient,) async { + Future testClientModel(ModelClient modelClient,) async { final response = await testClientModelWithHttpInfo(modelClient,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -639,10 +616,9 @@ class FakeApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ModelClient',) as ModelClient; } - return Future.value(); } /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -694,26 +670,12 @@ class FakeApi { /// /// * [String] callback: /// None - Future testEndpointParametersWithHttpInfo(num number, double double_, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback, }) async { - // Verify required params are set. - if (number == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: number'); - } - if (double_ == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: double_'); - } - if (patternWithoutDelimiter == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: patternWithoutDelimiter'); - } - if (byte == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: byte'); - } - + Future testEndpointParametersWithHttpInfo(num number, double double_, String patternWithoutDelimiter, String byte, { int? integer, int? int32, int? int64, double? float, String? string, MultipartFile? binary, DateTime? date, DateTime? dateTime, String? password, String? callback, }) async { // ignore: prefer_const_declarations final path = r'/fake'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -821,11 +783,17 @@ class FakeApi { /// /// * [String] callback: /// None - Future testEndpointParameters(num number, double double_, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback, }) async { + Future?> testEndpointParameters(num number, double double_, String patternWithoutDelimiter, String byte, { int? integer, int? int32, int? int64, double? float, String? string, MultipartFile? binary, DateTime? date, DateTime? dateTime, String? password, String? callback, }) async { final response = await testEndpointParametersWithHttpInfo(number, double_, patternWithoutDelimiter, byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// To test enum parameters @@ -859,14 +827,12 @@ class FakeApi { /// /// * [String] enumFormString: /// Form parameter enum test (string) - Future testEnumParametersWithHttpInfo({ List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, List enumFormStringArray, String enumFormString, }) async { - // Verify required params are set. - + Future testEnumParametersWithHttpInfo({ List? enumHeaderStringArray, String? enumHeaderString, List? enumQueryStringArray, String? enumQueryString, int? enumQueryInteger, double? enumQueryDouble, List? enumFormStringArray, String? enumFormString, }) async { // ignore: prefer_const_declarations final path = r'/fake'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -943,11 +909,17 @@ class FakeApi { /// /// * [String] enumFormString: /// Form parameter enum test (string) - Future testEnumParameters({ List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, List enumFormStringArray, String enumFormString, }) async { + Future?> testEnumParameters({ List? enumHeaderStringArray, String? enumHeaderString, List? enumQueryStringArray, String? enumQueryString, int? enumQueryInteger, double? enumQueryDouble, List? enumFormStringArray, String? enumFormString, }) async { final response = await testEnumParametersWithHttpInfo( enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// Fake endpoint to test group parameters (optional) @@ -975,23 +947,12 @@ class FakeApi { /// /// * [int] int64Group: /// Integer in group parameters - Future testGroupParametersWithHttpInfo(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int stringGroup, bool booleanGroup, int int64Group, }) async { - // Verify required params are set. - if (requiredStringGroup == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: requiredStringGroup'); - } - if (requiredBooleanGroup == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: requiredBooleanGroup'); - } - if (requiredInt64Group == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: requiredInt64Group'); - } - + Future testGroupParametersWithHttpInfo(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int? stringGroup, bool? booleanGroup, int? int64Group, }) async { // ignore: prefer_const_declarations final path = r'/fake'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -1050,11 +1011,17 @@ class FakeApi { /// /// * [int] int64Group: /// Integer in group parameters - Future testGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int stringGroup, bool booleanGroup, int int64Group, }) async { + Future?> testGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int? stringGroup, bool? booleanGroup, int? int64Group, }) async { final response = await testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// test inline additionalProperties @@ -1066,16 +1033,11 @@ class FakeApi { /// * [Map] requestBody (required): /// request body Future testInlineAdditionalPropertiesWithHttpInfo(Map requestBody,) async { - // Verify required params are set. - if (requestBody == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: requestBody'); - } - // ignore: prefer_const_declarations final path = r'/fake/inline-additionalProperties'; // ignore: prefer_final_locals - Object postBody = requestBody; + Object? postBody = requestBody; final queryParams = []; final headerParams = {}; @@ -1103,11 +1065,17 @@ class FakeApi { /// /// * [Map] requestBody (required): /// request body - Future testInlineAdditionalProperties(Map requestBody,) async { + Future?> testInlineAdditionalProperties(Map requestBody,) async { final response = await testInlineAdditionalPropertiesWithHttpInfo(requestBody,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// test json serialization of form data @@ -1122,19 +1090,11 @@ class FakeApi { /// * [String] param2 (required): /// field2 Future testJsonFormDataWithHttpInfo(String param, String param2,) async { - // Verify required params are set. - if (param == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: param'); - } - if (param2 == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: param2'); - } - // ignore: prefer_const_declarations final path = r'/fake/jsonFormData'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -1171,11 +1131,17 @@ class FakeApi { /// /// * [String] param2 (required): /// field2 - Future testJsonFormData(String param, String param2,) async { + Future?> testJsonFormData(String param, String param2,) async { final response = await testJsonFormDataWithHttpInfo(param, param2,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// To test the collection format in query parameters @@ -1197,32 +1163,12 @@ class FakeApi { /// * [String] allowEmpty (required): /// /// * [Map] language: - Future testQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, String allowEmpty, { Map language, }) async { - // Verify required params are set. - if (pipe == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: pipe'); - } - if (ioutil == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: ioutil'); - } - if (http == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: http'); - } - if (url == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: url'); - } - if (context == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: context'); - } - if (allowEmpty == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: allowEmpty'); - } - + Future testQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, String allowEmpty, { Map? language, }) async { // ignore: prefer_const_declarations final path = r'/fake/test-query-parameters'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -1271,10 +1217,16 @@ class FakeApi { /// * [String] allowEmpty (required): /// /// * [Map] language: - Future testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, String allowEmpty, { Map language, }) async { + Future?> testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, String allowEmpty, { Map? language, }) async { final response = await testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, allowEmpty, language: language, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart index 9f92e00b7bd7..0bb5a0131756 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -12,7 +12,7 @@ part of openapi.api; class FakeClassnameTags123Api { - FakeClassnameTags123Api([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + FakeClassnameTags123Api([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; @@ -27,16 +27,11 @@ class FakeClassnameTags123Api { /// * [ModelClient] modelClient (required): /// client model Future testClassnameWithHttpInfo(ModelClient modelClient,) async { - // Verify required params are set. - if (modelClient == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: modelClient'); - } - // ignore: prefer_const_declarations final path = r'/fake_classname_test'; // ignore: prefer_final_locals - Object postBody = modelClient; + Object? postBody = modelClient; final queryParams = []; final headerParams = {}; @@ -66,7 +61,7 @@ class FakeClassnameTags123Api { /// /// * [ModelClient] modelClient (required): /// client model - Future testClassname(ModelClient modelClient,) async { + Future testClassname(ModelClient modelClient,) async { final response = await testClassnameWithHttpInfo(modelClient,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -74,9 +69,8 @@ class FakeClassnameTags123Api { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ModelClient',) as ModelClient; } - return Future.value(); } } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart index b9217fef597b..febea0f0a669 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -12,7 +12,7 @@ part of openapi.api; class PetApi { - PetApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + PetApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; @@ -25,16 +25,11 @@ class PetApi { /// * [Pet] pet (required): /// Pet object that needs to be added to the store Future addPetWithHttpInfo(Pet pet,) async { - // Verify required params are set. - if (pet == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: pet'); - } - // ignore: prefer_const_declarations final path = r'/pet'; // ignore: prefer_final_locals - Object postBody = pet; + Object? postBody = pet; final queryParams = []; final headerParams = {}; @@ -62,11 +57,17 @@ class PetApi { /// /// * [Pet] pet (required): /// Pet object that needs to be added to the store - Future addPet(Pet pet,) async { + Future?> addPet(Pet pet,) async { final response = await addPetWithHttpInfo(pet,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// Deletes a pet @@ -79,18 +80,13 @@ class PetApi { /// Pet id to delete /// /// * [String] apiKey: - Future deletePetWithHttpInfo(int petId, { String apiKey, }) async { - // Verify required params are set. - if (petId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); - } - + Future deletePetWithHttpInfo(int petId, { String? apiKey, }) async { // ignore: prefer_const_declarations final path = r'/pet/{petId}' .replaceAll('{petId}', petId.toString()); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -124,11 +120,17 @@ class PetApi { /// Pet id to delete /// /// * [String] apiKey: - Future deletePet(int petId, { String apiKey, }) async { + Future?> deletePet(int petId, { String? apiKey, }) async { final response = await deletePetWithHttpInfo(petId, apiKey: apiKey, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// Finds Pets by status @@ -142,16 +144,11 @@ class PetApi { /// * [List] status (required): /// Status values that need to be considered for filter Future findPetsByStatusWithHttpInfo(List status,) async { - // Verify required params are set. - if (status == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: status'); - } - // ignore: prefer_const_declarations final path = r'/pet/findByStatus'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -183,7 +180,7 @@ class PetApi { /// /// * [List] status (required): /// Status values that need to be considered for filter - Future> findPetsByStatus(List status,) async { + Future?> findPetsByStatus(List status,) async { final response = await findPetsByStatusWithHttpInfo(status,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -191,13 +188,12 @@ class PetApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { final responseBody = await _decodeBodyBytes(response); return (await apiClient.deserializeAsync(responseBody, 'List') as List) .cast() .toList(growable: false); } - return Future>.value(); } /// Finds Pets by tags @@ -211,16 +207,11 @@ class PetApi { /// * [Set] tags (required): /// Tags to filter by Future findPetsByTagsWithHttpInfo(Set tags,) async { - // Verify required params are set. - if (tags == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: tags'); - } - // ignore: prefer_const_declarations final path = r'/pet/findByTags'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -252,7 +243,7 @@ class PetApi { /// /// * [Set] tags (required): /// Tags to filter by - Future> findPetsByTags(Set tags,) async { + Future?> findPetsByTags(Set tags,) async { final response = await findPetsByTagsWithHttpInfo(tags,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -260,13 +251,12 @@ class PetApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { final responseBody = await _decodeBodyBytes(response); return (await apiClient.deserializeAsync(responseBody, 'Set') as List) .cast() .toSet(); } - return Future>.value(); } /// Find pet by ID @@ -280,17 +270,12 @@ class PetApi { /// * [int] petId (required): /// ID of pet to return Future getPetByIdWithHttpInfo(int petId,) async { - // Verify required params are set. - if (petId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); - } - // ignore: prefer_const_declarations final path = r'/pet/{petId}' .replaceAll('{petId}', petId.toString()); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -320,7 +305,7 @@ class PetApi { /// /// * [int] petId (required): /// ID of pet to return - Future getPetById(int petId,) async { + Future getPetById(int petId,) async { final response = await getPetByIdWithHttpInfo(petId,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -328,10 +313,9 @@ class PetApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet; } - return Future.value(); } /// Update an existing pet @@ -343,16 +327,11 @@ class PetApi { /// * [Pet] pet (required): /// Pet object that needs to be added to the store Future updatePetWithHttpInfo(Pet pet,) async { - // Verify required params are set. - if (pet == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: pet'); - } - // ignore: prefer_const_declarations final path = r'/pet'; // ignore: prefer_final_locals - Object postBody = pet; + Object? postBody = pet; final queryParams = []; final headerParams = {}; @@ -380,11 +359,17 @@ class PetApi { /// /// * [Pet] pet (required): /// Pet object that needs to be added to the store - Future updatePet(Pet pet,) async { + Future?> updatePet(Pet pet,) async { final response = await updatePetWithHttpInfo(pet,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// Updates a pet in the store with form data @@ -401,18 +386,13 @@ class PetApi { /// /// * [String] status: /// Updated status of the pet - Future updatePetWithFormWithHttpInfo(int petId, { String name, String status, }) async { - // Verify required params are set. - if (petId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); - } - + Future updatePetWithFormWithHttpInfo(int petId, { String? name, String? status, }) async { // ignore: prefer_const_declarations final path = r'/pet/{petId}' .replaceAll('{petId}', petId.toString()); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -452,11 +432,17 @@ class PetApi { /// /// * [String] status: /// Updated status of the pet - Future updatePetWithForm(int petId, { String name, String status, }) async { + Future?> updatePetWithForm(int petId, { String? name, String? status, }) async { final response = await updatePetWithFormWithHttpInfo(petId, name: name, status: status, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// uploads an image @@ -473,18 +459,13 @@ class PetApi { /// /// * [MultipartFile] file: /// file to upload - Future uploadFileWithHttpInfo(int petId, { String additionalMetadata, MultipartFile file, }) async { - // Verify required params are set. - if (petId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); - } - + Future uploadFileWithHttpInfo(int petId, { String? additionalMetadata, MultipartFile? file, }) async { // ignore: prefer_const_declarations final path = r'/pet/{petId}/uploadImage' .replaceAll('{petId}', petId.toString()); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -532,7 +513,7 @@ class PetApi { /// /// * [MultipartFile] file: /// file to upload - Future uploadFile(int petId, { String additionalMetadata, MultipartFile file, }) async { + Future uploadFile(int petId, { String? additionalMetadata, MultipartFile? file, }) async { final response = await uploadFileWithHttpInfo(petId, additionalMetadata: additionalMetadata, file: file, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -540,10 +521,9 @@ class PetApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ApiResponse',) as ApiResponse; } - return Future.value(); } /// uploads an image (required) @@ -560,21 +540,13 @@ class PetApi { /// /// * [String] additionalMetadata: /// Additional data to pass to server - Future uploadFileWithRequiredFileWithHttpInfo(int petId, MultipartFile requiredFile, { String additionalMetadata, }) async { - // Verify required params are set. - if (petId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); - } - if (requiredFile == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: requiredFile'); - } - + Future uploadFileWithRequiredFileWithHttpInfo(int petId, MultipartFile requiredFile, { String? additionalMetadata, }) async { // ignore: prefer_const_declarations final path = r'/fake/{petId}/uploadImageWithRequiredFile' .replaceAll('{petId}', petId.toString()); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -622,7 +594,7 @@ class PetApi { /// /// * [String] additionalMetadata: /// Additional data to pass to server - Future uploadFileWithRequiredFile(int petId, MultipartFile requiredFile, { String additionalMetadata, }) async { + Future uploadFileWithRequiredFile(int petId, MultipartFile requiredFile, { String? additionalMetadata, }) async { final response = await uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata: additionalMetadata, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -630,9 +602,8 @@ class PetApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ApiResponse',) as ApiResponse; } - return Future.value(); } } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/store_api.dart index 2137c99ba85f..0fe0c4fe02b6 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/store_api.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -12,7 +12,7 @@ part of openapi.api; class StoreApi { - StoreApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + StoreApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; @@ -27,17 +27,12 @@ class StoreApi { /// * [String] orderId (required): /// ID of the order that needs to be deleted Future deleteOrderWithHttpInfo(String orderId,) async { - // Verify required params are set. - if (orderId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: orderId'); - } - // ignore: prefer_const_declarations final path = r'/store/order/{order_id}' .replaceAll('{order_id}', orderId); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -67,11 +62,17 @@ class StoreApi { /// /// * [String] orderId (required): /// ID of the order that needs to be deleted - Future deleteOrder(String orderId,) async { + Future?> deleteOrder(String orderId,) async { final response = await deleteOrderWithHttpInfo(orderId,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// Returns pet inventories by status @@ -84,7 +85,7 @@ class StoreApi { final path = r'/store/inventory'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -109,7 +110,7 @@ class StoreApi { /// Returns pet inventories by status /// /// Returns a map of status codes to quantities - Future> getInventory() async { + Future?> getInventory() async { final response = await getInventoryWithHttpInfo(); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -117,10 +118,9 @@ class StoreApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return Map.from(await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map'),); } - return Future>.value(); } /// Find purchase order by ID @@ -134,17 +134,12 @@ class StoreApi { /// * [int] orderId (required): /// ID of pet that needs to be fetched Future getOrderByIdWithHttpInfo(int orderId,) async { - // Verify required params are set. - if (orderId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: orderId'); - } - // ignore: prefer_const_declarations final path = r'/store/order/{order_id}' .replaceAll('{order_id}', orderId.toString()); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -174,7 +169,7 @@ class StoreApi { /// /// * [int] orderId (required): /// ID of pet that needs to be fetched - Future getOrderById(int orderId,) async { + Future getOrderById(int orderId,) async { final response = await getOrderByIdWithHttpInfo(orderId,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -182,10 +177,9 @@ class StoreApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order; } - return Future.value(); } /// Place an order for a pet @@ -197,16 +191,11 @@ class StoreApi { /// * [Order] order (required): /// order placed for purchasing the pet Future placeOrderWithHttpInfo(Order order,) async { - // Verify required params are set. - if (order == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: order'); - } - // ignore: prefer_const_declarations final path = r'/store/order'; // ignore: prefer_final_locals - Object postBody = order; + Object? postBody = order; final queryParams = []; final headerParams = {}; @@ -234,7 +223,7 @@ class StoreApi { /// /// * [Order] order (required): /// order placed for purchasing the pet - Future placeOrder(Order order,) async { + Future placeOrder(Order order,) async { final response = await placeOrderWithHttpInfo(order,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -242,9 +231,8 @@ class StoreApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order; } - return Future.value(); } } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/user_api.dart index ceecb982903e..0d39c1c75508 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/user_api.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -12,7 +12,7 @@ part of openapi.api; class UserApi { - UserApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + UserApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; @@ -27,16 +27,11 @@ class UserApi { /// * [User] user (required): /// Created user object Future createUserWithHttpInfo(User user,) async { - // Verify required params are set. - if (user == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); - } - // ignore: prefer_const_declarations final path = r'/user'; // ignore: prefer_final_locals - Object postBody = user; + Object? postBody = user; final queryParams = []; final headerParams = {}; @@ -66,11 +61,17 @@ class UserApi { /// /// * [User] user (required): /// Created user object - Future createUser(User user,) async { + Future?> createUser(User user,) async { final response = await createUserWithHttpInfo(user,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// Creates list of users with given input array @@ -82,16 +83,11 @@ class UserApi { /// * [List] user (required): /// List of user object Future createUsersWithArrayInputWithHttpInfo(List user,) async { - // Verify required params are set. - if (user == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); - } - // ignore: prefer_const_declarations final path = r'/user/createWithArray'; // ignore: prefer_final_locals - Object postBody = user; + Object? postBody = user; final queryParams = []; final headerParams = {}; @@ -119,11 +115,17 @@ class UserApi { /// /// * [List] user (required): /// List of user object - Future createUsersWithArrayInput(List user,) async { + Future?> createUsersWithArrayInput(List user,) async { final response = await createUsersWithArrayInputWithHttpInfo(user,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// Creates list of users with given input array @@ -135,16 +137,11 @@ class UserApi { /// * [List] user (required): /// List of user object Future createUsersWithListInputWithHttpInfo(List user,) async { - // Verify required params are set. - if (user == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); - } - // ignore: prefer_const_declarations final path = r'/user/createWithList'; // ignore: prefer_final_locals - Object postBody = user; + Object? postBody = user; final queryParams = []; final headerParams = {}; @@ -172,11 +169,17 @@ class UserApi { /// /// * [List] user (required): /// List of user object - Future createUsersWithListInput(List user,) async { + Future?> createUsersWithListInput(List user,) async { final response = await createUsersWithListInputWithHttpInfo(user,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// Delete user @@ -190,17 +193,12 @@ class UserApi { /// * [String] username (required): /// The name that needs to be deleted Future deleteUserWithHttpInfo(String username,) async { - // Verify required params are set. - if (username == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); - } - // ignore: prefer_const_declarations final path = r'/user/{username}' .replaceAll('{username}', username); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -230,11 +228,17 @@ class UserApi { /// /// * [String] username (required): /// The name that needs to be deleted - Future deleteUser(String username,) async { + Future?> deleteUser(String username,) async { final response = await deleteUserWithHttpInfo(username,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// Get user by user name @@ -246,17 +250,12 @@ class UserApi { /// * [String] username (required): /// The name that needs to be fetched. Use user1 for testing. Future getUserByNameWithHttpInfo(String username,) async { - // Verify required params are set. - if (username == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); - } - // ignore: prefer_const_declarations final path = r'/user/{username}' .replaceAll('{username}', username); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -284,7 +283,7 @@ class UserApi { /// /// * [String] username (required): /// The name that needs to be fetched. Use user1 for testing. - Future getUserByName(String username,) async { + Future getUserByName(String username,) async { final response = await getUserByNameWithHttpInfo(username,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -292,10 +291,9 @@ class UserApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'User',) as User; } - return Future.value(); } /// Logs user into the system @@ -310,19 +308,11 @@ class UserApi { /// * [String] password (required): /// The password for login in clear text Future loginUserWithHttpInfo(String username, String password,) async { - // Verify required params are set. - if (username == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); - } - if (password == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: password'); - } - // ignore: prefer_const_declarations final path = r'/user/login'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -356,7 +346,7 @@ class UserApi { /// /// * [String] password (required): /// The password for login in clear text - Future loginUser(String username, String password,) async { + Future loginUser(String username, String password,) async { final response = await loginUserWithHttpInfo(username, password,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -364,10 +354,9 @@ class UserApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'String',) as String; } - return Future.value(); } /// Logs out current logged in user session @@ -378,7 +367,7 @@ class UserApi { final path = r'/user/logout'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -401,11 +390,17 @@ class UserApi { } /// Logs out current logged in user session - Future logoutUser() async { + Future?> logoutUser() async { final response = await logoutUserWithHttpInfo(); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } /// Updated user @@ -422,20 +417,12 @@ class UserApi { /// * [User] user (required): /// Updated user object Future updateUserWithHttpInfo(String username, User user,) async { - // Verify required params are set. - if (username == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); - } - if (user == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); - } - // ignore: prefer_const_declarations final path = r'/user/{username}' .replaceAll('{username}', username); // ignore: prefer_final_locals - Object postBody = user; + Object? postBody = user; final queryParams = []; final headerParams = {}; @@ -468,10 +455,16 @@ class UserApi { /// /// * [User] user (required): /// Updated user object - Future updateUser(String username, User user,) async { + Future?> updateUser(String username, User user,) async { final response = await updateUserWithHttpInfo(username, user,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; + } } } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart index ed19ac296344..712a17ac2848 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -30,12 +30,7 @@ class ApiClient { Client get client => _client; /// Requests to use a new HTTP [Client] in this class. - /// - /// If the [newClient] is null, an [ArgumentError] is thrown. set client(Client newClient) { - if (newClient == null) { - throw ArgumentError('New client instance cannot be null.'); - } _client = newClient; } @@ -52,7 +47,7 @@ class ApiClient { /// or deleted. Map get authentications => Map.unmodifiable(_authentications); - T getAuthentication(String name) { + T? getAuthentication(String name) { final authentication = _authentications[name]; return authentication is T ? authentication : null; } @@ -63,10 +58,10 @@ class ApiClient { String path, String method, List queryParams, - Object body, + Object? body, Map headerParams, Map formParams, - String nullableContentType, + String? nullableContentType, List authNames, ) async { _updateParamsForAuth(authNames, queryParams, headerParams); @@ -145,12 +140,12 @@ class ApiClient { throw ApiException(HttpStatus.badRequest, 'Invalid HTTP operation: $method $path',); } - Future deserializeAsync(String json, String targetType, {bool growable}) async => + Future deserializeAsync(String json, String targetType, {bool? growable}) async => // ignore: deprecated_member_use_from_same_package deserialize(json, targetType, growable: growable); @Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use deserializeAsync() instead.') - dynamic deserialize(String json, String targetType, {bool growable}) { + dynamic deserialize(String json, String targetType, {bool? growable}) { // Remove all spaces. Necessary for regular expressions as well. targetType = targetType.replaceAll(' ', ''); // ignore: parameter_assignments @@ -161,10 +156,10 @@ class ApiClient { } // ignore: deprecated_member_use_from_same_package - Future serializeAsync(Object value) async => serialize(value); + Future serializeAsync(Object? value) async => serialize(value); @Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use serializeAsync() instead.') - String serialize(Object value) => value == null ? '' : json.encode(value); + String serialize(Object? value) => value == null ? '' : json.encode(value); /// Update query and header parameters based on authentication settings. /// @param authNames The authentications to apply @@ -182,7 +177,7 @@ class ApiClient { } } - static dynamic _deserialize(dynamic value, String targetType, {bool growable}) { + static dynamic _deserialize(dynamic value, String targetType, {bool? growable}) { try { switch (targetType) { case 'String': @@ -295,21 +290,21 @@ class ApiClient { case 'User': return User.fromJson(value); default: - Match match; + Match? match; if (value is List && (match = _regList.firstMatch(targetType)) != null) { - targetType = match[1]; // ignore: parameter_assignments + targetType = match![1]!; // ignore: parameter_assignments return value .map((dynamic v) => _deserialize(v, targetType, growable: growable)) - .toList(growable: growable); + .toList(growable: growable == true); } if (value is Set && (match = _regSet.firstMatch(targetType)) != null) { - targetType = match[1]; // ignore: parameter_assignments + targetType = match![1]!; // ignore: parameter_assignments return value .map((dynamic v) => _deserialize(v, targetType, growable: growable)) .toSet(); } if (value is Map && (match = _regMap.firstMatch(targetType)) != null) { - targetType = match[1]; // ignore: parameter_assignments + targetType = match![1]!; // ignore: parameter_assignments return Map.fromIterables( value.keys.cast(), value.values.map((dynamic v) => _deserialize(v, targetType, growable: growable)), @@ -326,8 +321,8 @@ class ApiClient { /// Primarily intended for use in an isolate. class DeserializationMessage { const DeserializationMessage({ - @required this.json, - @required this.targetType, + required this.json, + required this.targetType, this.growable, }); @@ -338,7 +333,7 @@ class DeserializationMessage { final String targetType; /// Whether to make deserialized lists or maps growable. - final bool growable; + final bool? growable; } /// Primarily intended for use in an isolate. @@ -357,4 +352,4 @@ Future deserializeAsync(DeserializationMessage message) async { } /// Primarily intended for use in an isolate. -Future serializeAsync(Object value) async => value == null ? '' : json.encode(value); +Future serializeAsync(Object? value) async => value == null ? '' : json.encode(value); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_exception.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_exception.dart index 8ffc340b4c9d..a01cb9f94a8c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_exception.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_exception.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,9 +16,9 @@ class ApiException implements Exception { ApiException.withInner(this.code, this.message, this.innerException, this.stackTrace); int code = 0; - String message; - Exception innerException; - StackTrace stackTrace; + String? message; + Exception? innerException; + StackTrace? stackTrace; @override String toString() { diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_helper.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_helper.dart index bdb7b1fc166a..beb8bfa27f04 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_helper.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_helper.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -14,16 +14,16 @@ class QueryParam { const QueryParam(this.name, this.value); final String name; - final String value; + final String? value; @override - String toString() => '${Uri.encodeQueryComponent(name)}=${Uri.encodeQueryComponent(value)}'; + String toString() => '${Uri.encodeQueryComponent(name)}=${Uri.encodeQueryComponent(value ?? 'null')}'; } // Ported from the Java version. Iterable _convertParametersForCollectionFormat( - String collectionFormat, - String name, + String? collectionFormat, + String? name, dynamic value, ) { final params = []; @@ -83,39 +83,27 @@ String parameterToString(dynamic value) { Future _decodeBodyBytes(Response response) async { final contentType = response.headers['content-type']; return contentType != null && contentType.toLowerCase().startsWith('application/json') - ? response.bodyBytes == null ? null : utf8.decode(response.bodyBytes) + ? utf8.decode(response.bodyBytes) : response.body; } -/// Returns a valid [T] value found at the specified Map [key], null otherwise. -T mapValueOfType(dynamic map, String key) { - final dynamic value = map is Map ? map[key] : null; - return value is T ? value : null; -} - -/// Returns a valid Map found at the specified Map [key], null otherwise. -Map mapCastOfType(dynamic map, String key) { - final dynamic value = map is Map ? map[key] : null; - return value is Map ? value.cast() : null; -} - /// Returns a valid [DateTime] found at the specified Map [key], null otherwise. -DateTime mapDateTime(dynamic map, String key, [String pattern]) { +DateTime mapDateTime(dynamic map, String key, [String? pattern]) { final dynamic value = map is Map ? map[key] : null; if (value != null) { - int millis; + int? millis; if (value is int) { millis = value; } else if (value is String) { if (pattern == _dateEpochMarker) { millis = int.tryParse(value); } else { - return DateTime.tryParse(value); + return DateTime.parse(value); } } if (millis != null) { return DateTime.fromMillisecondsSinceEpoch(millis, isUtc: true); } } - return null; + return DateTime(1970); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/api_key_auth.dart index 0c2303af09e9..abd569b5fb74 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/api_key_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/api_key_auth.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,8 +16,8 @@ class ApiKeyAuth implements Authentication { final String location; final String paramName; - String apiKeyPrefix; - String apiKey; + String? apiKeyPrefix; + String? apiKey; @override void applyToParams(List queryParams, Map headerParams) { diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/authentication.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/authentication.dart index 4257e1900069..6a5eb38902e7 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/authentication.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/authentication.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_basic_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_basic_auth.dart index 0494f402d958..cb0211bd2559 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_basic_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_basic_auth.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -11,8 +11,8 @@ part of openapi.api; class HttpBasicAuth implements Authentication { - String username; - String password; + String? username; + String? password; @override void applyToParams(List queryParams, Map headerParams) { diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_bearer_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_bearer_auth.dart index 23e243523dd8..8d2f6ddb0f89 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_bearer_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_bearer_auth.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/oauth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/oauth.dart index 9299ac13f5bf..1aecb2d3e671 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/oauth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/oauth.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -13,7 +13,7 @@ part of openapi.api; class OAuth implements Authentication { OAuth({this.accessToken}); - String accessToken; + String? accessToken; @override void applyToParams(List queryParams, Map headerParams) { diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/additional_properties_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/additional_properties_class.dart index dc1f488f0b22..44c68719a4b1 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/additional_properties_class.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/additional_properties_class.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -17,9 +17,10 @@ class AdditionalPropertiesClass { this.mapOfMapProperty = const {}, }); - Map mapProperty; - Map> mapOfMapProperty; + Map? mapProperty; + + Map>? mapOfMapProperty; @override bool operator ==(Object other) => identical(this, other) || other is AdditionalPropertiesClass && @@ -28,9 +29,8 @@ class AdditionalPropertiesClass { @override int get hashCode => - // ignore: unnecessary_parenthesis - (mapProperty == null ? 0 : mapProperty.hashCode) + - (mapOfMapProperty == null ? 0 : mapOfMapProperty.hashCode); + mapProperty.hashCode + + mapOfMapProperty.hashCode; @override String toString() => 'AdditionalPropertiesClass[mapProperty=$mapProperty, mapOfMapProperty=$mapOfMapProperty]'; @@ -49,21 +49,15 @@ class AdditionalPropertiesClass { /// Returns a new [AdditionalPropertiesClass] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static AdditionalPropertiesClass fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return AdditionalPropertiesClass( - mapProperty: mapCastOfType(json, r'map_property'), - mapOfMapProperty: mapCastOfType(json, r'map_of_map_property'), - ); - } - return null; - } + static AdditionalPropertiesClass fromJson(Map json) => AdditionalPropertiesClass( + mapProperty: json[r'map_property'] as Map, + mapOfMapProperty: json[r'map_of_map_property'] as Map>, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(AdditionalPropertiesClass.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => AdditionalPropertiesClass.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -76,7 +70,7 @@ class AdditionalPropertiesClass { } // maps a json object with a list of AdditionalPropertiesClass-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -84,7 +78,6 @@ class AdditionalPropertiesClass { .forEach((key, dynamic value) { map[key] = AdditionalPropertiesClass.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart index d138a87c008b..6afb6467961f 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -13,13 +13,14 @@ part of openapi.api; class Animal { /// Returns a new [Animal] instance. Animal({ - @required this.className, + required this.className, this.color = 'red', }); + String className; - String color; + String? color; @override bool operator ==(Object other) => identical(this, other) || other is Animal && @@ -28,9 +29,8 @@ class Animal { @override int get hashCode => - // ignore: unnecessary_parenthesis - (className == null ? 0 : className.hashCode) + - (color == null ? 0 : color.hashCode); + className.hashCode + + color.hashCode; @override String toString() => 'Animal[className=$className, color=$color]'; @@ -47,21 +47,15 @@ class Animal { /// Returns a new [Animal] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static Animal fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return Animal( - className: mapValueOfType(json, r'className'), - color: mapValueOfType(json, r'color'), - ); - } - return null; - } + static Animal fromJson(Map json) => Animal( + className: json[r'className'] as String, + color: json[r'color'] as String, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(Animal.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => Animal.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -74,7 +68,7 @@ class Animal { } // maps a json object with a list of Animal-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -82,7 +76,6 @@ class Animal { .forEach((key, dynamic value) { map[key] = Animal.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/api_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/api_response.dart index bfd43366211f..734fd7dfc050 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/api_response.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/api_response.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -18,11 +18,12 @@ class ApiResponse { this.message, }); - int code; - String type; + int? code; - String message; + String? type; + + String? message; @override bool operator ==(Object other) => identical(this, other) || other is ApiResponse && @@ -32,10 +33,9 @@ class ApiResponse { @override int get hashCode => - // ignore: unnecessary_parenthesis - (code == null ? 0 : code.hashCode) + - (type == null ? 0 : type.hashCode) + - (message == null ? 0 : message.hashCode); + code.hashCode + + type.hashCode + + message.hashCode; @override String toString() => 'ApiResponse[code=$code, type=$type, message=$message]'; @@ -57,22 +57,16 @@ class ApiResponse { /// Returns a new [ApiResponse] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static ApiResponse fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return ApiResponse( - code: mapValueOfType(json, r'code'), - type: mapValueOfType(json, r'type'), - message: mapValueOfType(json, r'message'), - ); - } - return null; - } + static ApiResponse fromJson(Map json) => ApiResponse( + code: json[r'code'] as int, + type: json[r'type'] as String, + message: json[r'message'] as String, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(ApiResponse.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => ApiResponse.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -85,7 +79,7 @@ class ApiResponse { } // maps a json object with a list of ApiResponse-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -93,7 +87,6 @@ class ApiResponse { .forEach((key, dynamic value) { map[key] = ApiResponse.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_array_of_number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_array_of_number_only.dart index 5525cd19379d..704f51efc485 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_array_of_number_only.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_array_of_number_only.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +16,8 @@ class ArrayOfArrayOfNumberOnly { this.arrayArrayNumber = const [], }); - List> arrayArrayNumber; + + List>? arrayArrayNumber; @override bool operator ==(Object other) => identical(this, other) || other is ArrayOfArrayOfNumberOnly && @@ -24,8 +25,7 @@ class ArrayOfArrayOfNumberOnly { @override int get hashCode => - // ignore: unnecessary_parenthesis - (arrayArrayNumber == null ? 0 : arrayArrayNumber.hashCode); + arrayArrayNumber.hashCode; @override String toString() => 'ArrayOfArrayOfNumberOnly[arrayArrayNumber=$arrayArrayNumber]'; @@ -41,24 +41,18 @@ class ArrayOfArrayOfNumberOnly { /// Returns a new [ArrayOfArrayOfNumberOnly] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static ArrayOfArrayOfNumberOnly fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return ArrayOfArrayOfNumberOnly( + static ArrayOfArrayOfNumberOnly fromJson(Map json) => ArrayOfArrayOfNumberOnly( arrayArrayNumber: json[r'ArrayArrayNumber'] is List ? (json[r'ArrayArrayNumber'] as List).map( - (e) => e == null ? null : (e as List).cast() + (e) => e == null ? [] : (e as List).cast() ).toList(growable: false) - : null, - ); - } - return null; - } + : [], + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(ArrayOfArrayOfNumberOnly.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => ArrayOfArrayOfNumberOnly.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -71,7 +65,7 @@ class ArrayOfArrayOfNumberOnly { } // maps a json object with a list of ArrayOfArrayOfNumberOnly-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -79,7 +73,6 @@ class ArrayOfArrayOfNumberOnly { .forEach((key, dynamic value) { map[key] = ArrayOfArrayOfNumberOnly.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_number_only.dart index 1e23c3ad2d30..ab336203e40e 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_number_only.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_number_only.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +16,8 @@ class ArrayOfNumberOnly { this.arrayNumber = const [], }); - List arrayNumber; + + List? arrayNumber; @override bool operator ==(Object other) => identical(this, other) || other is ArrayOfNumberOnly && @@ -24,8 +25,7 @@ class ArrayOfNumberOnly { @override int get hashCode => - // ignore: unnecessary_parenthesis - (arrayNumber == null ? 0 : arrayNumber.hashCode); + arrayNumber.hashCode; @override String toString() => 'ArrayOfNumberOnly[arrayNumber=$arrayNumber]'; @@ -41,22 +41,16 @@ class ArrayOfNumberOnly { /// Returns a new [ArrayOfNumberOnly] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static ArrayOfNumberOnly fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return ArrayOfNumberOnly( + static ArrayOfNumberOnly fromJson(Map json) => ArrayOfNumberOnly( arrayNumber: json[r'ArrayNumber'] is List ? (json[r'ArrayNumber'] as List).cast() - : null, - ); - } - return null; - } + : [], + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(ArrayOfNumberOnly.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => ArrayOfNumberOnly.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -69,7 +63,7 @@ class ArrayOfNumberOnly { } // maps a json object with a list of ArrayOfNumberOnly-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -77,7 +71,6 @@ class ArrayOfNumberOnly { .forEach((key, dynamic value) { map[key] = ArrayOfNumberOnly.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_test.dart index 6ae2096a5650..febb3cf7a382 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_test.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -18,11 +18,12 @@ class ArrayTest { this.arrayArrayOfModel = const [], }); - List arrayOfString; - List> arrayArrayOfInteger; + List? arrayOfString; - List> arrayArrayOfModel; + List>? arrayArrayOfInteger; + + List>? arrayArrayOfModel; @override bool operator ==(Object other) => identical(this, other) || other is ArrayTest && @@ -32,10 +33,9 @@ class ArrayTest { @override int get hashCode => - // ignore: unnecessary_parenthesis - (arrayOfString == null ? 0 : arrayOfString.hashCode) + - (arrayArrayOfInteger == null ? 0 : arrayArrayOfInteger.hashCode) + - (arrayArrayOfModel == null ? 0 : arrayArrayOfModel.hashCode); + arrayOfString.hashCode + + arrayArrayOfInteger.hashCode + + arrayArrayOfModel.hashCode; @override String toString() => 'ArrayTest[arrayOfString=$arrayOfString, arrayArrayOfInteger=$arrayArrayOfInteger, arrayArrayOfModel=$arrayArrayOfModel]'; @@ -57,32 +57,26 @@ class ArrayTest { /// Returns a new [ArrayTest] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static ArrayTest fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return ArrayTest( + static ArrayTest fromJson(Map json) => ArrayTest( arrayOfString: json[r'array_of_string'] is List ? (json[r'array_of_string'] as List).cast() - : null, + : [], arrayArrayOfInteger: json[r'array_array_of_integer'] is List ? (json[r'array_array_of_integer'] as List).map( - (e) => e == null ? null : (e as List).cast() + (e) => e == null ? [] : (e as List).cast() ).toList(growable: false) - : null, + : [], arrayArrayOfModel: json[r'array_array_of_model'] is List - ? (json[r'array_array_of_model'] as List).map( - ReadOnlyFirst.listFromJson(json[r'array_array_of_model']) + ? (json[r'array_array_of_model'] as List).map>( + (final j) => ReadOnlyFirst.listFromJson(j) ).toList(growable: false) - : null, - ); - } - return null; - } + : [], + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(ArrayTest.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => ArrayTest.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -95,7 +89,7 @@ class ArrayTest { } // maps a json object with a list of ArrayTest-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -103,7 +97,6 @@ class ArrayTest { .forEach((key, dynamic value) { map[key] = ArrayTest.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/capitalization.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/capitalization.dart index 678bc6f2ea84..aa03db6d6e5f 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/capitalization.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/capitalization.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -21,18 +21,19 @@ class Capitalization { this.ATT_NAME, }); - String smallCamel; - String capitalCamel; + String? smallCamel; - String smallSnake; + String? capitalCamel; - String capitalSnake; + String? smallSnake; - String sCAETHFlowPoints; + String? capitalSnake; + + String? sCAETHFlowPoints; /// Name of the pet - String ATT_NAME; + String? ATT_NAME; @override bool operator ==(Object other) => identical(this, other) || other is Capitalization && @@ -45,13 +46,12 @@ class Capitalization { @override int get hashCode => - // ignore: unnecessary_parenthesis - (smallCamel == null ? 0 : smallCamel.hashCode) + - (capitalCamel == null ? 0 : capitalCamel.hashCode) + - (smallSnake == null ? 0 : smallSnake.hashCode) + - (capitalSnake == null ? 0 : capitalSnake.hashCode) + - (sCAETHFlowPoints == null ? 0 : sCAETHFlowPoints.hashCode) + - (ATT_NAME == null ? 0 : ATT_NAME.hashCode); + smallCamel.hashCode + + capitalCamel.hashCode + + smallSnake.hashCode + + capitalSnake.hashCode + + sCAETHFlowPoints.hashCode + + ATT_NAME.hashCode; @override String toString() => 'Capitalization[smallCamel=$smallCamel, capitalCamel=$capitalCamel, smallSnake=$smallSnake, capitalSnake=$capitalSnake, sCAETHFlowPoints=$sCAETHFlowPoints, ATT_NAME=$ATT_NAME]'; @@ -82,25 +82,19 @@ class Capitalization { /// Returns a new [Capitalization] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static Capitalization fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return Capitalization( - smallCamel: mapValueOfType(json, r'smallCamel'), - capitalCamel: mapValueOfType(json, r'CapitalCamel'), - smallSnake: mapValueOfType(json, r'small_Snake'), - capitalSnake: mapValueOfType(json, r'Capital_Snake'), - sCAETHFlowPoints: mapValueOfType(json, r'SCA_ETH_Flow_Points'), - ATT_NAME: mapValueOfType(json, r'ATT_NAME'), - ); - } - return null; - } - - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(Capitalization.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static Capitalization fromJson(Map json) => Capitalization( + smallCamel: json[r'smallCamel'] as String, + capitalCamel: json[r'CapitalCamel'] as String, + smallSnake: json[r'small_Snake'] as String, + capitalSnake: json[r'Capital_Snake'] as String, + sCAETHFlowPoints: json[r'SCA_ETH_Flow_Points'] as String, + ATT_NAME: json[r'ATT_NAME'] as String, + ); + + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => Capitalization.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -113,7 +107,7 @@ class Capitalization { } // maps a json object with a list of Capitalization-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -121,7 +115,6 @@ class Capitalization { .forEach((key, dynamic value) { map[key] = Capitalization.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart index b34fdc7d9a29..c3d64f701272 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -13,16 +13,17 @@ part of openapi.api; class Cat { /// Returns a new [Cat] instance. Cat({ - @required this.className, + required this.className, this.color = 'red', this.declawed, }); + String className; - String color; + String? color; - bool declawed; + bool? declawed; @override bool operator ==(Object other) => identical(this, other) || other is Cat && @@ -32,10 +33,9 @@ class Cat { @override int get hashCode => - // ignore: unnecessary_parenthesis - (className == null ? 0 : className.hashCode) + - (color == null ? 0 : color.hashCode) + - (declawed == null ? 0 : declawed.hashCode); + className.hashCode + + color.hashCode + + declawed.hashCode; @override String toString() => 'Cat[className=$className, color=$color, declawed=$declawed]'; @@ -55,22 +55,16 @@ class Cat { /// Returns a new [Cat] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static Cat fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return Cat( - className: mapValueOfType(json, r'className'), - color: mapValueOfType(json, r'color'), - declawed: mapValueOfType(json, r'declawed'), - ); - } - return null; - } + static Cat fromJson(Map json) => Cat( + className: json[r'className'] as String, + color: json[r'color'] as String, + declawed: json[r'declawed'] as bool, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(Cat.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => Cat.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -83,7 +77,7 @@ class Cat { } // maps a json object with a list of Cat-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -91,7 +85,6 @@ class Cat { .forEach((key, dynamic value) { map[key] = Cat.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat_all_of.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat_all_of.dart index 97bbde44213c..f09e1206d76c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat_all_of.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat_all_of.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +16,8 @@ class CatAllOf { this.declawed, }); - bool declawed; + + bool? declawed; @override bool operator ==(Object other) => identical(this, other) || other is CatAllOf && @@ -24,8 +25,7 @@ class CatAllOf { @override int get hashCode => - // ignore: unnecessary_parenthesis - (declawed == null ? 0 : declawed.hashCode); + declawed.hashCode; @override String toString() => 'CatAllOf[declawed=$declawed]'; @@ -41,20 +41,14 @@ class CatAllOf { /// Returns a new [CatAllOf] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static CatAllOf fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return CatAllOf( - declawed: mapValueOfType(json, r'declawed'), - ); - } - return null; - } + static CatAllOf fromJson(Map json) => CatAllOf( + declawed: json[r'declawed'] as bool, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(CatAllOf.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => CatAllOf.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -67,7 +61,7 @@ class CatAllOf { } // maps a json object with a list of CatAllOf-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -75,7 +69,6 @@ class CatAllOf { .forEach((key, dynamic value) { map[key] = CatAllOf.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/category.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/category.dart index 294c4f57e9c8..29b8cb353dcb 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/category.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/category.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -17,7 +17,8 @@ class Category { this.name = 'default-name', }); - int id; + + int? id; String name; @@ -28,9 +29,8 @@ class Category { @override int get hashCode => - // ignore: unnecessary_parenthesis - (id == null ? 0 : id.hashCode) + - (name == null ? 0 : name.hashCode); + id.hashCode + + name.hashCode; @override String toString() => 'Category[id=$id, name=$name]'; @@ -47,21 +47,15 @@ class Category { /// Returns a new [Category] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static Category fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return Category( - id: mapValueOfType(json, r'id'), - name: mapValueOfType(json, r'name'), - ); - } - return null; - } + static Category fromJson(Map json) => Category( + id: json[r'id'] as int, + name: json[r'name'] as String, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(Category.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => Category.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -74,7 +68,7 @@ class Category { } // maps a json object with a list of Category-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -82,7 +76,6 @@ class Category { .forEach((key, dynamic value) { map[key] = Category.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/class_model.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/class_model.dart index 4736fb60ca8e..bb8722ab1812 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/class_model.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/class_model.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +16,8 @@ class ClassModel { this.class_, }); - String class_; + + String? class_; @override bool operator ==(Object other) => identical(this, other) || other is ClassModel && @@ -24,8 +25,7 @@ class ClassModel { @override int get hashCode => - // ignore: unnecessary_parenthesis - (class_ == null ? 0 : class_.hashCode); + class_.hashCode; @override String toString() => 'ClassModel[class_=$class_]'; @@ -41,20 +41,14 @@ class ClassModel { /// Returns a new [ClassModel] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static ClassModel fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return ClassModel( - class_: mapValueOfType(json, r'_class'), - ); - } - return null; - } + static ClassModel fromJson(Map json) => ClassModel( + class_: json[r'_class'] as String, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(ClassModel.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => ClassModel.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -67,7 +61,7 @@ class ClassModel { } // maps a json object with a list of ClassModel-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -75,7 +69,6 @@ class ClassModel { .forEach((key, dynamic value) { map[key] = ClassModel.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/deprecated_object.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/deprecated_object.dart index a84c7155c8ad..bb9088a1d85e 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/deprecated_object.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/deprecated_object.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +16,8 @@ class DeprecatedObject { this.name, }); - String name; + + String? name; @override bool operator ==(Object other) => identical(this, other) || other is DeprecatedObject && @@ -24,8 +25,7 @@ class DeprecatedObject { @override int get hashCode => - // ignore: unnecessary_parenthesis - (name == null ? 0 : name.hashCode); + name.hashCode; @override String toString() => 'DeprecatedObject[name=$name]'; @@ -41,20 +41,14 @@ class DeprecatedObject { /// Returns a new [DeprecatedObject] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static DeprecatedObject fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return DeprecatedObject( - name: mapValueOfType(json, r'name'), - ); - } - return null; - } + static DeprecatedObject fromJson(Map json) => DeprecatedObject( + name: json[r'name'] as String, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(DeprecatedObject.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => DeprecatedObject.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -67,7 +61,7 @@ class DeprecatedObject { } // maps a json object with a list of DeprecatedObject-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -75,7 +69,6 @@ class DeprecatedObject { .forEach((key, dynamic value) { map[key] = DeprecatedObject.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart index 68d592bef451..3e5e3502b93f 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -13,16 +13,17 @@ part of openapi.api; class Dog { /// Returns a new [Dog] instance. Dog({ - @required this.className, + required this.className, this.color = 'red', this.breed, }); + String className; - String color; + String? color; - String breed; + String? breed; @override bool operator ==(Object other) => identical(this, other) || other is Dog && @@ -32,10 +33,9 @@ class Dog { @override int get hashCode => - // ignore: unnecessary_parenthesis - (className == null ? 0 : className.hashCode) + - (color == null ? 0 : color.hashCode) + - (breed == null ? 0 : breed.hashCode); + className.hashCode + + color.hashCode + + breed.hashCode; @override String toString() => 'Dog[className=$className, color=$color, breed=$breed]'; @@ -55,22 +55,16 @@ class Dog { /// Returns a new [Dog] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static Dog fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return Dog( - className: mapValueOfType(json, r'className'), - color: mapValueOfType(json, r'color'), - breed: mapValueOfType(json, r'breed'), - ); - } - return null; - } + static Dog fromJson(Map json) => Dog( + className: json[r'className'] as String, + color: json[r'color'] as String, + breed: json[r'breed'] as String, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(Dog.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => Dog.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -83,7 +77,7 @@ class Dog { } // maps a json object with a list of Dog-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -91,7 +85,6 @@ class Dog { .forEach((key, dynamic value) { map[key] = Dog.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog_all_of.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog_all_of.dart index a4e2559cd668..d050b885f9d5 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog_all_of.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog_all_of.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +16,8 @@ class DogAllOf { this.breed, }); - String breed; + + String? breed; @override bool operator ==(Object other) => identical(this, other) || other is DogAllOf && @@ -24,8 +25,7 @@ class DogAllOf { @override int get hashCode => - // ignore: unnecessary_parenthesis - (breed == null ? 0 : breed.hashCode); + breed.hashCode; @override String toString() => 'DogAllOf[breed=$breed]'; @@ -41,20 +41,14 @@ class DogAllOf { /// Returns a new [DogAllOf] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static DogAllOf fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return DogAllOf( - breed: mapValueOfType(json, r'breed'), - ); - } - return null; - } + static DogAllOf fromJson(Map json) => DogAllOf( + breed: json[r'breed'] as String, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(DogAllOf.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => DogAllOf.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -67,7 +61,7 @@ class DogAllOf { } // maps a json object with a list of DogAllOf-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -75,7 +69,6 @@ class DogAllOf { .forEach((key, dynamic value) { map[key] = DogAllOf.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart index 96ff43d00383..c7138f35720a 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -17,9 +17,10 @@ class EnumArrays { this.arrayEnum = const [], }); - EnumArraysJustSymbolEnum justSymbol; - List arrayEnum; + EnumArraysJustSymbolEnum? justSymbol; + + List? arrayEnum; @override bool operator ==(Object other) => identical(this, other) || other is EnumArrays && @@ -28,9 +29,8 @@ class EnumArrays { @override int get hashCode => - // ignore: unnecessary_parenthesis - (justSymbol == null ? 0 : justSymbol.hashCode) + - (arrayEnum == null ? 0 : arrayEnum.hashCode); + justSymbol.hashCode + + arrayEnum.hashCode; @override String toString() => 'EnumArrays[justSymbol=$justSymbol, arrayEnum=$arrayEnum]'; @@ -49,21 +49,15 @@ class EnumArrays { /// Returns a new [EnumArrays] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static EnumArrays fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return EnumArrays( + static EnumArrays fromJson(Map json) => EnumArrays( justSymbol: EnumArraysJustSymbolEnum.fromJson(json[r'just_symbol']), arrayEnum: EnumArraysArrayEnumEnum.listFromJson(json[r'array_enum']), - ); - } - return null; - } + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(EnumArrays.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => EnumArrays.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -76,7 +70,7 @@ class EnumArrays { } // maps a json object with a list of EnumArrays-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -84,7 +78,6 @@ class EnumArrays { .forEach((key, dynamic value) { map[key] = EnumArrays.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); @@ -99,12 +92,12 @@ class EnumArraysJustSymbolEnum { const EnumArraysJustSymbolEnum._(this.value); /// The underlying value of this enum member. - final String value; + final String? value; @override String toString() => value ?? ''; - String toJson() => value; + String? toJson() => value; static const greaterThanEqual = EnumArraysJustSymbolEnum._(r'>='); static const dollar = EnumArraysJustSymbolEnum._(r'$'); @@ -118,10 +111,10 @@ class EnumArraysJustSymbolEnum { static EnumArraysJustSymbolEnum fromJson(dynamic value) => EnumArraysJustSymbolEnumTypeTransformer().decode(value); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(EnumArraysJustSymbolEnum.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => EnumArraysJustSymbolEnum.fromJson(i as Map)).toList(growable: true == growable) + : []; } /// Transformation class that can [encode] an instance of [EnumArraysJustSymbolEnum] to String, @@ -131,32 +124,23 @@ class EnumArraysJustSymbolEnumTypeTransformer { const EnumArraysJustSymbolEnumTypeTransformer._(); - String encode(EnumArraysJustSymbolEnum data) => data.value; + String? encode(EnumArraysJustSymbolEnum data) => data.value; /// Decodes a [dynamic value][data] to a EnumArraysJustSymbolEnum. /// - /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, - /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] - /// cannot be decoded successfully, then an [UnimplementedError] is thrown. - /// - /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, - /// and users are still using an old app with the old code. - EnumArraysJustSymbolEnum decode(dynamic data, {bool allowNull}) { - if (data != null) { - switch (data.toString()) { - case r'>=': return EnumArraysJustSymbolEnum.greaterThanEqual; - case r'$': return EnumArraysJustSymbolEnum.dollar; - default: - if (allowNull == false) { - throw ArgumentError('Unknown enum value to decode: $data'); - } - } + /// If the [dynamic value][data] cannot be decoded successfully, then an [UnimplementedError] is thrown. + EnumArraysJustSymbolEnum decode(dynamic data) { + if (data == r'>=') { + return EnumArraysJustSymbolEnum.greaterThanEqual; } - return null; + if (data == r'$') { + return EnumArraysJustSymbolEnum.dollar; + } + throw ArgumentError('Unknown enum value to decode: $data'); } /// Singleton [EnumArraysJustSymbolEnumTypeTransformer] instance. - static EnumArraysJustSymbolEnumTypeTransformer _instance; + static EnumArraysJustSymbolEnumTypeTransformer? _instance; } @@ -166,12 +150,12 @@ class EnumArraysArrayEnumEnum { const EnumArraysArrayEnumEnum._(this.value); /// The underlying value of this enum member. - final String value; + final String? value; @override String toString() => value ?? ''; - String toJson() => value; + String? toJson() => value; static const fish = EnumArraysArrayEnumEnum._(r'fish'); static const crab = EnumArraysArrayEnumEnum._(r'crab'); @@ -185,10 +169,10 @@ class EnumArraysArrayEnumEnum { static EnumArraysArrayEnumEnum fromJson(dynamic value) => EnumArraysArrayEnumEnumTypeTransformer().decode(value); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(EnumArraysArrayEnumEnum.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => EnumArraysArrayEnumEnum.fromJson(i as Map)).toList(growable: true == growable) + : []; } /// Transformation class that can [encode] an instance of [EnumArraysArrayEnumEnum] to String, @@ -198,32 +182,23 @@ class EnumArraysArrayEnumEnumTypeTransformer { const EnumArraysArrayEnumEnumTypeTransformer._(); - String encode(EnumArraysArrayEnumEnum data) => data.value; + String? encode(EnumArraysArrayEnumEnum data) => data.value; /// Decodes a [dynamic value][data] to a EnumArraysArrayEnumEnum. /// - /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, - /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] - /// cannot be decoded successfully, then an [UnimplementedError] is thrown. - /// - /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, - /// and users are still using an old app with the old code. - EnumArraysArrayEnumEnum decode(dynamic data, {bool allowNull}) { - if (data != null) { - switch (data.toString()) { - case r'fish': return EnumArraysArrayEnumEnum.fish; - case r'crab': return EnumArraysArrayEnumEnum.crab; - default: - if (allowNull == false) { - throw ArgumentError('Unknown enum value to decode: $data'); - } - } + /// If the [dynamic value][data] cannot be decoded successfully, then an [UnimplementedError] is thrown. + EnumArraysArrayEnumEnum decode(dynamic data) { + if (data == r'fish') { + return EnumArraysArrayEnumEnum.fish; + } + if (data == r'crab') { + return EnumArraysArrayEnumEnum.crab; } - return null; + throw ArgumentError('Unknown enum value to decode: $data'); } /// Singleton [EnumArraysArrayEnumEnumTypeTransformer] instance. - static EnumArraysArrayEnumEnumTypeTransformer _instance; + static EnumArraysArrayEnumEnumTypeTransformer? _instance; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_class.dart index e50e9471eacb..dd8ae5138bbb 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_class.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_class.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,12 +16,12 @@ class EnumClass { const EnumClass._(this.value); /// The underlying value of this enum member. - final String value; + final String? value; @override String toString() => value ?? ''; - String toJson() => value; + String? toJson() => value; static const abc = EnumClass._(r'_abc'); static const efg = EnumClass._(r'-efg'); @@ -37,10 +37,10 @@ class EnumClass { static EnumClass fromJson(dynamic value) => EnumClassTypeTransformer().decode(value); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(EnumClass.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => EnumClass.fromJson(i as Map)).toList(growable: true == growable) + : []; } /// Transformation class that can [encode] an instance of [EnumClass] to String, @@ -50,32 +50,26 @@ class EnumClassTypeTransformer { const EnumClassTypeTransformer._(); - String encode(EnumClass data) => data.value; + String? encode(EnumClass data) => data.value; /// Decodes a [dynamic value][data] to a EnumClass. /// - /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, - /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] - /// cannot be decoded successfully, then an [UnimplementedError] is thrown. - /// - /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, - /// and users are still using an old app with the old code. - EnumClass decode(dynamic data, {bool allowNull}) { - if (data != null) { - switch (data.toString()) { - case r'_abc': return EnumClass.abc; - case r'-efg': return EnumClass.efg; - case r'(xyz)': return EnumClass.leftParenthesisXyzRightParenthesis; - default: - if (allowNull == false) { - throw ArgumentError('Unknown enum value to decode: $data'); - } - } + /// If the [dynamic value][data] cannot be decoded successfully, then an [UnimplementedError] is thrown. + EnumClass decode(dynamic data) { + if (data == r'_abc') { + return EnumClass.abc; + } + if (data == r'-efg') { + return EnumClass.efg; } - return null; + if (data == r'(xyz)') { + return EnumClass.leftParenthesisXyzRightParenthesis; + } + throw ArgumentError('Unknown enum value to decode: $data'); + } /// Singleton [EnumClassTypeTransformer] instance. - static EnumClassTypeTransformer _instance; + static EnumClassTypeTransformer? _instance; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart index ee1a8aff9f3c..8ed7b95c2fec 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -14,7 +14,7 @@ class EnumTest { /// Returns a new [EnumTest] instance. EnumTest({ this.enumString, - @required this.enumStringRequired, + required this.enumStringRequired, this.enumInteger, this.enumNumber, this.outerEnum, @@ -23,21 +23,22 @@ class EnumTest { this.outerEnumIntegerDefaultValue, }); - EnumTestEnumStringEnum enumString; + + EnumTestEnumStringEnum? enumString; EnumTestEnumStringRequiredEnum enumStringRequired; - EnumTestEnumIntegerEnum enumInteger; + EnumTestEnumIntegerEnum? enumInteger; - EnumTestEnumNumberEnum enumNumber; + EnumTestEnumNumberEnum? enumNumber; - OuterEnum outerEnum; + OuterEnum? outerEnum; - OuterEnumInteger outerEnumInteger; + OuterEnumInteger? outerEnumInteger; - OuterEnumDefaultValue outerEnumDefaultValue; + OuterEnumDefaultValue? outerEnumDefaultValue; - OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue; + OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue; @override bool operator ==(Object other) => identical(this, other) || other is EnumTest && @@ -52,15 +53,14 @@ class EnumTest { @override int get hashCode => - // ignore: unnecessary_parenthesis - (enumString == null ? 0 : enumString.hashCode) + - (enumStringRequired == null ? 0 : enumStringRequired.hashCode) + - (enumInteger == null ? 0 : enumInteger.hashCode) + - (enumNumber == null ? 0 : enumNumber.hashCode) + - (outerEnum == null ? 0 : outerEnum.hashCode) + - (outerEnumInteger == null ? 0 : outerEnumInteger.hashCode) + - (outerEnumDefaultValue == null ? 0 : outerEnumDefaultValue.hashCode) + - (outerEnumIntegerDefaultValue == null ? 0 : outerEnumIntegerDefaultValue.hashCode); + enumString.hashCode + + enumStringRequired.hashCode + + enumInteger.hashCode + + enumNumber.hashCode + + outerEnum.hashCode + + outerEnumInteger.hashCode + + outerEnumDefaultValue.hashCode + + outerEnumIntegerDefaultValue.hashCode; @override String toString() => 'EnumTest[enumString=$enumString, enumStringRequired=$enumStringRequired, enumInteger=$enumInteger, enumNumber=$enumNumber, outerEnum=$outerEnum, outerEnumInteger=$outerEnumInteger, outerEnumDefaultValue=$outerEnumDefaultValue, outerEnumIntegerDefaultValue=$outerEnumIntegerDefaultValue]'; @@ -95,10 +95,7 @@ class EnumTest { /// Returns a new [EnumTest] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static EnumTest fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return EnumTest( + static EnumTest fromJson(Map json) => EnumTest( enumString: EnumTestEnumStringEnum.fromJson(json[r'enum_string']), enumStringRequired: EnumTestEnumStringRequiredEnum.fromJson(json[r'enum_string_required']), enumInteger: EnumTestEnumIntegerEnum.fromJson(json[r'enum_integer']), @@ -107,15 +104,12 @@ class EnumTest { outerEnumInteger: OuterEnumInteger.fromJson(json[r'outerEnumInteger']), outerEnumDefaultValue: OuterEnumDefaultValue.fromJson(json[r'outerEnumDefaultValue']), outerEnumIntegerDefaultValue: OuterEnumIntegerDefaultValue.fromJson(json[r'outerEnumIntegerDefaultValue']), - ); - } - return null; - } + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(EnumTest.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => EnumTest.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -128,7 +122,7 @@ class EnumTest { } // maps a json object with a list of EnumTest-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -136,7 +130,6 @@ class EnumTest { .forEach((key, dynamic value) { map[key] = EnumTest.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); @@ -151,12 +144,12 @@ class EnumTestEnumStringEnum { const EnumTestEnumStringEnum._(this.value); /// The underlying value of this enum member. - final String value; + final String? value; @override String toString() => value ?? ''; - String toJson() => value; + String? toJson() => value; static const UPPER = EnumTestEnumStringEnum._(r'UPPER'); static const lower = EnumTestEnumStringEnum._(r'lower'); @@ -172,10 +165,10 @@ class EnumTestEnumStringEnum { static EnumTestEnumStringEnum fromJson(dynamic value) => EnumTestEnumStringEnumTypeTransformer().decode(value); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(EnumTestEnumStringEnum.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => EnumTestEnumStringEnum.fromJson(i as Map)).toList(growable: true == growable) + : []; } /// Transformation class that can [encode] an instance of [EnumTestEnumStringEnum] to String, @@ -185,33 +178,26 @@ class EnumTestEnumStringEnumTypeTransformer { const EnumTestEnumStringEnumTypeTransformer._(); - String encode(EnumTestEnumStringEnum data) => data.value; + String? encode(EnumTestEnumStringEnum data) => data.value; /// Decodes a [dynamic value][data] to a EnumTestEnumStringEnum. /// - /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, - /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] - /// cannot be decoded successfully, then an [UnimplementedError] is thrown. - /// - /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, - /// and users are still using an old app with the old code. - EnumTestEnumStringEnum decode(dynamic data, {bool allowNull}) { - if (data != null) { - switch (data.toString()) { - case r'UPPER': return EnumTestEnumStringEnum.UPPER; - case r'lower': return EnumTestEnumStringEnum.lower; - case r'': return EnumTestEnumStringEnum.empty; - default: - if (allowNull == false) { - throw ArgumentError('Unknown enum value to decode: $data'); - } - } + /// If the [dynamic value][data] cannot be decoded successfully, then an [UnimplementedError] is thrown. + EnumTestEnumStringEnum decode(dynamic data) { + if (data == r'UPPER') { + return EnumTestEnumStringEnum.UPPER; } - return null; + if (data == r'lower') { + return EnumTestEnumStringEnum.lower; + } + if (data == r'') { + return EnumTestEnumStringEnum.empty; + } + throw ArgumentError('Unknown enum value to decode: $data'); } /// Singleton [EnumTestEnumStringEnumTypeTransformer] instance. - static EnumTestEnumStringEnumTypeTransformer _instance; + static EnumTestEnumStringEnumTypeTransformer? _instance; } @@ -221,12 +207,12 @@ class EnumTestEnumStringRequiredEnum { const EnumTestEnumStringRequiredEnum._(this.value); /// The underlying value of this enum member. - final String value; + final String? value; @override String toString() => value ?? ''; - String toJson() => value; + String? toJson() => value; static const UPPER = EnumTestEnumStringRequiredEnum._(r'UPPER'); static const lower = EnumTestEnumStringRequiredEnum._(r'lower'); @@ -242,10 +228,10 @@ class EnumTestEnumStringRequiredEnum { static EnumTestEnumStringRequiredEnum fromJson(dynamic value) => EnumTestEnumStringRequiredEnumTypeTransformer().decode(value); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(EnumTestEnumStringRequiredEnum.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => EnumTestEnumStringRequiredEnum.fromJson(i as Map)).toList(growable: true == growable) + : []; } /// Transformation class that can [encode] an instance of [EnumTestEnumStringRequiredEnum] to String, @@ -255,33 +241,26 @@ class EnumTestEnumStringRequiredEnumTypeTransformer { const EnumTestEnumStringRequiredEnumTypeTransformer._(); - String encode(EnumTestEnumStringRequiredEnum data) => data.value; + String? encode(EnumTestEnumStringRequiredEnum data) => data.value; /// Decodes a [dynamic value][data] to a EnumTestEnumStringRequiredEnum. /// - /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, - /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] - /// cannot be decoded successfully, then an [UnimplementedError] is thrown. - /// - /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, - /// and users are still using an old app with the old code. - EnumTestEnumStringRequiredEnum decode(dynamic data, {bool allowNull}) { - if (data != null) { - switch (data.toString()) { - case r'UPPER': return EnumTestEnumStringRequiredEnum.UPPER; - case r'lower': return EnumTestEnumStringRequiredEnum.lower; - case r'': return EnumTestEnumStringRequiredEnum.empty; - default: - if (allowNull == false) { - throw ArgumentError('Unknown enum value to decode: $data'); - } - } + /// If the [dynamic value][data] cannot be decoded successfully, then an [UnimplementedError] is thrown. + EnumTestEnumStringRequiredEnum decode(dynamic data) { + if (data == r'UPPER') { + return EnumTestEnumStringRequiredEnum.UPPER; } - return null; + if (data == r'lower') { + return EnumTestEnumStringRequiredEnum.lower; + } + if (data == r'') { + return EnumTestEnumStringRequiredEnum.empty; + } + throw ArgumentError('Unknown enum value to decode: $data'); } /// Singleton [EnumTestEnumStringRequiredEnumTypeTransformer] instance. - static EnumTestEnumStringRequiredEnumTypeTransformer _instance; + static EnumTestEnumStringRequiredEnumTypeTransformer? _instance; } @@ -291,12 +270,12 @@ class EnumTestEnumIntegerEnum { const EnumTestEnumIntegerEnum._(this.value); /// The underlying value of this enum member. - final int value; + final int? value; @override String toString() => value == null ? '' : value.toString(); - int toJson() => value; + int? toJson() => value; static const number1 = EnumTestEnumIntegerEnum._(1); static const numberNegative1 = EnumTestEnumIntegerEnum._(-1); @@ -310,10 +289,10 @@ class EnumTestEnumIntegerEnum { static EnumTestEnumIntegerEnum fromJson(dynamic value) => EnumTestEnumIntegerEnumTypeTransformer().decode(value); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(EnumTestEnumIntegerEnum.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => EnumTestEnumIntegerEnum.fromJson(i as Map)).toList(growable: true == growable) + : []; } /// Transformation class that can [encode] an instance of [EnumTestEnumIntegerEnum] to int, @@ -323,32 +302,23 @@ class EnumTestEnumIntegerEnumTypeTransformer { const EnumTestEnumIntegerEnumTypeTransformer._(); - int encode(EnumTestEnumIntegerEnum data) => data.value; + int? encode(EnumTestEnumIntegerEnum data) => data.value; /// Decodes a [dynamic value][data] to a EnumTestEnumIntegerEnum. /// - /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, - /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] - /// cannot be decoded successfully, then an [UnimplementedError] is thrown. - /// - /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, - /// and users are still using an old app with the old code. - EnumTestEnumIntegerEnum decode(dynamic data, {bool allowNull}) { - if (data != null) { - switch (data.toString()) { - case 1: return EnumTestEnumIntegerEnum.number1; - case -1: return EnumTestEnumIntegerEnum.numberNegative1; - default: - if (allowNull == false) { - throw ArgumentError('Unknown enum value to decode: $data'); - } - } + /// If the [dynamic value][data] cannot be decoded successfully, then an [UnimplementedError] is thrown. + EnumTestEnumIntegerEnum decode(dynamic data) { + if (data == 1) { + return EnumTestEnumIntegerEnum.number1; } - return null; + if (data == -1) { + return EnumTestEnumIntegerEnum.numberNegative1; + } + throw ArgumentError('Unknown enum value to decode: $data'); } /// Singleton [EnumTestEnumIntegerEnumTypeTransformer] instance. - static EnumTestEnumIntegerEnumTypeTransformer _instance; + static EnumTestEnumIntegerEnumTypeTransformer? _instance; } @@ -358,15 +328,15 @@ class EnumTestEnumNumberEnum { const EnumTestEnumNumberEnum._(this.value); /// The underlying value of this enum member. - final double value; + final double? value; @override String toString() => value == null ? '' : value.toString(); - double toJson() => value; + double? toJson() => value; - static const number1Period1 = EnumTestEnumNumberEnum._('1.1'); - static const numberNegative1Period2 = EnumTestEnumNumberEnum._('-1.2'); + static const number1Period1 = EnumTestEnumNumberEnum._(1.1); + static const numberNegative1Period2 = EnumTestEnumNumberEnum._(-1.2); /// List of all possible values in this [enum][EnumTestEnumNumberEnum]. static const values = [ @@ -377,10 +347,10 @@ class EnumTestEnumNumberEnum { static EnumTestEnumNumberEnum fromJson(dynamic value) => EnumTestEnumNumberEnumTypeTransformer().decode(value); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(EnumTestEnumNumberEnum.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => EnumTestEnumNumberEnum.fromJson(i as Map)).toList(growable: true == growable) + : []; } /// Transformation class that can [encode] an instance of [EnumTestEnumNumberEnum] to double, @@ -390,32 +360,23 @@ class EnumTestEnumNumberEnumTypeTransformer { const EnumTestEnumNumberEnumTypeTransformer._(); - double encode(EnumTestEnumNumberEnum data) => data.value; + double? encode(EnumTestEnumNumberEnum data) => data.value; /// Decodes a [dynamic value][data] to a EnumTestEnumNumberEnum. /// - /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, - /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] - /// cannot be decoded successfully, then an [UnimplementedError] is thrown. - /// - /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, - /// and users are still using an old app with the old code. - EnumTestEnumNumberEnum decode(dynamic data, {bool allowNull}) { - if (data != null) { - switch (data.toString()) { - case '1.1': return EnumTestEnumNumberEnum.number1Period1; - case '-1.2': return EnumTestEnumNumberEnum.numberNegative1Period2; - default: - if (allowNull == false) { - throw ArgumentError('Unknown enum value to decode: $data'); - } - } + /// If the [dynamic value][data] cannot be decoded successfully, then an [UnimplementedError] is thrown. + EnumTestEnumNumberEnum decode(dynamic data) { + if (data == 1.1) { + return EnumTestEnumNumberEnum.number1Period1; + } + if (data == -1.2) { + return EnumTestEnumNumberEnum.numberNegative1Period2; } - return null; + throw ArgumentError('Unknown enum value to decode: $data'); } /// Singleton [EnumTestEnumNumberEnumTypeTransformer] instance. - static EnumTestEnumNumberEnumTypeTransformer _instance; + static EnumTestEnumNumberEnumTypeTransformer? _instance; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/file_schema_test_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/file_schema_test_class.dart index 82decacafc7f..2472f89c3593 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/file_schema_test_class.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/file_schema_test_class.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -17,9 +17,10 @@ class FileSchemaTestClass { this.files = const [], }); - ModelFile file; - List files; + ModelFile? file; + + List? files; @override bool operator ==(Object other) => identical(this, other) || other is FileSchemaTestClass && @@ -28,9 +29,8 @@ class FileSchemaTestClass { @override int get hashCode => - // ignore: unnecessary_parenthesis - (file == null ? 0 : file.hashCode) + - (files == null ? 0 : files.hashCode); + file.hashCode + + files.hashCode; @override String toString() => 'FileSchemaTestClass[file=$file, files=$files]'; @@ -49,21 +49,15 @@ class FileSchemaTestClass { /// Returns a new [FileSchemaTestClass] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static FileSchemaTestClass fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return FileSchemaTestClass( + static FileSchemaTestClass fromJson(Map json) => FileSchemaTestClass( file: ModelFile.fromJson(json[r'file']), files: ModelFile.listFromJson(json[r'files']), - ); - } - return null; - } + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(FileSchemaTestClass.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => FileSchemaTestClass.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -76,7 +70,7 @@ class FileSchemaTestClass { } // maps a json object with a list of FileSchemaTestClass-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -84,7 +78,6 @@ class FileSchemaTestClass { .forEach((key, dynamic value) { map[key] = FileSchemaTestClass.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo.dart index fe73d2705506..cde11a705614 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +16,8 @@ class Foo { this.bar = 'bar', }); - String bar; + + String? bar; @override bool operator ==(Object other) => identical(this, other) || other is Foo && @@ -24,8 +25,7 @@ class Foo { @override int get hashCode => - // ignore: unnecessary_parenthesis - (bar == null ? 0 : bar.hashCode); + bar.hashCode; @override String toString() => 'Foo[bar=$bar]'; @@ -41,20 +41,14 @@ class Foo { /// Returns a new [Foo] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static Foo fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return Foo( - bar: mapValueOfType(json, r'bar'), - ); - } - return null; - } + static Foo fromJson(Map json) => Foo( + bar: json[r'bar'] as String, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(Foo.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => Foo.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -67,7 +61,7 @@ class Foo { } // maps a json object with a list of Foo-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -75,7 +69,6 @@ class Foo { .forEach((key, dynamic value) { map[key] = Foo.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/format_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/format_test.dart index 978a67132264..b35530e111cc 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/format_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/format_test.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,30 +16,31 @@ class FormatTest { this.integer, this.int32, this.int64, - @required this.number, + required this.number, this.float, this.double_, this.decimal, this.string, - @required this.byte, + required this.byte, this.binary, - @required this.date, + required this.date, this.dateTime, this.uuid, - @required this.password, + required this.password, this.patternWithDigits, this.patternWithDigitsAndDelimiter, }); + // minimum: 10 // maximum: 100 - int integer; + int? integer; // minimum: 20 // maximum: 200 - int int32; + int? int32; - int int64; + int? int64; // minimum: 32.1 // maximum: 543.2 @@ -47,33 +48,33 @@ class FormatTest { // minimum: 54.3 // maximum: 987.6 - double float; + double? float; // minimum: 67.8 // maximum: 123.4 - double double_; + double? double_; - double decimal; + double? decimal; - String string; + String? string; String byte; - MultipartFile binary; + MultipartFile? binary; DateTime date; - DateTime dateTime; + DateTime? dateTime; - String uuid; + String? uuid; String password; /// A string that is a 10 digit number. Can have leading zeros. - String patternWithDigits; + String? patternWithDigits; /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. - String patternWithDigitsAndDelimiter; + String? patternWithDigitsAndDelimiter; @override bool operator ==(Object other) => identical(this, other) || other is FormatTest && @@ -96,23 +97,22 @@ class FormatTest { @override int get hashCode => - // ignore: unnecessary_parenthesis - (integer == null ? 0 : integer.hashCode) + - (int32 == null ? 0 : int32.hashCode) + - (int64 == null ? 0 : int64.hashCode) + - (number == null ? 0 : number.hashCode) + - (float == null ? 0 : float.hashCode) + - (double_ == null ? 0 : double_.hashCode) + - (decimal == null ? 0 : decimal.hashCode) + - (string == null ? 0 : string.hashCode) + - (byte == null ? 0 : byte.hashCode) + - (binary == null ? 0 : binary.hashCode) + - (date == null ? 0 : date.hashCode) + - (dateTime == null ? 0 : dateTime.hashCode) + - (uuid == null ? 0 : uuid.hashCode) + - (password == null ? 0 : password.hashCode) + - (patternWithDigits == null ? 0 : patternWithDigits.hashCode) + - (patternWithDigitsAndDelimiter == null ? 0 : patternWithDigitsAndDelimiter.hashCode); + integer.hashCode + + int32.hashCode + + int64.hashCode + + number.hashCode + + float.hashCode + + double_.hashCode + + decimal.hashCode + + string.hashCode + + byte.hashCode + + binary.hashCode + + date.hashCode + + dateTime.hashCode + + uuid.hashCode + + password.hashCode + + patternWithDigits.hashCode + + patternWithDigitsAndDelimiter.hashCode; @override String toString() => 'FormatTest[integer=$integer, int32=$int32, int64=$int64, number=$number, float=$float, double_=$double_, decimal=$decimal, string=$string, byte=$byte, binary=$binary, date=$date, dateTime=$dateTime, uuid=$uuid, password=$password, patternWithDigits=$patternWithDigits, patternWithDigitsAndDelimiter=$patternWithDigitsAndDelimiter]'; @@ -147,7 +147,7 @@ class FormatTest { } json[r'date'] = _dateFormatter.format(date.toUtc()); if (dateTime != null) { - json[r'dateTime'] = dateTime.toUtc().toIso8601String(); + json[r'dateTime'] = dateTime!.toUtc().toIso8601String(); } if (uuid != null) { json[r'uuid'] = uuid; @@ -165,37 +165,29 @@ class FormatTest { /// Returns a new [FormatTest] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static FormatTest fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return FormatTest( - integer: mapValueOfType(json, r'integer'), - int32: mapValueOfType(json, r'int32'), - int64: mapValueOfType(json, r'int64'), - number: json[r'number'] == null - ? null - : num.parse(json[r'number'].toString()), - float: mapValueOfType(json, r'float'), - double_: mapValueOfType(json, r'double'), - decimal: mapValueOfType(json, r'decimal'), - string: mapValueOfType(json, r'string'), - byte: mapValueOfType(json, r'byte'), + static FormatTest fromJson(Map json) => FormatTest( + integer: json[r'integer'] as int, + int32: json[r'int32'] as int, + int64: json[r'int64'] as int, + number: json[r'number'] as num, + float: json[r'float'] as double, + double_: json[r'double'] as double, + decimal: json[r'decimal'] as double, + string: json[r'string'] as String, + byte: json[r'byte'] as String, binary: null, // No support for decoding binary content from JSON date: mapDateTime(json, r'date', ''), dateTime: mapDateTime(json, r'dateTime', ''), - uuid: mapValueOfType(json, r'uuid'), - password: mapValueOfType(json, r'password'), - patternWithDigits: mapValueOfType(json, r'pattern_with_digits'), - patternWithDigitsAndDelimiter: mapValueOfType(json, r'pattern_with_digits_and_delimiter'), - ); - } - return null; - } + uuid: json[r'uuid'] as String, + password: json[r'password'] as String, + patternWithDigits: json[r'pattern_with_digits'] as String, + patternWithDigitsAndDelimiter: json[r'pattern_with_digits_and_delimiter'] as String, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(FormatTest.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => FormatTest.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -208,7 +200,7 @@ class FormatTest { } // maps a json object with a list of FormatTest-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -216,7 +208,6 @@ class FormatTest { .forEach((key, dynamic value) { map[key] = FormatTest.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/has_only_read_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/has_only_read_only.dart index c827adf295ec..7a374dadcaad 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/has_only_read_only.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/has_only_read_only.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -17,9 +17,10 @@ class HasOnlyReadOnly { this.foo, }); - String bar; - String foo; + String? bar; + + String? foo; @override bool operator ==(Object other) => identical(this, other) || other is HasOnlyReadOnly && @@ -28,9 +29,8 @@ class HasOnlyReadOnly { @override int get hashCode => - // ignore: unnecessary_parenthesis - (bar == null ? 0 : bar.hashCode) + - (foo == null ? 0 : foo.hashCode); + bar.hashCode + + foo.hashCode; @override String toString() => 'HasOnlyReadOnly[bar=$bar, foo=$foo]'; @@ -49,21 +49,15 @@ class HasOnlyReadOnly { /// Returns a new [HasOnlyReadOnly] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static HasOnlyReadOnly fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return HasOnlyReadOnly( - bar: mapValueOfType(json, r'bar'), - foo: mapValueOfType(json, r'foo'), - ); - } - return null; - } + static HasOnlyReadOnly fromJson(Map json) => HasOnlyReadOnly( + bar: json[r'bar'] as String, + foo: json[r'foo'] as String, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(HasOnlyReadOnly.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => HasOnlyReadOnly.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -76,7 +70,7 @@ class HasOnlyReadOnly { } // maps a json object with a list of HasOnlyReadOnly-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -84,7 +78,6 @@ class HasOnlyReadOnly { .forEach((key, dynamic value) { map[key] = HasOnlyReadOnly.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/health_check_result.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/health_check_result.dart index 52359ee4003e..3066119e00d0 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/health_check_result.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/health_check_result.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +16,8 @@ class HealthCheckResult { this.nullableMessage, }); - String nullableMessage; + + String? nullableMessage; @override bool operator ==(Object other) => identical(this, other) || other is HealthCheckResult && @@ -24,8 +25,7 @@ class HealthCheckResult { @override int get hashCode => - // ignore: unnecessary_parenthesis - (nullableMessage == null ? 0 : nullableMessage.hashCode); + nullableMessage.hashCode; @override String toString() => 'HealthCheckResult[nullableMessage=$nullableMessage]'; @@ -41,20 +41,14 @@ class HealthCheckResult { /// Returns a new [HealthCheckResult] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static HealthCheckResult fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return HealthCheckResult( - nullableMessage: mapValueOfType(json, r'NullableMessage'), - ); - } - return null; - } + static HealthCheckResult fromJson(Map json) => HealthCheckResult( + nullableMessage: json[r'NullableMessage'] as String, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(HealthCheckResult.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => HealthCheckResult.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -67,7 +61,7 @@ class HealthCheckResult { } // maps a json object with a list of HealthCheckResult-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -75,7 +69,6 @@ class HealthCheckResult { .forEach((key, dynamic value) { map[key] = HealthCheckResult.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_response_default.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_response_default.dart index 12ac601d7e3a..042020b1e74d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_response_default.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_response_default.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +16,8 @@ class InlineResponseDefault { this.string, }); - Foo string; + + Foo? string; @override bool operator ==(Object other) => identical(this, other) || other is InlineResponseDefault && @@ -24,8 +25,7 @@ class InlineResponseDefault { @override int get hashCode => - // ignore: unnecessary_parenthesis - (string == null ? 0 : string.hashCode); + string.hashCode; @override String toString() => 'InlineResponseDefault[string=$string]'; @@ -41,20 +41,14 @@ class InlineResponseDefault { /// Returns a new [InlineResponseDefault] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static InlineResponseDefault fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return InlineResponseDefault( + static InlineResponseDefault fromJson(Map json) => InlineResponseDefault( string: Foo.fromJson(json[r'string']), - ); - } - return null; - } + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(InlineResponseDefault.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => InlineResponseDefault.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -67,7 +61,7 @@ class InlineResponseDefault { } // maps a json object with a list of InlineResponseDefault-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -75,7 +69,6 @@ class InlineResponseDefault { .forEach((key, dynamic value) { map[key] = InlineResponseDefault.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart index cbb3f1982522..e9b9b1ec02e1 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -19,13 +19,14 @@ class MapTest { this.indirectMap = const {}, }); - Map> mapMapOfString; - Map mapOfEnumString; + Map>? mapMapOfString; - Map directMap; + Map? mapOfEnumString; - Map indirectMap; + Map? directMap; + + Map? indirectMap; @override bool operator ==(Object other) => identical(this, other) || other is MapTest && @@ -36,11 +37,10 @@ class MapTest { @override int get hashCode => - // ignore: unnecessary_parenthesis - (mapMapOfString == null ? 0 : mapMapOfString.hashCode) + - (mapOfEnumString == null ? 0 : mapOfEnumString.hashCode) + - (directMap == null ? 0 : directMap.hashCode) + - (indirectMap == null ? 0 : indirectMap.hashCode); + mapMapOfString.hashCode + + mapOfEnumString.hashCode + + directMap.hashCode + + indirectMap.hashCode; @override String toString() => 'MapTest[mapMapOfString=$mapMapOfString, mapOfEnumString=$mapOfEnumString, directMap=$directMap, indirectMap=$indirectMap]'; @@ -65,23 +65,17 @@ class MapTest { /// Returns a new [MapTest] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static MapTest fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return MapTest( - mapMapOfString: mapCastOfType(json, r'map_map_of_string'), - mapOfEnumString: mapCastOfType(json, r'map_of_enum_string'), - directMap: mapCastOfType(json, r'direct_map'), - indirectMap: mapCastOfType(json, r'indirect_map'), - ); - } - return null; - } - - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(MapTest.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static MapTest fromJson(Map json) => MapTest( + mapMapOfString: json[r'map_map_of_string'] as Map>, + mapOfEnumString: json[r'map_of_enum_string'] as Map, + directMap: json[r'direct_map'] as Map, + indirectMap: json[r'indirect_map'] as Map, + ); + + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => MapTest.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -94,7 +88,7 @@ class MapTest { } // maps a json object with a list of MapTest-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -102,7 +96,6 @@ class MapTest { .forEach((key, dynamic value) { map[key] = MapTest.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); @@ -117,12 +110,12 @@ class MapTestMapOfEnumStringEnum { const MapTestMapOfEnumStringEnum._(this.value); /// The underlying value of this enum member. - final String value; + final String? value; @override String toString() => value ?? ''; - String toJson() => value; + String? toJson() => value; static const UPPER = MapTestMapOfEnumStringEnum._(r'UPPER'); static const lower = MapTestMapOfEnumStringEnum._(r'lower'); @@ -136,10 +129,10 @@ class MapTestMapOfEnumStringEnum { static MapTestMapOfEnumStringEnum fromJson(dynamic value) => MapTestMapOfEnumStringEnumTypeTransformer().decode(value); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(MapTestMapOfEnumStringEnum.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => MapTestMapOfEnumStringEnum.fromJson(i as Map)).toList(growable: true == growable) + : []; } /// Transformation class that can [encode] an instance of [MapTestMapOfEnumStringEnum] to String, @@ -149,32 +142,23 @@ class MapTestMapOfEnumStringEnumTypeTransformer { const MapTestMapOfEnumStringEnumTypeTransformer._(); - String encode(MapTestMapOfEnumStringEnum data) => data.value; + String? encode(MapTestMapOfEnumStringEnum data) => data.value; /// Decodes a [dynamic value][data] to a MapTestMapOfEnumStringEnum. /// - /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, - /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] - /// cannot be decoded successfully, then an [UnimplementedError] is thrown. - /// - /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, - /// and users are still using an old app with the old code. - MapTestMapOfEnumStringEnum decode(dynamic data, {bool allowNull}) { - if (data != null) { - switch (data.toString()) { - case r'UPPER': return MapTestMapOfEnumStringEnum.UPPER; - case r'lower': return MapTestMapOfEnumStringEnum.lower; - default: - if (allowNull == false) { - throw ArgumentError('Unknown enum value to decode: $data'); - } - } + /// If the [dynamic value][data] cannot be decoded successfully, then an [UnimplementedError] is thrown. + MapTestMapOfEnumStringEnum decode(dynamic data) { + if (data == r'UPPER') { + return MapTestMapOfEnumStringEnum.UPPER; + } + if (data == r'lower') { + return MapTestMapOfEnumStringEnum.lower; } - return null; + throw ArgumentError('Unknown enum value to decode: $data'); } /// Singleton [MapTestMapOfEnumStringEnumTypeTransformer] instance. - static MapTestMapOfEnumStringEnumTypeTransformer _instance; + static MapTestMapOfEnumStringEnumTypeTransformer? _instance; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart index 994be26f9e39..5a3849f632a8 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -18,11 +18,12 @@ class MixedPropertiesAndAdditionalPropertiesClass { this.map = const {}, }); - String uuid; - DateTime dateTime; + String? uuid; - Map map; + DateTime? dateTime; + + Map? map; @override bool operator ==(Object other) => identical(this, other) || other is MixedPropertiesAndAdditionalPropertiesClass && @@ -32,10 +33,9 @@ class MixedPropertiesAndAdditionalPropertiesClass { @override int get hashCode => - // ignore: unnecessary_parenthesis - (uuid == null ? 0 : uuid.hashCode) + - (dateTime == null ? 0 : dateTime.hashCode) + - (map == null ? 0 : map.hashCode); + uuid.hashCode + + dateTime.hashCode + + map.hashCode; @override String toString() => 'MixedPropertiesAndAdditionalPropertiesClass[uuid=$uuid, dateTime=$dateTime, map=$map]'; @@ -46,7 +46,7 @@ class MixedPropertiesAndAdditionalPropertiesClass { json[r'uuid'] = uuid; } if (dateTime != null) { - json[r'dateTime'] = dateTime.toUtc().toIso8601String(); + json[r'dateTime'] = dateTime!.toUtc().toIso8601String(); } if (map != null) { json[r'map'] = map; @@ -57,22 +57,16 @@ class MixedPropertiesAndAdditionalPropertiesClass { /// Returns a new [MixedPropertiesAndAdditionalPropertiesClass] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static MixedPropertiesAndAdditionalPropertiesClass fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return MixedPropertiesAndAdditionalPropertiesClass( - uuid: mapValueOfType(json, r'uuid'), + static MixedPropertiesAndAdditionalPropertiesClass fromJson(Map json) => MixedPropertiesAndAdditionalPropertiesClass( + uuid: json[r'uuid'] as String, dateTime: mapDateTime(json, r'dateTime', ''), - map: mapValueOfType>(json, r'map'), - ); - } - return null; - } + map: json[r'map'] as Map, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(MixedPropertiesAndAdditionalPropertiesClass.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => MixedPropertiesAndAdditionalPropertiesClass.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -85,7 +79,7 @@ class MixedPropertiesAndAdditionalPropertiesClass { } // maps a json object with a list of MixedPropertiesAndAdditionalPropertiesClass-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -93,7 +87,6 @@ class MixedPropertiesAndAdditionalPropertiesClass { .forEach((key, dynamic value) { map[key] = MixedPropertiesAndAdditionalPropertiesClass.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model200_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model200_response.dart index 01fbb8e4e9ae..2412a820c176 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model200_response.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model200_response.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -17,9 +17,10 @@ class Model200Response { this.class_, }); - int name; - String class_; + int? name; + + String? class_; @override bool operator ==(Object other) => identical(this, other) || other is Model200Response && @@ -28,9 +29,8 @@ class Model200Response { @override int get hashCode => - // ignore: unnecessary_parenthesis - (name == null ? 0 : name.hashCode) + - (class_ == null ? 0 : class_.hashCode); + name.hashCode + + class_.hashCode; @override String toString() => 'Model200Response[name=$name, class_=$class_]'; @@ -49,21 +49,15 @@ class Model200Response { /// Returns a new [Model200Response] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static Model200Response fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return Model200Response( - name: mapValueOfType(json, r'name'), - class_: mapValueOfType(json, r'class'), - ); - } - return null; - } + static Model200Response fromJson(Map json) => Model200Response( + name: json[r'name'] as int, + class_: json[r'class'] as String, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(Model200Response.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => Model200Response.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -76,7 +70,7 @@ class Model200Response { } // maps a json object with a list of Model200Response-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -84,7 +78,6 @@ class Model200Response { .forEach((key, dynamic value) { map[key] = Model200Response.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_client.dart index 9b3ef92da879..a005c0eddbf0 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_client.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +16,8 @@ class ModelClient { this.client, }); - String client; + + String? client; @override bool operator ==(Object other) => identical(this, other) || other is ModelClient && @@ -24,8 +25,7 @@ class ModelClient { @override int get hashCode => - // ignore: unnecessary_parenthesis - (client == null ? 0 : client.hashCode); + client.hashCode; @override String toString() => 'ModelClient[client=$client]'; @@ -41,20 +41,14 @@ class ModelClient { /// Returns a new [ModelClient] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static ModelClient fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return ModelClient( - client: mapValueOfType(json, r'client'), - ); - } - return null; - } + static ModelClient fromJson(Map json) => ModelClient( + client: json[r'client'] as String, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(ModelClient.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => ModelClient.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -67,7 +61,7 @@ class ModelClient { } // maps a json object with a list of ModelClient-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -75,7 +69,6 @@ class ModelClient { .forEach((key, dynamic value) { map[key] = ModelClient.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_file.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_file.dart index 66907de557c8..873819dc91e6 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_file.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_file.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,8 +16,9 @@ class ModelFile { this.sourceURI, }); + /// Test capitalization - String sourceURI; + String? sourceURI; @override bool operator ==(Object other) => identical(this, other) || other is ModelFile && @@ -25,8 +26,7 @@ class ModelFile { @override int get hashCode => - // ignore: unnecessary_parenthesis - (sourceURI == null ? 0 : sourceURI.hashCode); + sourceURI.hashCode; @override String toString() => 'ModelFile[sourceURI=$sourceURI]'; @@ -42,20 +42,14 @@ class ModelFile { /// Returns a new [ModelFile] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static ModelFile fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return ModelFile( - sourceURI: mapValueOfType(json, r'sourceURI'), - ); - } - return null; - } + static ModelFile fromJson(Map json) => ModelFile( + sourceURI: json[r'sourceURI'] as String, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(ModelFile.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => ModelFile.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -68,7 +62,7 @@ class ModelFile { } // maps a json object with a list of ModelFile-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -76,7 +70,6 @@ class ModelFile { .forEach((key, dynamic value) { map[key] = ModelFile.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_list.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_list.dart index e83b8055bc6f..96d33f818209 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_list.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_list.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +16,8 @@ class ModelList { this.n123list, }); - String n123list; + + String? n123list; @override bool operator ==(Object other) => identical(this, other) || other is ModelList && @@ -24,8 +25,7 @@ class ModelList { @override int get hashCode => - // ignore: unnecessary_parenthesis - (n123list == null ? 0 : n123list.hashCode); + n123list.hashCode; @override String toString() => 'ModelList[n123list=$n123list]'; @@ -41,20 +41,14 @@ class ModelList { /// Returns a new [ModelList] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static ModelList fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return ModelList( - n123list: mapValueOfType(json, r'123-list'), - ); - } - return null; - } + static ModelList fromJson(Map json) => ModelList( + n123list: json[r'123-list'] as String, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(ModelList.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => ModelList.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -67,7 +61,7 @@ class ModelList { } // maps a json object with a list of ModelList-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -75,7 +69,6 @@ class ModelList { .forEach((key, dynamic value) { map[key] = ModelList.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_return.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_return.dart index 3c740b8be854..b7a70dec9b6a 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_return.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_return.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +16,8 @@ class ModelReturn { this.return_, }); - int return_; + + int? return_; @override bool operator ==(Object other) => identical(this, other) || other is ModelReturn && @@ -24,8 +25,7 @@ class ModelReturn { @override int get hashCode => - // ignore: unnecessary_parenthesis - (return_ == null ? 0 : return_.hashCode); + return_.hashCode; @override String toString() => 'ModelReturn[return_=$return_]'; @@ -41,20 +41,14 @@ class ModelReturn { /// Returns a new [ModelReturn] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static ModelReturn fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return ModelReturn( - return_: mapValueOfType(json, r'return'), - ); - } - return null; - } + static ModelReturn fromJson(Map json) => ModelReturn( + return_: json[r'return'] as int, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(ModelReturn.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => ModelReturn.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -67,7 +61,7 @@ class ModelReturn { } // maps a json object with a list of ModelReturn-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -75,7 +69,6 @@ class ModelReturn { .forEach((key, dynamic value) { map[key] = ModelReturn.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/name.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/name.dart index d0c3106e3266..09fa45e5638e 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/name.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/name.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -13,19 +13,20 @@ part of openapi.api; class Name { /// Returns a new [Name] instance. Name({ - @required this.name, + required this.name, this.snakeCase, this.property, this.n123number, }); + int name; - int snakeCase; + int? snakeCase; - String property; + String? property; - int n123number; + int? n123number; @override bool operator ==(Object other) => identical(this, other) || other is Name && @@ -36,11 +37,10 @@ class Name { @override int get hashCode => - // ignore: unnecessary_parenthesis - (name == null ? 0 : name.hashCode) + - (snakeCase == null ? 0 : snakeCase.hashCode) + - (property == null ? 0 : property.hashCode) + - (n123number == null ? 0 : n123number.hashCode); + name.hashCode + + snakeCase.hashCode + + property.hashCode + + n123number.hashCode; @override String toString() => 'Name[name=$name, snakeCase=$snakeCase, property=$property, n123number=$n123number]'; @@ -63,23 +63,17 @@ class Name { /// Returns a new [Name] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static Name fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return Name( - name: mapValueOfType(json, r'name'), - snakeCase: mapValueOfType(json, r'snake_case'), - property: mapValueOfType(json, r'property'), - n123number: mapValueOfType(json, r'123Number'), - ); - } - return null; - } - - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(Name.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static Name fromJson(Map json) => Name( + name: json[r'name'] as int, + snakeCase: json[r'snake_case'] as int, + property: json[r'property'] as String, + n123number: json[r'123Number'] as int, + ); + + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => Name.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -92,7 +86,7 @@ class Name { } // maps a json object with a list of Name-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -100,7 +94,6 @@ class Name { .forEach((key, dynamic value) { map[key] = Name.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/nullable_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/nullable_class.dart index 469db464a5f9..c6ae36b497c1 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/nullable_class.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/nullable_class.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -27,29 +27,30 @@ class NullableClass { this.objectItemsNullable = const {}, }); - int integerProp; - num numberProp; + int? integerProp; - bool booleanProp; + num? numberProp; - String stringProp; + bool? booleanProp; - DateTime dateProp; + String? stringProp; - DateTime datetimeProp; + DateTime? dateProp; - List arrayNullableProp; + DateTime? datetimeProp; - List arrayAndItemsNullableProp; + List>? arrayNullableProp; - List arrayItemsNullable; + List>? arrayAndItemsNullableProp; - Map objectNullableProp; + List>? arrayItemsNullable; - Map objectAndItemsNullableProp; + Map? objectNullableProp; - Map objectItemsNullable; + Map? objectAndItemsNullableProp; + + Map? objectItemsNullable; @override bool operator ==(Object other) => identical(this, other) || other is NullableClass && @@ -68,19 +69,18 @@ class NullableClass { @override int get hashCode => - // ignore: unnecessary_parenthesis - (integerProp == null ? 0 : integerProp.hashCode) + - (numberProp == null ? 0 : numberProp.hashCode) + - (booleanProp == null ? 0 : booleanProp.hashCode) + - (stringProp == null ? 0 : stringProp.hashCode) + - (dateProp == null ? 0 : dateProp.hashCode) + - (datetimeProp == null ? 0 : datetimeProp.hashCode) + - (arrayNullableProp == null ? 0 : arrayNullableProp.hashCode) + - (arrayAndItemsNullableProp == null ? 0 : arrayAndItemsNullableProp.hashCode) + - (arrayItemsNullable == null ? 0 : arrayItemsNullable.hashCode) + - (objectNullableProp == null ? 0 : objectNullableProp.hashCode) + - (objectAndItemsNullableProp == null ? 0 : objectAndItemsNullableProp.hashCode) + - (objectItemsNullable == null ? 0 : objectItemsNullable.hashCode); + integerProp.hashCode + + numberProp.hashCode + + booleanProp.hashCode + + stringProp.hashCode + + dateProp.hashCode + + datetimeProp.hashCode + + arrayNullableProp.hashCode + + arrayAndItemsNullableProp.hashCode + + arrayItemsNullable.hashCode + + objectNullableProp.hashCode + + objectAndItemsNullableProp.hashCode + + objectItemsNullable.hashCode; @override String toString() => 'NullableClass[integerProp=$integerProp, numberProp=$numberProp, booleanProp=$booleanProp, stringProp=$stringProp, dateProp=$dateProp, datetimeProp=$datetimeProp, arrayNullableProp=$arrayNullableProp, arrayAndItemsNullableProp=$arrayAndItemsNullableProp, arrayItemsNullable=$arrayItemsNullable, objectNullableProp=$objectNullableProp, objectAndItemsNullableProp=$objectAndItemsNullableProp, objectItemsNullable=$objectItemsNullable]'; @@ -100,10 +100,10 @@ class NullableClass { json[r'string_prop'] = stringProp; } if (dateProp != null) { - json[r'date_prop'] = _dateFormatter.format(dateProp.toUtc()); + json[r'date_prop'] = _dateFormatter.format(dateProp!.toUtc()); } if (datetimeProp != null) { - json[r'datetime_prop'] = datetimeProp.toUtc().toIso8601String(); + json[r'datetime_prop'] = datetimeProp!.toUtc().toIso8601String(); } if (arrayNullableProp != null) { json[r'array_nullable_prop'] = arrayNullableProp; @@ -129,33 +129,25 @@ class NullableClass { /// Returns a new [NullableClass] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static NullableClass fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return NullableClass( - integerProp: mapValueOfType(json, r'integer_prop'), - numberProp: json[r'number_prop'] == null - ? null - : num.parse(json[r'number_prop'].toString()), - booleanProp: mapValueOfType(json, r'boolean_prop'), - stringProp: mapValueOfType(json, r'string_prop'), + static NullableClass fromJson(Map json) => NullableClass( + integerProp: json[r'integer_prop'] as int, + numberProp: json[r'number_prop'] as num, + booleanProp: json[r'boolean_prop'] as bool, + stringProp: json[r'string_prop'] as String, dateProp: mapDateTime(json, r'date_prop', ''), datetimeProp: mapDateTime(json, r'datetime_prop', ''), - arrayNullableProp: Object.listFromJson(json[r'array_nullable_prop']), - arrayAndItemsNullableProp: Object.listFromJson(json[r'array_and_items_nullable_prop']), - arrayItemsNullable: Object.listFromJson(json[r'array_items_nullable']), - objectNullableProp: mapValueOfType>(json, r'object_nullable_prop'), - objectAndItemsNullableProp: mapValueOfType>(json, r'object_and_items_nullable_prop'), - objectItemsNullable: mapValueOfType>(json, r'object_items_nullable'), - ); - } - return null; - } - - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(NullableClass.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + arrayNullableProp: (json[r'array_nullable_prop'] as List).cast>(), + arrayAndItemsNullableProp: (json[r'array_and_items_nullable_prop'] as List).cast>(), + arrayItemsNullable: (json[r'array_items_nullable'] as List).cast>(), + objectNullableProp: json[r'object_nullable_prop'] as Map, + objectAndItemsNullableProp: json[r'object_and_items_nullable_prop'] as Map, + objectItemsNullable: json[r'object_items_nullable'] as Map, + ); + + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => NullableClass.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -168,7 +160,7 @@ class NullableClass { } // maps a json object with a list of NullableClass-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -176,7 +168,6 @@ class NullableClass { .forEach((key, dynamic value) { map[key] = NullableClass.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/number_only.dart index 686cfff791f8..64a29725e24c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/number_only.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/number_only.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +16,8 @@ class NumberOnly { this.justNumber, }); - num justNumber; + + num? justNumber; @override bool operator ==(Object other) => identical(this, other) || other is NumberOnly && @@ -24,8 +25,7 @@ class NumberOnly { @override int get hashCode => - // ignore: unnecessary_parenthesis - (justNumber == null ? 0 : justNumber.hashCode); + justNumber.hashCode; @override String toString() => 'NumberOnly[justNumber=$justNumber]'; @@ -41,22 +41,14 @@ class NumberOnly { /// Returns a new [NumberOnly] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static NumberOnly fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return NumberOnly( - justNumber: json[r'JustNumber'] == null - ? null - : num.parse(json[r'JustNumber'].toString()), - ); - } - return null; - } + static NumberOnly fromJson(Map json) => NumberOnly( + justNumber: json[r'JustNumber'] as num, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(NumberOnly.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => NumberOnly.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -69,7 +61,7 @@ class NumberOnly { } // maps a json object with a list of NumberOnly-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -77,7 +69,6 @@ class NumberOnly { .forEach((key, dynamic value) { map[key] = NumberOnly.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/object_with_deprecated_fields.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/object_with_deprecated_fields.dart index b5e83009cf92..3b2295f89fac 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/object_with_deprecated_fields.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/object_with_deprecated_fields.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -19,13 +19,14 @@ class ObjectWithDeprecatedFields { this.bars = const [], }); - String uuid; - num id; + String? uuid; - DeprecatedObject deprecatedRef; + num? id; - List bars; + DeprecatedObject? deprecatedRef; + + List? bars; @override bool operator ==(Object other) => identical(this, other) || other is ObjectWithDeprecatedFields && @@ -36,11 +37,10 @@ class ObjectWithDeprecatedFields { @override int get hashCode => - // ignore: unnecessary_parenthesis - (uuid == null ? 0 : uuid.hashCode) + - (id == null ? 0 : id.hashCode) + - (deprecatedRef == null ? 0 : deprecatedRef.hashCode) + - (bars == null ? 0 : bars.hashCode); + uuid.hashCode + + id.hashCode + + deprecatedRef.hashCode + + bars.hashCode; @override String toString() => 'ObjectWithDeprecatedFields[uuid=$uuid, id=$id, deprecatedRef=$deprecatedRef, bars=$bars]'; @@ -65,27 +65,19 @@ class ObjectWithDeprecatedFields { /// Returns a new [ObjectWithDeprecatedFields] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static ObjectWithDeprecatedFields fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return ObjectWithDeprecatedFields( - uuid: mapValueOfType(json, r'uuid'), - id: json[r'id'] == null - ? null - : num.parse(json[r'id'].toString()), + static ObjectWithDeprecatedFields fromJson(Map json) => ObjectWithDeprecatedFields( + uuid: json[r'uuid'] as String, + id: json[r'id'] as num, deprecatedRef: DeprecatedObject.fromJson(json[r'deprecatedRef']), bars: json[r'bars'] is List ? (json[r'bars'] as List).cast() - : null, - ); - } - return null; - } + : [], + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(ObjectWithDeprecatedFields.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => ObjectWithDeprecatedFields.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -98,7 +90,7 @@ class ObjectWithDeprecatedFields { } // maps a json object with a list of ObjectWithDeprecatedFields-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -106,7 +98,6 @@ class ObjectWithDeprecatedFields { .forEach((key, dynamic value) { map[key] = ObjectWithDeprecatedFields.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart index 61d01acfaaa8..94761631bf4e 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -21,18 +21,19 @@ class Order { this.complete = false, }); - int id; - int petId; + int? id; - int quantity; + int? petId; - DateTime shipDate; + int? quantity; + + DateTime? shipDate; /// Order Status - OrderStatusEnum status; + OrderStatusEnum? status; - bool complete; + bool? complete; @override bool operator ==(Object other) => identical(this, other) || other is Order && @@ -45,13 +46,12 @@ class Order { @override int get hashCode => - // ignore: unnecessary_parenthesis - (id == null ? 0 : id.hashCode) + - (petId == null ? 0 : petId.hashCode) + - (quantity == null ? 0 : quantity.hashCode) + - (shipDate == null ? 0 : shipDate.hashCode) + - (status == null ? 0 : status.hashCode) + - (complete == null ? 0 : complete.hashCode); + id.hashCode + + petId.hashCode + + quantity.hashCode + + shipDate.hashCode + + status.hashCode + + complete.hashCode; @override String toString() => 'Order[id=$id, petId=$petId, quantity=$quantity, shipDate=$shipDate, status=$status, complete=$complete]'; @@ -68,7 +68,7 @@ class Order { json[r'quantity'] = quantity; } if (shipDate != null) { - json[r'shipDate'] = shipDate.toUtc().toIso8601String(); + json[r'shipDate'] = shipDate!.toUtc().toIso8601String(); } if (status != null) { json[r'status'] = status; @@ -82,25 +82,19 @@ class Order { /// Returns a new [Order] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static Order fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return Order( - id: mapValueOfType(json, r'id'), - petId: mapValueOfType(json, r'petId'), - quantity: mapValueOfType(json, r'quantity'), + static Order fromJson(Map json) => Order( + id: json[r'id'] as int, + petId: json[r'petId'] as int, + quantity: json[r'quantity'] as int, shipDate: mapDateTime(json, r'shipDate', ''), status: OrderStatusEnum.fromJson(json[r'status']), - complete: mapValueOfType(json, r'complete'), - ); - } - return null; - } + complete: json[r'complete'] as bool, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(Order.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => Order.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -113,7 +107,7 @@ class Order { } // maps a json object with a list of Order-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -121,7 +115,6 @@ class Order { .forEach((key, dynamic value) { map[key] = Order.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); @@ -136,12 +129,12 @@ class OrderStatusEnum { const OrderStatusEnum._(this.value); /// The underlying value of this enum member. - final String value; + final String? value; @override String toString() => value ?? ''; - String toJson() => value; + String? toJson() => value; static const placed = OrderStatusEnum._(r'placed'); static const approved = OrderStatusEnum._(r'approved'); @@ -157,10 +150,10 @@ class OrderStatusEnum { static OrderStatusEnum fromJson(dynamic value) => OrderStatusEnumTypeTransformer().decode(value); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(OrderStatusEnum.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => OrderStatusEnum.fromJson(i as Map)).toList(growable: true == growable) + : []; } /// Transformation class that can [encode] an instance of [OrderStatusEnum] to String, @@ -170,33 +163,26 @@ class OrderStatusEnumTypeTransformer { const OrderStatusEnumTypeTransformer._(); - String encode(OrderStatusEnum data) => data.value; + String? encode(OrderStatusEnum data) => data.value; /// Decodes a [dynamic value][data] to a OrderStatusEnum. /// - /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, - /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] - /// cannot be decoded successfully, then an [UnimplementedError] is thrown. - /// - /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, - /// and users are still using an old app with the old code. - OrderStatusEnum decode(dynamic data, {bool allowNull}) { - if (data != null) { - switch (data.toString()) { - case r'placed': return OrderStatusEnum.placed; - case r'approved': return OrderStatusEnum.approved; - case r'delivered': return OrderStatusEnum.delivered; - default: - if (allowNull == false) { - throw ArgumentError('Unknown enum value to decode: $data'); - } - } + /// If the [dynamic value][data] cannot be decoded successfully, then an [UnimplementedError] is thrown. + OrderStatusEnum decode(dynamic data) { + if (data == r'placed') { + return OrderStatusEnum.placed; + } + if (data == r'approved') { + return OrderStatusEnum.approved; + } + if (data == r'delivered') { + return OrderStatusEnum.delivered; } - return null; + throw ArgumentError('Unknown enum value to decode: $data'); } /// Singleton [OrderStatusEnumTypeTransformer] instance. - static OrderStatusEnumTypeTransformer _instance; + static OrderStatusEnumTypeTransformer? _instance; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_composite.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_composite.dart index 6ea8ef2ad983..04b07892308b 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_composite.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_composite.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -18,11 +18,12 @@ class OuterComposite { this.myBoolean, }); - num myNumber; - String myString; + num? myNumber; - bool myBoolean; + String? myString; + + bool? myBoolean; @override bool operator ==(Object other) => identical(this, other) || other is OuterComposite && @@ -32,10 +33,9 @@ class OuterComposite { @override int get hashCode => - // ignore: unnecessary_parenthesis - (myNumber == null ? 0 : myNumber.hashCode) + - (myString == null ? 0 : myString.hashCode) + - (myBoolean == null ? 0 : myBoolean.hashCode); + myNumber.hashCode + + myString.hashCode + + myBoolean.hashCode; @override String toString() => 'OuterComposite[myNumber=$myNumber, myString=$myString, myBoolean=$myBoolean]'; @@ -57,24 +57,16 @@ class OuterComposite { /// Returns a new [OuterComposite] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static OuterComposite fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return OuterComposite( - myNumber: json[r'my_number'] == null - ? null - : num.parse(json[r'my_number'].toString()), - myString: mapValueOfType(json, r'my_string'), - myBoolean: mapValueOfType(json, r'my_boolean'), - ); - } - return null; - } + static OuterComposite fromJson(Map json) => OuterComposite( + myNumber: json[r'my_number'] as num, + myString: json[r'my_string'] as String, + myBoolean: json[r'my_boolean'] as bool, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(OuterComposite.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => OuterComposite.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -87,7 +79,7 @@ class OuterComposite { } // maps a json object with a list of OuterComposite-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -95,7 +87,6 @@ class OuterComposite { .forEach((key, dynamic value) { map[key] = OuterComposite.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum.dart index 13e54eb7e599..6060149f0e37 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,12 +16,12 @@ class OuterEnum { const OuterEnum._(this.value); /// The underlying value of this enum member. - final String value; + final String? value; @override String toString() => value ?? ''; - String toJson() => value; + String? toJson() => value; static const placed = OuterEnum._(r'placed'); static const approved = OuterEnum._(r'approved'); @@ -37,10 +37,10 @@ class OuterEnum { static OuterEnum fromJson(dynamic value) => OuterEnumTypeTransformer().decode(value); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(OuterEnum.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => OuterEnum.fromJson(i as Map)).toList(growable: true == growable) + : []; } /// Transformation class that can [encode] an instance of [OuterEnum] to String, @@ -50,32 +50,26 @@ class OuterEnumTypeTransformer { const OuterEnumTypeTransformer._(); - String encode(OuterEnum data) => data.value; + String? encode(OuterEnum data) => data.value; /// Decodes a [dynamic value][data] to a OuterEnum. /// - /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, - /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] - /// cannot be decoded successfully, then an [UnimplementedError] is thrown. - /// - /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, - /// and users are still using an old app with the old code. - OuterEnum decode(dynamic data, {bool allowNull}) { - if (data != null) { - switch (data.toString()) { - case r'placed': return OuterEnum.placed; - case r'approved': return OuterEnum.approved; - case r'delivered': return OuterEnum.delivered; - default: - if (allowNull == false) { - throw ArgumentError('Unknown enum value to decode: $data'); - } - } + /// If the [dynamic value][data] cannot be decoded successfully, then an [UnimplementedError] is thrown. + OuterEnum decode(dynamic data) { + if (data == r'placed') { + return OuterEnum.placed; + } + if (data == r'approved') { + return OuterEnum.approved; } - return null; + if (data == r'delivered') { + return OuterEnum.delivered; + } + throw ArgumentError('Unknown enum value to decode: $data'); + } /// Singleton [OuterEnumTypeTransformer] instance. - static OuterEnumTypeTransformer _instance; + static OuterEnumTypeTransformer? _instance; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_default_value.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_default_value.dart index 5b2b1d500e51..7b334b1b082c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_default_value.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_default_value.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,12 +16,12 @@ class OuterEnumDefaultValue { const OuterEnumDefaultValue._(this.value); /// The underlying value of this enum member. - final String value; + final String? value; @override String toString() => value ?? ''; - String toJson() => value; + String? toJson() => value; static const placed = OuterEnumDefaultValue._(r'placed'); static const approved = OuterEnumDefaultValue._(r'approved'); @@ -37,10 +37,10 @@ class OuterEnumDefaultValue { static OuterEnumDefaultValue fromJson(dynamic value) => OuterEnumDefaultValueTypeTransformer().decode(value); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(OuterEnumDefaultValue.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => OuterEnumDefaultValue.fromJson(i as Map)).toList(growable: true == growable) + : []; } /// Transformation class that can [encode] an instance of [OuterEnumDefaultValue] to String, @@ -50,32 +50,26 @@ class OuterEnumDefaultValueTypeTransformer { const OuterEnumDefaultValueTypeTransformer._(); - String encode(OuterEnumDefaultValue data) => data.value; + String? encode(OuterEnumDefaultValue data) => data.value; /// Decodes a [dynamic value][data] to a OuterEnumDefaultValue. /// - /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, - /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] - /// cannot be decoded successfully, then an [UnimplementedError] is thrown. - /// - /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, - /// and users are still using an old app with the old code. - OuterEnumDefaultValue decode(dynamic data, {bool allowNull}) { - if (data != null) { - switch (data.toString()) { - case r'placed': return OuterEnumDefaultValue.placed; - case r'approved': return OuterEnumDefaultValue.approved; - case r'delivered': return OuterEnumDefaultValue.delivered; - default: - if (allowNull == false) { - throw ArgumentError('Unknown enum value to decode: $data'); - } - } + /// If the [dynamic value][data] cannot be decoded successfully, then an [UnimplementedError] is thrown. + OuterEnumDefaultValue decode(dynamic data) { + if (data == r'placed') { + return OuterEnumDefaultValue.placed; + } + if (data == r'approved') { + return OuterEnumDefaultValue.approved; } - return null; + if (data == r'delivered') { + return OuterEnumDefaultValue.delivered; + } + throw ArgumentError('Unknown enum value to decode: $data'); + } /// Singleton [OuterEnumDefaultValueTypeTransformer] instance. - static OuterEnumDefaultValueTypeTransformer _instance; + static OuterEnumDefaultValueTypeTransformer? _instance; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer.dart index 6becb11fd9ae..f25026a0c057 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,12 +16,12 @@ class OuterEnumInteger { const OuterEnumInteger._(this.value); /// The underlying value of this enum member. - final int value; + final int? value; @override String toString() => value == null ? '' : value.toString(); - int toJson() => value; + int? toJson() => value; static const number0 = OuterEnumInteger._(0); static const number1 = OuterEnumInteger._(1); @@ -37,10 +37,10 @@ class OuterEnumInteger { static OuterEnumInteger fromJson(dynamic value) => OuterEnumIntegerTypeTransformer().decode(value); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(OuterEnumInteger.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => OuterEnumInteger.fromJson(i as Map)).toList(growable: true == growable) + : []; } /// Transformation class that can [encode] an instance of [OuterEnumInteger] to int, @@ -50,32 +50,26 @@ class OuterEnumIntegerTypeTransformer { const OuterEnumIntegerTypeTransformer._(); - int encode(OuterEnumInteger data) => data.value; + int? encode(OuterEnumInteger data) => data.value; /// Decodes a [dynamic value][data] to a OuterEnumInteger. /// - /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, - /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] - /// cannot be decoded successfully, then an [UnimplementedError] is thrown. - /// - /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, - /// and users are still using an old app with the old code. - OuterEnumInteger decode(dynamic data, {bool allowNull}) { - if (data != null) { - switch (data.toString()) { - case 0: return OuterEnumInteger.number0; - case 1: return OuterEnumInteger.number1; - case 2: return OuterEnumInteger.number2; - default: - if (allowNull == false) { - throw ArgumentError('Unknown enum value to decode: $data'); - } - } + /// If the [dynamic value][data] cannot be decoded successfully, then an [UnimplementedError] is thrown. + OuterEnumInteger decode(dynamic data) { + if (data == 0) { + return OuterEnumInteger.number0; + } + if (data == 1) { + return OuterEnumInteger.number1; } - return null; + if (data == 2) { + return OuterEnumInteger.number2; + } + throw ArgumentError('Unknown enum value to decode: $data'); + } /// Singleton [OuterEnumIntegerTypeTransformer] instance. - static OuterEnumIntegerTypeTransformer _instance; + static OuterEnumIntegerTypeTransformer? _instance; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer_default_value.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer_default_value.dart index 5e534ea0f5c4..aaa012153cf3 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer_default_value.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer_default_value.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,12 +16,12 @@ class OuterEnumIntegerDefaultValue { const OuterEnumIntegerDefaultValue._(this.value); /// The underlying value of this enum member. - final int value; + final int? value; @override String toString() => value == null ? '' : value.toString(); - int toJson() => value; + int? toJson() => value; static const number0 = OuterEnumIntegerDefaultValue._(0); static const number1 = OuterEnumIntegerDefaultValue._(1); @@ -37,10 +37,10 @@ class OuterEnumIntegerDefaultValue { static OuterEnumIntegerDefaultValue fromJson(dynamic value) => OuterEnumIntegerDefaultValueTypeTransformer().decode(value); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(OuterEnumIntegerDefaultValue.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => OuterEnumIntegerDefaultValue.fromJson(i as Map)).toList(growable: true == growable) + : []; } /// Transformation class that can [encode] an instance of [OuterEnumIntegerDefaultValue] to int, @@ -50,32 +50,26 @@ class OuterEnumIntegerDefaultValueTypeTransformer { const OuterEnumIntegerDefaultValueTypeTransformer._(); - int encode(OuterEnumIntegerDefaultValue data) => data.value; + int? encode(OuterEnumIntegerDefaultValue data) => data.value; /// Decodes a [dynamic value][data] to a OuterEnumIntegerDefaultValue. /// - /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, - /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] - /// cannot be decoded successfully, then an [UnimplementedError] is thrown. - /// - /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, - /// and users are still using an old app with the old code. - OuterEnumIntegerDefaultValue decode(dynamic data, {bool allowNull}) { - if (data != null) { - switch (data.toString()) { - case 0: return OuterEnumIntegerDefaultValue.number0; - case 1: return OuterEnumIntegerDefaultValue.number1; - case 2: return OuterEnumIntegerDefaultValue.number2; - default: - if (allowNull == false) { - throw ArgumentError('Unknown enum value to decode: $data'); - } - } + /// If the [dynamic value][data] cannot be decoded successfully, then an [UnimplementedError] is thrown. + OuterEnumIntegerDefaultValue decode(dynamic data) { + if (data == 0) { + return OuterEnumIntegerDefaultValue.number0; + } + if (data == 1) { + return OuterEnumIntegerDefaultValue.number1; } - return null; + if (data == 2) { + return OuterEnumIntegerDefaultValue.number2; + } + throw ArgumentError('Unknown enum value to decode: $data'); + } /// Singleton [OuterEnumIntegerDefaultValueTypeTransformer] instance. - static OuterEnumIntegerDefaultValueTypeTransformer _instance; + static OuterEnumIntegerDefaultValueTypeTransformer? _instance; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_object_with_enum_property.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_object_with_enum_property.dart index 3ca207b7b742..e59dc888ddbc 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_object_with_enum_property.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_object_with_enum_property.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -13,9 +13,10 @@ part of openapi.api; class OuterObjectWithEnumProperty { /// Returns a new [OuterObjectWithEnumProperty] instance. OuterObjectWithEnumProperty({ - @required this.value, + required this.value, }); + OuterEnumInteger value; @override @@ -24,8 +25,7 @@ class OuterObjectWithEnumProperty { @override int get hashCode => - // ignore: unnecessary_parenthesis - (value == null ? 0 : value.hashCode); + value.hashCode; @override String toString() => 'OuterObjectWithEnumProperty[value=$value]'; @@ -39,20 +39,14 @@ class OuterObjectWithEnumProperty { /// Returns a new [OuterObjectWithEnumProperty] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static OuterObjectWithEnumProperty fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return OuterObjectWithEnumProperty( + static OuterObjectWithEnumProperty fromJson(Map json) => OuterObjectWithEnumProperty( value: OuterEnumInteger.fromJson(json[r'value']), - ); - } - return null; - } + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(OuterObjectWithEnumProperty.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => OuterObjectWithEnumProperty.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -65,7 +59,7 @@ class OuterObjectWithEnumProperty { } // maps a json object with a list of OuterObjectWithEnumProperty-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -73,7 +67,6 @@ class OuterObjectWithEnumProperty { .forEach((key, dynamic value) { map[key] = OuterObjectWithEnumProperty.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart index 988948fe7c77..e4b997f11b33 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -15,24 +15,25 @@ class Pet { Pet({ this.id, this.category, - @required this.name, + required this.name, this.photoUrls = const {}, this.tags = const [], this.status, }); - int id; - Category category; + int? id; + + Category? category; String name; Set photoUrls; - List tags; + List? tags; /// pet status in the store - PetStatusEnum status; + PetStatusEnum? status; @override bool operator ==(Object other) => identical(this, other) || other is Pet && @@ -45,13 +46,12 @@ class Pet { @override int get hashCode => - // ignore: unnecessary_parenthesis - (id == null ? 0 : id.hashCode) + - (category == null ? 0 : category.hashCode) + - (name == null ? 0 : name.hashCode) + - (photoUrls == null ? 0 : photoUrls.hashCode) + - (tags == null ? 0 : tags.hashCode) + - (status == null ? 0 : status.hashCode); + id.hashCode + + category.hashCode + + name.hashCode + + photoUrls.hashCode + + tags.hashCode + + status.hashCode; @override String toString() => 'Pet[id=$id, category=$category, name=$name, photoUrls=$photoUrls, tags=$tags, status=$status]'; @@ -78,27 +78,21 @@ class Pet { /// Returns a new [Pet] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static Pet fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return Pet( - id: mapValueOfType(json, r'id'), + static Pet fromJson(Map json) => Pet( + id: json[r'id'] as int, category: Category.fromJson(json[r'category']), - name: mapValueOfType(json, r'name'), + name: json[r'name'] as String, photoUrls: json[r'photoUrls'] is Set ? (json[r'photoUrls'] as Set).cast() - : null, + : {}, tags: Tag.listFromJson(json[r'tags']), status: PetStatusEnum.fromJson(json[r'status']), - ); - } - return null; - } + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(Pet.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => Pet.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -111,7 +105,7 @@ class Pet { } // maps a json object with a list of Pet-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -119,7 +113,6 @@ class Pet { .forEach((key, dynamic value) { map[key] = Pet.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); @@ -134,12 +127,12 @@ class PetStatusEnum { const PetStatusEnum._(this.value); /// The underlying value of this enum member. - final String value; + final String? value; @override String toString() => value ?? ''; - String toJson() => value; + String? toJson() => value; static const available = PetStatusEnum._(r'available'); static const pending = PetStatusEnum._(r'pending'); @@ -155,10 +148,10 @@ class PetStatusEnum { static PetStatusEnum fromJson(dynamic value) => PetStatusEnumTypeTransformer().decode(value); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(PetStatusEnum.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => PetStatusEnum.fromJson(i as Map)).toList(growable: true == growable) + : []; } /// Transformation class that can [encode] an instance of [PetStatusEnum] to String, @@ -168,33 +161,26 @@ class PetStatusEnumTypeTransformer { const PetStatusEnumTypeTransformer._(); - String encode(PetStatusEnum data) => data.value; + String? encode(PetStatusEnum data) => data.value; /// Decodes a [dynamic value][data] to a PetStatusEnum. /// - /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, - /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] - /// cannot be decoded successfully, then an [UnimplementedError] is thrown. - /// - /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, - /// and users are still using an old app with the old code. - PetStatusEnum decode(dynamic data, {bool allowNull}) { - if (data != null) { - switch (data.toString()) { - case r'available': return PetStatusEnum.available; - case r'pending': return PetStatusEnum.pending; - case r'sold': return PetStatusEnum.sold; - default: - if (allowNull == false) { - throw ArgumentError('Unknown enum value to decode: $data'); - } - } + /// If the [dynamic value][data] cannot be decoded successfully, then an [UnimplementedError] is thrown. + PetStatusEnum decode(dynamic data) { + if (data == r'available') { + return PetStatusEnum.available; + } + if (data == r'pending') { + return PetStatusEnum.pending; + } + if (data == r'sold') { + return PetStatusEnum.sold; } - return null; + throw ArgumentError('Unknown enum value to decode: $data'); } /// Singleton [PetStatusEnumTypeTransformer] instance. - static PetStatusEnumTypeTransformer _instance; + static PetStatusEnumTypeTransformer? _instance; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/read_only_first.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/read_only_first.dart index b1a1fe0c1d0f..01a6620ee722 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/read_only_first.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/read_only_first.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -17,9 +17,10 @@ class ReadOnlyFirst { this.baz, }); - String bar; - String baz; + String? bar; + + String? baz; @override bool operator ==(Object other) => identical(this, other) || other is ReadOnlyFirst && @@ -28,9 +29,8 @@ class ReadOnlyFirst { @override int get hashCode => - // ignore: unnecessary_parenthesis - (bar == null ? 0 : bar.hashCode) + - (baz == null ? 0 : baz.hashCode); + bar.hashCode + + baz.hashCode; @override String toString() => 'ReadOnlyFirst[bar=$bar, baz=$baz]'; @@ -49,21 +49,15 @@ class ReadOnlyFirst { /// Returns a new [ReadOnlyFirst] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static ReadOnlyFirst fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return ReadOnlyFirst( - bar: mapValueOfType(json, r'bar'), - baz: mapValueOfType(json, r'baz'), - ); - } - return null; - } + static ReadOnlyFirst fromJson(Map json) => ReadOnlyFirst( + bar: json[r'bar'] as String, + baz: json[r'baz'] as String, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(ReadOnlyFirst.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => ReadOnlyFirst.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -76,7 +70,7 @@ class ReadOnlyFirst { } // maps a json object with a list of ReadOnlyFirst-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -84,7 +78,6 @@ class ReadOnlyFirst { .forEach((key, dynamic value) { map[key] = ReadOnlyFirst.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/special_model_name.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/special_model_name.dart index 5ed9408d26a2..3847a3bcea0f 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/special_model_name.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/special_model_name.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +16,8 @@ class SpecialModelName { this.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket, }); - int dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; + + int? dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; @override bool operator ==(Object other) => identical(this, other) || other is SpecialModelName && @@ -24,8 +25,7 @@ class SpecialModelName { @override int get hashCode => - // ignore: unnecessary_parenthesis - (dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket == null ? 0 : dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket.hashCode); + dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket.hashCode; @override String toString() => 'SpecialModelName[dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket=$dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket]'; @@ -41,20 +41,14 @@ class SpecialModelName { /// Returns a new [SpecialModelName] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static SpecialModelName fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return SpecialModelName( - dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket: mapValueOfType(json, r'$special[property.name]'), - ); - } - return null; - } + static SpecialModelName fromJson(Map json) => SpecialModelName( + dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket: json[r'$special[property.name]'] as int, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(SpecialModelName.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => SpecialModelName.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -67,7 +61,7 @@ class SpecialModelName { } // maps a json object with a list of SpecialModelName-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -75,7 +69,6 @@ class SpecialModelName { .forEach((key, dynamic value) { map[key] = SpecialModelName.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/tag.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/tag.dart index 193c7004028f..e23a04b1c36e 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/tag.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/tag.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -17,9 +17,10 @@ class Tag { this.name, }); - int id; - String name; + int? id; + + String? name; @override bool operator ==(Object other) => identical(this, other) || other is Tag && @@ -28,9 +29,8 @@ class Tag { @override int get hashCode => - // ignore: unnecessary_parenthesis - (id == null ? 0 : id.hashCode) + - (name == null ? 0 : name.hashCode); + id.hashCode + + name.hashCode; @override String toString() => 'Tag[id=$id, name=$name]'; @@ -49,21 +49,15 @@ class Tag { /// Returns a new [Tag] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static Tag fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return Tag( - id: mapValueOfType(json, r'id'), - name: mapValueOfType(json, r'name'), - ); - } - return null; - } + static Tag fromJson(Map json) => Tag( + id: json[r'id'] as int, + name: json[r'name'] as String, + ); - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(Tag.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => Tag.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -76,7 +70,7 @@ class Tag { } // maps a json object with a list of Tag-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -84,7 +78,6 @@ class Tag { .forEach((key, dynamic value) { map[key] = Tag.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/user.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/user.dart index d2b94ed6a7ab..8afafd11c536 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/user.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/user.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -23,22 +23,23 @@ class User { this.userStatus, }); - int id; - String username; + int? id; - String firstName; + String? username; - String lastName; + String? firstName; - String email; + String? lastName; - String password; + String? email; - String phone; + String? password; + + String? phone; /// User Status - int userStatus; + int? userStatus; @override bool operator ==(Object other) => identical(this, other) || other is User && @@ -53,15 +54,14 @@ class User { @override int get hashCode => - // ignore: unnecessary_parenthesis - (id == null ? 0 : id.hashCode) + - (username == null ? 0 : username.hashCode) + - (firstName == null ? 0 : firstName.hashCode) + - (lastName == null ? 0 : lastName.hashCode) + - (email == null ? 0 : email.hashCode) + - (password == null ? 0 : password.hashCode) + - (phone == null ? 0 : phone.hashCode) + - (userStatus == null ? 0 : userStatus.hashCode); + id.hashCode + + username.hashCode + + firstName.hashCode + + lastName.hashCode + + email.hashCode + + password.hashCode + + phone.hashCode + + userStatus.hashCode; @override String toString() => 'User[id=$id, username=$username, firstName=$firstName, lastName=$lastName, email=$email, password=$password, phone=$phone, userStatus=$userStatus]'; @@ -98,27 +98,21 @@ class User { /// Returns a new [User] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static User fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - return User( - id: mapValueOfType(json, r'id'), - username: mapValueOfType(json, r'username'), - firstName: mapValueOfType(json, r'firstName'), - lastName: mapValueOfType(json, r'lastName'), - email: mapValueOfType(json, r'email'), - password: mapValueOfType(json, r'password'), - phone: mapValueOfType(json, r'phone'), - userStatus: mapValueOfType(json, r'userStatus'), - ); - } - return null; - } - - static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) => - json is List && json.isNotEmpty - ? json.map(User.fromJson).toList(growable: true == growable) - : true == emptyIsNull ? null : []; + static User fromJson(Map json) => User( + id: json[r'id'] as int, + username: json[r'username'] as String, + firstName: json[r'firstName'] as String, + lastName: json[r'lastName'] as String, + email: json[r'email'] as String, + password: json[r'password'] as String, + phone: json[r'phone'] as String, + userStatus: json[r'userStatus'] as int, + ); + + static List listFromJson(List json, {bool? growable,}) => + json.isNotEmpty + ? json.map((i) => User.fromJson(i as Map)).toList(growable: true == growable) + : []; static Map mapFromJson(dynamic json) { final map = {}; @@ -131,7 +125,7 @@ class User { } // maps a json object with a list of User-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) { + static Map> mapListFromJson(dynamic json, {bool? growable,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json @@ -139,7 +133,6 @@ class User { .forEach((key, dynamic value) { map[key] = User.listFromJson( value, - emptyIsNull: emptyIsNull, growable: growable, ); }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/pom.xml b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/pom.xml deleted file mode 100644 index d09de2749f6a..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/pom.xml +++ /dev/null @@ -1,73 +0,0 @@ - - 4.0.0 - org.openapitools - Dart2PetstoreClientLibFakeTests - pom - 1.0.0-SNAPSHOT - Dart2 Petstore Client Lib Fake - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory} - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - export-dartfmt - pre-install-test - - exec - - - export - - DART_FMT_PATH=/usr/local/bin/dartfmt - - - - - pub-get - pre-integration-test - - exec - - - pub - - get - - - - - pub-test - integration-test - - exec - - - pub - - run - test - - - - - - - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/pubspec.yaml b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/pubspec.yaml index 163b29ec3ecc..c97129058928 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/pubspec.yaml +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/pubspec.yaml @@ -7,12 +7,10 @@ version: '1.0.0' description: 'OpenAPI API client' homepage: 'homepage' environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.14.0 <3.0.0' dependencies: http: '>=0.13.0 <0.14.0' intl: '^0.17.0' - meta: '^1.1.8' dev_dependencies: - test: '>=1.16.0 <1.18.0' diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/additional_properties_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/additional_properties_class_test.dart deleted file mode 100644 index 3f231dddf74d..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/additional_properties_class_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for AdditionalPropertiesClass -void main() { - final instance = AdditionalPropertiesClass(); - - group('test AdditionalPropertiesClass', () { - // Map mapProperty (default value: const {}) - test('to test the property `mapProperty`', () async { - // TODO - }); - - // Map> mapOfMapProperty (default value: const {}) - test('to test the property `mapOfMapProperty`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/animal_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/animal_test.dart deleted file mode 100644 index 3e6526e71957..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/animal_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Animal -void main() { - final instance = Animal(); - - group('test Animal', () { - // String className - test('to test the property `className`', () async { - // TODO - }); - - // String color (default value: 'red') - test('to test the property `color`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/another_fake_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/another_fake_api_test.dart deleted file mode 100644 index 355b4140bdd6..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/another_fake_api_test.dart +++ /dev/null @@ -1,29 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for AnotherFakeApi -void main() { - final instance = AnotherFakeApi(); - - group('tests for AnotherFakeApi', () { - // To test special tags - // - // To test special tags and operation ID starting with number - // - //Future call123testSpecialTags(ModelClient modelClient) async - test('test call123testSpecialTags', () async { - // TODO - }); - - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/api_response_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/api_response_test.dart deleted file mode 100644 index b0c30615b926..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/api_response_test.dart +++ /dev/null @@ -1,36 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ApiResponse -void main() { - final instance = ApiResponse(); - - group('test ApiResponse', () { - // int code - test('to test the property `code`', () async { - // TODO - }); - - // String type - test('to test the property `type`', () async { - // TODO - }); - - // String message - test('to test the property `message`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_array_of_number_only_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_array_of_number_only_test.dart deleted file mode 100644 index 53ed7123a884..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_array_of_number_only_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ArrayOfArrayOfNumberOnly -void main() { - final instance = ArrayOfArrayOfNumberOnly(); - - group('test ArrayOfArrayOfNumberOnly', () { - // List> arrayArrayNumber (default value: const []) - test('to test the property `arrayArrayNumber`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_number_only_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_number_only_test.dart deleted file mode 100644 index 99fb4e3ddf79..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_number_only_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ArrayOfNumberOnly -void main() { - final instance = ArrayOfNumberOnly(); - - group('test ArrayOfNumberOnly', () { - // List arrayNumber (default value: const []) - test('to test the property `arrayNumber`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_test_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_test_test.dart deleted file mode 100644 index f1af158fe2fe..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_test_test.dart +++ /dev/null @@ -1,36 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ArrayTest -void main() { - final instance = ArrayTest(); - - group('test ArrayTest', () { - // List arrayOfString (default value: const []) - test('to test the property `arrayOfString`', () async { - // TODO - }); - - // List> arrayArrayOfInteger (default value: const []) - test('to test the property `arrayArrayOfInteger`', () async { - // TODO - }); - - // List> arrayArrayOfModel (default value: const []) - test('to test the property `arrayArrayOfModel`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/capitalization_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/capitalization_test.dart deleted file mode 100644 index c21e1a31c933..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/capitalization_test.dart +++ /dev/null @@ -1,52 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Capitalization -void main() { - final instance = Capitalization(); - - group('test Capitalization', () { - // String smallCamel - test('to test the property `smallCamel`', () async { - // TODO - }); - - // String capitalCamel - test('to test the property `capitalCamel`', () async { - // TODO - }); - - // String smallSnake - test('to test the property `smallSnake`', () async { - // TODO - }); - - // String capitalSnake - test('to test the property `capitalSnake`', () async { - // TODO - }); - - // String sCAETHFlowPoints - test('to test the property `sCAETHFlowPoints`', () async { - // TODO - }); - - // Name of the pet - // String ATT_NAME - test('to test the property `ATT_NAME`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_all_of_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_all_of_test.dart deleted file mode 100644 index f4d0a69b7ca3..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_all_of_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for CatAllOf -void main() { - final instance = CatAllOf(); - - group('test CatAllOf', () { - // bool declawed - test('to test the property `declawed`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_test.dart deleted file mode 100644 index e7d33048bbc4..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_test.dart +++ /dev/null @@ -1,36 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Cat -void main() { - final instance = Cat(); - - group('test Cat', () { - // String className - test('to test the property `className`', () async { - // TODO - }); - - // String color (default value: 'red') - test('to test the property `color`', () async { - // TODO - }); - - // bool declawed - test('to test the property `declawed`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/category_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/category_test.dart deleted file mode 100644 index 54d51663d9d9..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/category_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Category -void main() { - final instance = Category(); - - group('test Category', () { - // int id - test('to test the property `id`', () async { - // TODO - }); - - // String name (default value: 'default-name') - test('to test the property `name`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/class_model_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/class_model_test.dart deleted file mode 100644 index 047ce788765a..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/class_model_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ClassModel -void main() { - final instance = ClassModel(); - - group('test ClassModel', () { - // String class_ - test('to test the property `class_`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/default_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/default_api_test.dart deleted file mode 100644 index 2756c463df1c..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/default_api_test.dart +++ /dev/null @@ -1,25 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for DefaultApi -void main() { - final instance = DefaultApi(); - - group('tests for DefaultApi', () { - //Future fooGet() async - test('test fooGet', () async { - // TODO - }); - - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/deprecated_object_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/deprecated_object_test.dart deleted file mode 100644 index a1c6df250582..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/deprecated_object_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for DeprecatedObject -void main() { - final instance = DeprecatedObject(); - - group('test DeprecatedObject', () { - // String name - test('to test the property `name`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_all_of_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_all_of_test.dart deleted file mode 100644 index 5a0209898b88..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_all_of_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for DogAllOf -void main() { - final instance = DogAllOf(); - - group('test DogAllOf', () { - // String breed - test('to test the property `breed`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_test.dart deleted file mode 100644 index bce7e5bbdece..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_test.dart +++ /dev/null @@ -1,36 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Dog -void main() { - final instance = Dog(); - - group('test Dog', () { - // String className - test('to test the property `className`', () async { - // TODO - }); - - // String color (default value: 'red') - test('to test the property `color`', () async { - // TODO - }); - - // String breed - test('to test the property `breed`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_arrays_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_arrays_test.dart deleted file mode 100644 index b3364c9a89a6..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_arrays_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for EnumArrays -void main() { - final instance = EnumArrays(); - - group('test EnumArrays', () { - // String justSymbol - test('to test the property `justSymbol`', () async { - // TODO - }); - - // List arrayEnum (default value: const []) - test('to test the property `arrayEnum`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_class_test.dart deleted file mode 100644 index 496ffbd68cfd..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_class_test.dart +++ /dev/null @@ -1,20 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for EnumClass -void main() { - - group('test EnumClass', () { - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_test_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_test_test.dart deleted file mode 100644 index 52618838aff4..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_test_test.dart +++ /dev/null @@ -1,61 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for EnumTest -void main() { - final instance = EnumTest(); - - group('test EnumTest', () { - // String enumString - test('to test the property `enumString`', () async { - // TODO - }); - - // String enumStringRequired - test('to test the property `enumStringRequired`', () async { - // TODO - }); - - // int enumInteger - test('to test the property `enumInteger`', () async { - // TODO - }); - - // double enumNumber - test('to test the property `enumNumber`', () async { - // TODO - }); - - // OuterEnum outerEnum - test('to test the property `outerEnum`', () async { - // TODO - }); - - // OuterEnumInteger outerEnumInteger - test('to test the property `outerEnumInteger`', () async { - // TODO - }); - - // OuterEnumDefaultValue outerEnumDefaultValue - test('to test the property `outerEnumDefaultValue`', () async { - // TODO - }); - - // OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue - test('to test the property `outerEnumIntegerDefaultValue`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_api_test.dart deleted file mode 100644 index 065e89afdc1e..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_api_test.dart +++ /dev/null @@ -1,138 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for FakeApi -void main() { - final instance = FakeApi(); - - group('tests for FakeApi', () { - // Health check endpoint - // - //Future fakeHealthGet() async - test('test fakeHealthGet', () async { - // TODO - }); - - // test http signature authentication - // - //Future fakeHttpSignatureTest(Pet pet, { String query1, String header1 }) async - test('test fakeHttpSignatureTest', () async { - // TODO - }); - - // Test serialization of outer boolean types - // - //Future fakeOuterBooleanSerialize({ bool body }) async - test('test fakeOuterBooleanSerialize', () async { - // TODO - }); - - // Test serialization of object with outer number type - // - //Future fakeOuterCompositeSerialize({ OuterComposite outerComposite }) async - test('test fakeOuterCompositeSerialize', () async { - // TODO - }); - - // Test serialization of outer number types - // - //Future fakeOuterNumberSerialize({ num body }) async - test('test fakeOuterNumberSerialize', () async { - // TODO - }); - - // Test serialization of outer string types - // - //Future fakeOuterStringSerialize({ String body }) async - test('test fakeOuterStringSerialize', () async { - // TODO - }); - - // Test serialization of enum (int) properties with examples - // - //Future fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty) async - test('test fakePropertyEnumIntegerSerialize', () async { - // TODO - }); - - // For this test, the body for this request much reference a schema named `File`. - // - //Future testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) async - test('test testBodyWithFileSchema', () async { - // TODO - }); - - //Future testBodyWithQueryParams(String query, User user) async - test('test testBodyWithQueryParams', () async { - // TODO - }); - - // To test \"client\" model - // - // To test \"client\" model - // - //Future testClientModel(ModelClient modelClient) async - test('test testClientModel', () async { - // TODO - }); - - // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - // - // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - // - //Future testEndpointParameters(num number, double double_, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback }) async - test('test testEndpointParameters', () async { - // TODO - }); - - // To test enum parameters - // - // To test enum parameters - // - //Future testEnumParameters({ List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, List enumFormStringArray, String enumFormString }) async - test('test testEnumParameters', () async { - // TODO - }); - - // Fake endpoint to test group parameters (optional) - // - // Fake endpoint to test group parameters (optional) - // - //Future testGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int stringGroup, bool booleanGroup, int int64Group }) async - test('test testGroupParameters', () async { - // TODO - }); - - // test inline additionalProperties - // - //Future testInlineAdditionalProperties(Map requestBody) async - test('test testInlineAdditionalProperties', () async { - // TODO - }); - - // test json serialization of form data - // - //Future testJsonFormData(String param, String param2) async - test('test testJsonFormData', () async { - // TODO - }); - - // To test the collection format in query parameters - // - //Future testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context) async - test('test testQueryParameterCollectionFormat', () async { - // TODO - }); - - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_classname_tags123_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_classname_tags123_api_test.dart deleted file mode 100644 index 1a0f96589476..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_classname_tags123_api_test.dart +++ /dev/null @@ -1,29 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for FakeClassnameTags123Api -void main() { - final instance = FakeClassnameTags123Api(); - - group('tests for FakeClassnameTags123Api', () { - // To test class name in snake case - // - // To test class name in snake case - // - //Future testClassname(ModelClient modelClient) async - test('test testClassname', () async { - // TODO - }); - - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/file_schema_test_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/file_schema_test_class_test.dart deleted file mode 100644 index 4316bb385a76..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/file_schema_test_class_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for FileSchemaTestClass -void main() { - final instance = FileSchemaTestClass(); - - group('test FileSchemaTestClass', () { - // ModelFile file - test('to test the property `file`', () async { - // TODO - }); - - // List files (default value: const []) - test('to test the property `files`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/foo_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/foo_test.dart deleted file mode 100644 index 7b72da51b0e8..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/foo_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Foo -void main() { - final instance = Foo(); - - group('test Foo', () { - // String bar (default value: 'bar') - test('to test the property `bar`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/format_test_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/format_test_test.dart deleted file mode 100644 index e776be1d9f68..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/format_test_test.dart +++ /dev/null @@ -1,103 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for FormatTest -void main() { - final instance = FormatTest(); - - group('test FormatTest', () { - // int integer - test('to test the property `integer`', () async { - // TODO - }); - - // int int32 - test('to test the property `int32`', () async { - // TODO - }); - - // int int64 - test('to test the property `int64`', () async { - // TODO - }); - - // num number - test('to test the property `number`', () async { - // TODO - }); - - // double float - test('to test the property `float`', () async { - // TODO - }); - - // double double_ - test('to test the property `double_`', () async { - // TODO - }); - - // double decimal - test('to test the property `decimal`', () async { - // TODO - }); - - // String string - test('to test the property `string`', () async { - // TODO - }); - - // String byte - test('to test the property `byte`', () async { - // TODO - }); - - // MultipartFile binary - test('to test the property `binary`', () async { - // TODO - }); - - // DateTime date - test('to test the property `date`', () async { - // TODO - }); - - // DateTime dateTime - test('to test the property `dateTime`', () async { - // TODO - }); - - // String uuid - test('to test the property `uuid`', () async { - // TODO - }); - - // String password - test('to test the property `password`', () async { - // TODO - }); - - // A string that is a 10 digit number. Can have leading zeros. - // String patternWithDigits - test('to test the property `patternWithDigits`', () async { - // TODO - }); - - // A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. - // String patternWithDigitsAndDelimiter - test('to test the property `patternWithDigitsAndDelimiter`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/has_only_read_only_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/has_only_read_only_test.dart deleted file mode 100644 index 16b36e117094..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/has_only_read_only_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for HasOnlyReadOnly -void main() { - final instance = HasOnlyReadOnly(); - - group('test HasOnlyReadOnly', () { - // String bar - test('to test the property `bar`', () async { - // TODO - }); - - // String foo - test('to test the property `foo`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/health_check_result_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/health_check_result_test.dart deleted file mode 100644 index 1599fc46a283..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/health_check_result_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for HealthCheckResult -void main() { - final instance = HealthCheckResult(); - - group('test HealthCheckResult', () { - // String nullableMessage - test('to test the property `nullableMessage`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_response_default_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_response_default_test.dart deleted file mode 100644 index ecb2a874f05f..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_response_default_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for InlineResponseDefault -void main() { - final instance = InlineResponseDefault(); - - group('test InlineResponseDefault', () { - // Foo string - test('to test the property `string`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/map_test_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/map_test_test.dart deleted file mode 100644 index 21af0b85fa36..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/map_test_test.dart +++ /dev/null @@ -1,41 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for MapTest -void main() { - final instance = MapTest(); - - group('test MapTest', () { - // Map> mapMapOfString (default value: const {}) - test('to test the property `mapMapOfString`', () async { - // TODO - }); - - // Map mapOfEnumString (default value: const {}) - test('to test the property `mapOfEnumString`', () async { - // TODO - }); - - // Map directMap (default value: const {}) - test('to test the property `directMap`', () async { - // TODO - }); - - // Map indirectMap (default value: const {}) - test('to test the property `indirectMap`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart deleted file mode 100644 index a8e0fdd8da64..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart +++ /dev/null @@ -1,36 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for MixedPropertiesAndAdditionalPropertiesClass -void main() { - final instance = MixedPropertiesAndAdditionalPropertiesClass(); - - group('test MixedPropertiesAndAdditionalPropertiesClass', () { - // String uuid - test('to test the property `uuid`', () async { - // TODO - }); - - // DateTime dateTime - test('to test the property `dateTime`', () async { - // TODO - }); - - // Map map (default value: const {}) - test('to test the property `map`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model200_response_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model200_response_test.dart deleted file mode 100644 index c28d3671dfc1..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model200_response_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Model200Response -void main() { - final instance = Model200Response(); - - group('test Model200Response', () { - // int name - test('to test the property `name`', () async { - // TODO - }); - - // String class_ - test('to test the property `class_`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_client_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_client_test.dart deleted file mode 100644 index c0a59729e3d5..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_client_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ModelClient -void main() { - final instance = ModelClient(); - - group('test ModelClient', () { - // String client - test('to test the property `client`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_file_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_file_test.dart deleted file mode 100644 index b2f6d48afa74..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_file_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ModelFile -void main() { - final instance = ModelFile(); - - group('test ModelFile', () { - // Test capitalization - // String sourceURI - test('to test the property `sourceURI`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_list_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_list_test.dart deleted file mode 100644 index 02e98011b21f..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_list_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ModelList -void main() { - final instance = ModelList(); - - group('test ModelList', () { - // String n123list - test('to test the property `n123list`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_return_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_return_test.dart deleted file mode 100644 index b7f065e4fb45..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_return_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ModelReturn -void main() { - final instance = ModelReturn(); - - group('test ModelReturn', () { - // int return_ - test('to test the property `return_`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/name_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/name_test.dart deleted file mode 100644 index 8e0ef41e9f2f..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/name_test.dart +++ /dev/null @@ -1,41 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Name -void main() { - final instance = Name(); - - group('test Name', () { - // int name - test('to test the property `name`', () async { - // TODO - }); - - // int snakeCase - test('to test the property `snakeCase`', () async { - // TODO - }); - - // String property - test('to test the property `property`', () async { - // TODO - }); - - // int n123number - test('to test the property `n123number`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/nullable_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/nullable_class_test.dart deleted file mode 100644 index 6147fbe1336b..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/nullable_class_test.dart +++ /dev/null @@ -1,81 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for NullableClass -void main() { - final instance = NullableClass(); - - group('test NullableClass', () { - // int integerProp - test('to test the property `integerProp`', () async { - // TODO - }); - - // num numberProp - test('to test the property `numberProp`', () async { - // TODO - }); - - // bool booleanProp - test('to test the property `booleanProp`', () async { - // TODO - }); - - // String stringProp - test('to test the property `stringProp`', () async { - // TODO - }); - - // DateTime dateProp - test('to test the property `dateProp`', () async { - // TODO - }); - - // DateTime datetimeProp - test('to test the property `datetimeProp`', () async { - // TODO - }); - - // List arrayNullableProp (default value: const []) - test('to test the property `arrayNullableProp`', () async { - // TODO - }); - - // List arrayAndItemsNullableProp (default value: const []) - test('to test the property `arrayAndItemsNullableProp`', () async { - // TODO - }); - - // List arrayItemsNullable (default value: const []) - test('to test the property `arrayItemsNullable`', () async { - // TODO - }); - - // Map objectNullableProp (default value: const {}) - test('to test the property `objectNullableProp`', () async { - // TODO - }); - - // Map objectAndItemsNullableProp (default value: const {}) - test('to test the property `objectAndItemsNullableProp`', () async { - // TODO - }); - - // Map objectItemsNullable (default value: const {}) - test('to test the property `objectItemsNullable`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/number_only_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/number_only_test.dart deleted file mode 100644 index 3662bff150d9..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/number_only_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for NumberOnly -void main() { - final instance = NumberOnly(); - - group('test NumberOnly', () { - // num justNumber - test('to test the property `justNumber`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/object_with_deprecated_fields_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/object_with_deprecated_fields_test.dart deleted file mode 100644 index b5769dc67490..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/object_with_deprecated_fields_test.dart +++ /dev/null @@ -1,41 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ObjectWithDeprecatedFields -void main() { - final instance = ObjectWithDeprecatedFields(); - - group('test ObjectWithDeprecatedFields', () { - // String uuid - test('to test the property `uuid`', () async { - // TODO - }); - - // num id - test('to test the property `id`', () async { - // TODO - }); - - // DeprecatedObject deprecatedRef - test('to test the property `deprecatedRef`', () async { - // TODO - }); - - // List bars (default value: const []) - test('to test the property `bars`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/order_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/order_test.dart deleted file mode 100644 index 614a14e42bb9..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/order_test.dart +++ /dev/null @@ -1,52 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Order -void main() { - final instance = Order(); - - group('test Order', () { - // int id - test('to test the property `id`', () async { - // TODO - }); - - // int petId - test('to test the property `petId`', () async { - // TODO - }); - - // int quantity - test('to test the property `quantity`', () async { - // TODO - }); - - // DateTime shipDate - test('to test the property `shipDate`', () async { - // TODO - }); - - // Order Status - // String status - test('to test the property `status`', () async { - // TODO - }); - - // bool complete (default value: false) - test('to test the property `complete`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_composite_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_composite_test.dart deleted file mode 100644 index 294c823443c3..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_composite_test.dart +++ /dev/null @@ -1,36 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for OuterComposite -void main() { - final instance = OuterComposite(); - - group('test OuterComposite', () { - // num myNumber - test('to test the property `myNumber`', () async { - // TODO - }); - - // String myString - test('to test the property `myString`', () async { - // TODO - }); - - // bool myBoolean - test('to test the property `myBoolean`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_default_value_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_default_value_test.dart deleted file mode 100644 index 84ae975ef189..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_default_value_test.dart +++ /dev/null @@ -1,20 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for OuterEnumDefaultValue -void main() { - - group('test OuterEnumDefaultValue', () { - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_default_value_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_default_value_test.dart deleted file mode 100644 index bf3399ba4281..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_default_value_test.dart +++ /dev/null @@ -1,20 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for OuterEnumIntegerDefaultValue -void main() { - - group('test OuterEnumIntegerDefaultValue', () { - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_test.dart deleted file mode 100644 index d807f03227ff..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_test.dart +++ /dev/null @@ -1,20 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for OuterEnumInteger -void main() { - - group('test OuterEnumInteger', () { - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_test.dart deleted file mode 100644 index a2b79ce0c1c6..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_test.dart +++ /dev/null @@ -1,20 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for OuterEnum -void main() { - - group('test OuterEnum', () { - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_object_with_enum_property_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_object_with_enum_property_test.dart deleted file mode 100644 index 6995c37ebb4c..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_object_with_enum_property_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for OuterObjectWithEnumProperty -void main() { - final instance = OuterObjectWithEnumProperty(); - - group('test OuterObjectWithEnumProperty', () { - // OuterEnumInteger value - test('to test the property `value`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_api_test.dart deleted file mode 100644 index 5f4c994acefa..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_api_test.dart +++ /dev/null @@ -1,89 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for PetApi -void main() { - final instance = PetApi(); - - group('tests for PetApi', () { - // Add a new pet to the store - // - //Future addPet(Pet pet) async - test('test addPet', () async { - // TODO - }); - - // Deletes a pet - // - //Future deletePet(int petId, { String apiKey }) async - test('test deletePet', () async { - // TODO - }); - - // Finds Pets by status - // - // Multiple status values can be provided with comma separated strings - // - //Future> findPetsByStatus(List status) async - test('test findPetsByStatus', () async { - // TODO - }); - - // Finds Pets by tags - // - // Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - // - //Future> findPetsByTags(Set tags) async - test('test findPetsByTags', () async { - // TODO - }); - - // Find pet by ID - // - // Returns a single pet - // - //Future getPetById(int petId) async - test('test getPetById', () async { - // TODO - }); - - // Update an existing pet - // - //Future updatePet(Pet pet) async - test('test updatePet', () async { - // TODO - }); - - // Updates a pet in the store with form data - // - //Future updatePetWithForm(int petId, { String name, String status }) async - test('test updatePetWithForm', () async { - // TODO - }); - - // uploads an image - // - //Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async - test('test uploadFile', () async { - // TODO - }); - - // uploads an image (required) - // - //Future uploadFileWithRequiredFile(int petId, MultipartFile requiredFile, { String additionalMetadata }) async - test('test uploadFileWithRequiredFile', () async { - // TODO - }); - - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_test.dart deleted file mode 100644 index 23c26595c85c..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_test.dart +++ /dev/null @@ -1,52 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Pet -void main() { - final instance = Pet(); - - group('test Pet', () { - // int id - test('to test the property `id`', () async { - // TODO - }); - - // Category category - test('to test the property `category`', () async { - // TODO - }); - - // String name - test('to test the property `name`', () async { - // TODO - }); - - // Set photoUrls (default value: const {}) - test('to test the property `photoUrls`', () async { - // TODO - }); - - // List tags (default value: const []) - test('to test the property `tags`', () async { - // TODO - }); - - // pet status in the store - // String status - test('to test the property `status`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/read_only_first_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/read_only_first_test.dart deleted file mode 100644 index d3326fd494d0..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/read_only_first_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ReadOnlyFirst -void main() { - final instance = ReadOnlyFirst(); - - group('test ReadOnlyFirst', () { - // String bar - test('to test the property `bar`', () async { - // TODO - }); - - // String baz - test('to test the property `baz`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/special_model_name_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/special_model_name_test.dart deleted file mode 100644 index f3b461364fbe..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/special_model_name_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for SpecialModelName -void main() { - final instance = SpecialModelName(); - - group('test SpecialModelName', () { - // int dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket - test('to test the property `dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/store_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/store_api_test.dart deleted file mode 100644 index 4a7ed54abbbc..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/store_api_test.dart +++ /dev/null @@ -1,54 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for StoreApi -void main() { - final instance = StoreApi(); - - group('tests for StoreApi', () { - // Delete purchase order by ID - // - // For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - // - //Future deleteOrder(String orderId) async - test('test deleteOrder', () async { - // TODO - }); - - // Returns pet inventories by status - // - // Returns a map of status codes to quantities - // - //Future> getInventory() async - test('test getInventory', () async { - // TODO - }); - - // Find purchase order by ID - // - // For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - // - //Future getOrderById(int orderId) async - test('test getOrderById', () async { - // TODO - }); - - // Place an order for a pet - // - //Future placeOrder(Order order) async - test('test placeOrder', () async { - // TODO - }); - - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/tag_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/tag_test.dart deleted file mode 100644 index 66ecdfe488dc..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/tag_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Tag -void main() { - final instance = Tag(); - - group('test Tag', () { - // int id - test('to test the property `id`', () async { - // TODO - }); - - // String name - test('to test the property `name`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_api_test.dart deleted file mode 100644 index 73ee89a29451..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_api_test.dart +++ /dev/null @@ -1,82 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for UserApi -void main() { - final instance = UserApi(); - - group('tests for UserApi', () { - // Create user - // - // This can only be done by the logged in user. - // - //Future createUser(User user) async - test('test createUser', () async { - // TODO - }); - - // Creates list of users with given input array - // - //Future createUsersWithArrayInput(List user) async - test('test createUsersWithArrayInput', () async { - // TODO - }); - - // Creates list of users with given input array - // - //Future createUsersWithListInput(List user) async - test('test createUsersWithListInput', () async { - // TODO - }); - - // Delete user - // - // This can only be done by the logged in user. - // - //Future deleteUser(String username) async - test('test deleteUser', () async { - // TODO - }); - - // Get user by user name - // - //Future getUserByName(String username) async - test('test getUserByName', () async { - // TODO - }); - - // Logs user into the system - // - //Future loginUser(String username, String password) async - test('test loginUser', () async { - // TODO - }); - - // Logs out current logged in user session - // - //Future logoutUser() async - test('test logoutUser', () async { - // TODO - }); - - // Updated user - // - // This can only be done by the logged in user. - // - //Future updateUser(String username, User user) async - test('test updateUser', () async { - // TODO - }); - - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_test.dart deleted file mode 100644 index b89cd360489d..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_test.dart +++ /dev/null @@ -1,62 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for User -void main() { - final instance = User(); - - group('test User', () { - // int id - test('to test the property `id`', () async { - // TODO - }); - - // String username - test('to test the property `username`', () async { - // TODO - }); - - // String firstName - test('to test the property `firstName`', () async { - // TODO - }); - - // String lastName - test('to test the property `lastName`', () async { - // TODO - }); - - // String email - test('to test the property `email`', () async { - // TODO - }); - - // String password - test('to test the property `password`', () async { - // TODO - }); - - // String phone - test('to test the property `phone`', () async { - // TODO - }); - - // User Status - // int userStatus - test('to test the property `userStatus`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.gitignore b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.gitignore index 8b7331fd822c..1be28ced0940 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.gitignore +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.gitignore @@ -1,27 +1,17 @@ -# See https://www.dartlang.org/tools/private-files.html +# See https://dart.dev/guides/libraries/private-files -# Files and directories created by pub -.buildlog +.dart_tool/ .packages -.project -.pub/ build/ -**/packages/ +pubspec.lock # Except for application packages -# Files created by dart2js -# (Most Dart developers will use pub build to compile Dart, use/modify these -# rules if you intend to use dart2js directly -# Convention is to use extension '.dart.js' for Dart compiled to Javascript to -# differentiate from explicit Javascript files) -*.dart.js -*.part.js -*.js.deps -*.js.map -*.info.json - -# Directory created by dartdoc doc/api/ -# Don't commit pubspec lock file -# (Library packages only! Remove pattern if developing an application package) -pubspec.lock +# IntelliJ +*.iml +*.ipr +*.iws +.idea/ + +# Mac +.DS_Store diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.travis.yml b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.travis.yml index 1a3af66d54c7..86197dbb22c8 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.travis.yml +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.travis.yml @@ -6,7 +6,7 @@ language: dart dart: # Install a specific stable release -- "2.2.0" +- "2.14.2" install: - pub get diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/README.md index db2f2c26eac2..faa893ff1b1e 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/README.md +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/README.md @@ -8,7 +8,7 @@ This Dart package is automatically generated by the [OpenAPI Generator](https:// ## Requirements -Dart 2.0 or later +Dart 2.14 or later ## Installation & Usage diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeApi.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeApi.md index 869c513b1f26..b22ee07386ec 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeApi.md @@ -66,7 +66,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) # **fakeHttpSignatureTest** -> fakeHttpSignatureTest(pet, query1, header1) +> Map fakeHttpSignatureTest(pet, query1, header1) test http signature authentication @@ -80,7 +80,8 @@ final query1 = query1_example; // String | query parameter final header1 = header1_example; // String | header parameter try { - api_instance.fakeHttpSignatureTest(pet, query1, header1); + final result = api_instance.fakeHttpSignatureTest(pet, query1, header1); + print(result); } catch (e) { print('Exception when calling FakeApi->fakeHttpSignatureTest: $e\n'); } @@ -96,7 +97,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -325,7 +326,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) # **testBodyWithBinary** -> testBodyWithBinary(body) +> Map testBodyWithBinary(body) @@ -339,7 +340,8 @@ final api_instance = FakeApi(); final body = MultipartFile(); // MultipartFile | image to upload try { - api_instance.testBodyWithBinary(body); + final result = api_instance.testBodyWithBinary(body); + print(result); } catch (e) { print('Exception when calling FakeApi->testBodyWithBinary: $e\n'); } @@ -353,7 +355,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -367,7 +369,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) # **testBodyWithFileSchema** -> testBodyWithFileSchema(fileSchemaTestClass) +> Map testBodyWithFileSchema(fileSchemaTestClass) @@ -381,7 +383,8 @@ final api_instance = FakeApi(); final fileSchemaTestClass = FileSchemaTestClass(); // FileSchemaTestClass | try { - api_instance.testBodyWithFileSchema(fileSchemaTestClass); + final result = api_instance.testBodyWithFileSchema(fileSchemaTestClass); + print(result); } catch (e) { print('Exception when calling FakeApi->testBodyWithFileSchema: $e\n'); } @@ -395,7 +398,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -409,7 +412,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) # **testBodyWithQueryParams** -> testBodyWithQueryParams(query, user) +> Map testBodyWithQueryParams(query, user) @@ -422,7 +425,8 @@ final query = query_example; // String | final user = User(); // User | try { - api_instance.testBodyWithQueryParams(query, user); + final result = api_instance.testBodyWithQueryParams(query, user); + print(result); } catch (e) { print('Exception when calling FakeApi->testBodyWithQueryParams: $e\n'); } @@ -437,7 +441,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -494,7 +498,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) # **testEndpointParameters** -> testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) +> Map testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -524,7 +528,8 @@ final password = password_example; // String | None final callback = callback_example; // String | None try { - api_instance.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); + final result = api_instance.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); + print(result); } catch (e) { print('Exception when calling FakeApi->testEndpointParameters: $e\n'); } @@ -551,7 +556,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -565,7 +570,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) # **testEnumParameters** -> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) +> Map testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) To test enum parameters @@ -586,7 +591,8 @@ final enumFormStringArray = []; // List | Form parameter enum test (stri final enumFormString = enumFormString_example; // String | Form parameter enum test (string) try { - api_instance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + final result = api_instance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + print(result); } catch (e) { print('Exception when calling FakeApi->testEnumParameters: $e\n'); } @@ -607,7 +613,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -621,7 +627,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) # **testGroupParameters** -> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) +> Map testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) Fake endpoint to test group parameters (optional) @@ -646,7 +652,8 @@ final booleanGroup = true; // bool | Boolean in group parameters final int64Group = 789; // int | Integer in group parameters try { - api_instance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + final result = api_instance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + print(result); } catch (e) { print('Exception when calling FakeApi->testGroupParameters: $e\n'); } @@ -665,7 +672,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -679,7 +686,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) # **testInlineAdditionalProperties** -> testInlineAdditionalProperties(requestBody) +> Map testInlineAdditionalProperties(requestBody) test inline additionalProperties @@ -691,7 +698,8 @@ final api_instance = FakeApi(); final requestBody = Map(); // Map | request body try { - api_instance.testInlineAdditionalProperties(requestBody); + final result = api_instance.testInlineAdditionalProperties(requestBody); + print(result); } catch (e) { print('Exception when calling FakeApi->testInlineAdditionalProperties: $e\n'); } @@ -705,7 +713,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -719,7 +727,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) # **testJsonFormData** -> testJsonFormData(param, param2) +> Map testJsonFormData(param, param2) test json serialization of form data @@ -732,7 +740,8 @@ final param = param_example; // String | field1 final param2 = param2_example; // String | field2 try { - api_instance.testJsonFormData(param, param2); + final result = api_instance.testJsonFormData(param, param2); + print(result); } catch (e) { print('Exception when calling FakeApi->testJsonFormData: $e\n'); } @@ -747,7 +756,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -761,7 +770,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) # **testQueryParameterCollectionFormat** -> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) +> Map testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) @@ -781,7 +790,8 @@ final allowEmpty = allowEmpty_example; // String | final language = ; // Map | try { - api_instance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); + final result = api_instance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); + print(result); } catch (e) { print('Exception when calling FakeApi->testQueryParameterCollectionFormat: $e\n'); } @@ -801,7 +811,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/NullableClass.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/NullableClass.md index 9b2e46df0a09..a3fff4ca709c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/NullableClass.md +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/NullableClass.md @@ -14,12 +14,12 @@ Name | Type | Description | Notes **stringProp** | **String** | | [optional] **dateProp** | [**DateTime**](DateTime.md) | | [optional] **datetimeProp** | [**DateTime**](DateTime.md) | | [optional] -**arrayNullableProp** | [**List**](Object.md) | | [optional] [default to const []] -**arrayAndItemsNullableProp** | [**List**](Object.md) | | [optional] [default to const []] -**arrayItemsNullable** | [**List**](Object.md) | | [optional] [default to const []] -**objectNullableProp** | [**Map**](Object.md) | | [optional] [default to const {}] -**objectAndItemsNullableProp** | [**Map**](Object.md) | | [optional] [default to const {}] -**objectItemsNullable** | [**Map**](Object.md) | | [optional] [default to const {}] +**arrayNullableProp** | **List>** | | [optional] [default to const []] +**arrayAndItemsNullableProp** | **List>** | | [optional] [default to const []] +**arrayItemsNullable** | **List>** | | [optional] [default to const []] +**objectNullableProp** | **Map** | | [optional] [default to const {}] +**objectAndItemsNullableProp** | **Map** | | [optional] [default to const {}] +**objectItemsNullable** | **Map** | | [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/dart2/petstore_json_serializable_client_lib_fake/doc/PetApi.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/PetApi.md index 387717e3f917..f6452b7bfc9a 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/PetApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/PetApi.md @@ -21,7 +21,7 @@ Method | HTTP request | Description # **addPet** -> addPet(pet) +> Map addPet(pet) Add a new pet to the store @@ -35,7 +35,8 @@ final api_instance = PetApi(); final pet = Pet(); // Pet | Pet object that needs to be added to the store try { - api_instance.addPet(pet); + final result = api_instance.addPet(pet); + print(result); } catch (e) { print('Exception when calling PetApi->addPet: $e\n'); } @@ -49,7 +50,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -63,7 +64,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) # **deletePet** -> deletePet(petId, apiKey) +> Map deletePet(petId, apiKey) Deletes a pet @@ -78,7 +79,8 @@ final petId = 789; // int | Pet id to delete final apiKey = apiKey_example; // String | try { - api_instance.deletePet(petId, apiKey); + final result = api_instance.deletePet(petId, apiKey); + print(result); } catch (e) { print('Exception when calling PetApi->deletePet: $e\n'); } @@ -93,7 +95,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -244,7 +246,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) # **updatePet** -> updatePet(pet) +> Map updatePet(pet) Update an existing pet @@ -258,7 +260,8 @@ final api_instance = PetApi(); final pet = Pet(); // Pet | Pet object that needs to be added to the store try { - api_instance.updatePet(pet); + final result = api_instance.updatePet(pet); + print(result); } catch (e) { print('Exception when calling PetApi->updatePet: $e\n'); } @@ -272,7 +275,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -286,7 +289,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) # **updatePetWithForm** -> updatePetWithForm(petId, name, status) +> Map updatePetWithForm(petId, name, status) Updates a pet in the store with form data @@ -302,7 +305,8 @@ final name = name_example; // String | Updated name of the pet final status = status_example; // String | Updated status of the pet try { - api_instance.updatePetWithForm(petId, name, status); + final result = api_instance.updatePetWithForm(petId, name, status); + print(result); } catch (e) { print('Exception when calling PetApi->updatePetWithForm: $e\n'); } @@ -318,7 +322,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/StoreApi.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/StoreApi.md index f43230375e7b..b573d982109a 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/StoreApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/StoreApi.md @@ -16,7 +16,7 @@ Method | HTTP request | Description # **deleteOrder** -> deleteOrder(orderId) +> Map deleteOrder(orderId) Delete purchase order by ID @@ -30,7 +30,8 @@ final api_instance = StoreApi(); final orderId = orderId_example; // String | ID of the order that needs to be deleted try { - api_instance.deleteOrder(orderId); + final result = api_instance.deleteOrder(orderId); + print(result); } catch (e) { print('Exception when calling StoreApi->deleteOrder: $e\n'); } @@ -44,7 +45,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/UserApi.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/UserApi.md index f318f92ccefd..909b184c1a0c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/UserApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/UserApi.md @@ -20,7 +20,7 @@ Method | HTTP request | Description # **createUser** -> createUser(user) +> Map createUser(user) Create user @@ -34,7 +34,8 @@ final api_instance = UserApi(); final user = User(); // User | Created user object try { - api_instance.createUser(user); + final result = api_instance.createUser(user); + print(result); } catch (e) { print('Exception when calling UserApi->createUser: $e\n'); } @@ -48,7 +49,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -62,7 +63,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) # **createUsersWithArrayInput** -> createUsersWithArrayInput(user) +> Map createUsersWithArrayInput(user) Creates list of users with given input array @@ -74,7 +75,8 @@ final api_instance = UserApi(); final user = [List()]; // List | List of user object try { - api_instance.createUsersWithArrayInput(user); + final result = api_instance.createUsersWithArrayInput(user); + print(result); } catch (e) { print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); } @@ -88,7 +90,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -102,7 +104,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) # **createUsersWithListInput** -> createUsersWithListInput(user) +> Map createUsersWithListInput(user) Creates list of users with given input array @@ -114,7 +116,8 @@ final api_instance = UserApi(); final user = [List()]; // List | List of user object try { - api_instance.createUsersWithListInput(user); + final result = api_instance.createUsersWithListInput(user); + print(result); } catch (e) { print('Exception when calling UserApi->createUsersWithListInput: $e\n'); } @@ -128,7 +131,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -142,7 +145,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) # **deleteUser** -> deleteUser(username) +> Map deleteUser(username) Delete user @@ -156,7 +159,8 @@ final api_instance = UserApi(); final username = username_example; // String | The name that needs to be deleted try { - api_instance.deleteUser(username); + final result = api_instance.deleteUser(username); + print(result); } catch (e) { print('Exception when calling UserApi->deleteUser: $e\n'); } @@ -170,7 +174,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization @@ -268,7 +272,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) # **logoutUser** -> logoutUser() +> Map logoutUser() Logs out current logged in user session @@ -279,7 +283,8 @@ import 'package:openapi/api.dart'; final api_instance = UserApi(); try { - api_instance.logoutUser(); + final result = api_instance.logoutUser(); + print(result); } catch (e) { print('Exception when calling UserApi->logoutUser: $e\n'); } @@ -290,7 +295,7 @@ This endpoint does not need any parameter. ### Return type -void (empty response body) +**Map** ### Authorization @@ -304,7 +309,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) # **updateUser** -> updateUser(username, user) +> Map updateUser(username, user) Updated user @@ -319,7 +324,8 @@ final username = username_example; // String | name that need to be deleted final user = User(); // User | Updated user object try { - api_instance.updateUser(username, user); + final result = api_instance.updateUser(username, user); + print(result); } catch (e) { print('Exception when calling UserApi->updateUser: $e\n'); } @@ -334,7 +340,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +**Map** ### Authorization diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api.dart index 920f26ddc57d..592fecd1c906 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/another_fake_api.dart index 2295e5df8ad7..3bad820de469 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/another_fake_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/another_fake_api.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -12,7 +12,7 @@ part of openapi.api; class AnotherFakeApi { - AnotherFakeApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + AnotherFakeApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; @@ -27,16 +27,11 @@ class AnotherFakeApi { /// * [ModelClient] modelClient (required): /// client model Future call123testSpecialTagsWithHttpInfo(ModelClient modelClient,) async { - // Verify required params are set. - if (modelClient == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: modelClient'); - } - // ignore: prefer_const_declarations final path = r'/another-fake/dummy'; // ignore: prefer_final_locals - Object postBody = modelClient; + Object? postBody = modelClient; final queryParams = []; final headerParams = {}; @@ -66,7 +61,7 @@ class AnotherFakeApi { /// /// * [ModelClient] modelClient (required): /// client model - Future call123testSpecialTags(ModelClient modelClient,) async { + Future call123testSpecialTags(ModelClient modelClient,) async { final response = await call123testSpecialTagsWithHttpInfo(modelClient,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -74,10 +69,9 @@ class AnotherFakeApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return ModelClient.fromJson(json.decode(response.body)); } - return Future.value(); } } diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/default_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/default_api.dart index 8f485dacf175..40753875d970 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/default_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/default_api.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -12,7 +12,7 @@ part of openapi.api; class DefaultApi { - DefaultApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + DefaultApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; @@ -22,7 +22,7 @@ class DefaultApi { final path = r'/foo'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -44,7 +44,7 @@ class DefaultApi { ); } - Future fooGet() async { + Future fooGet() async { final response = await fooGetWithHttpInfo(); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -52,10 +52,9 @@ class DefaultApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return InlineResponseDefault.fromJson(json.decode(response.body)); } - return Future.value(); } } diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_api.dart index 05fedc622a29..f87ac09abe2d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_api.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -12,7 +12,7 @@ part of openapi.api; class FakeApi { - FakeApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + FakeApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; @@ -24,7 +24,7 @@ class FakeApi { final path = r'/fake/health'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -47,7 +47,7 @@ class FakeApi { } /// Health check endpoint - Future fakeHealthGet() async { + Future fakeHealthGet() async { final response = await fakeHealthGetWithHttpInfo(); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -55,11 +55,10 @@ class FakeApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return HealthCheckResult.fromJson(json.decode(response.body)); } - return Future.value(); } /// test http signature authentication @@ -76,17 +75,12 @@ class FakeApi { /// /// * [String] header1: /// header parameter - Future fakeHttpSignatureTestWithHttpInfo(Pet pet, { String query1, String header1, }) async { - // Verify required params are set. - if (pet == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: pet'); - } - + Future fakeHttpSignatureTestWithHttpInfo(Pet pet, { String? query1, String? header1, }) async { // ignore: prefer_const_declarations final path = r'/fake/http-signature-test'; // ignore: prefer_final_locals - Object postBody = pet; + Object? postBody = pet; final queryParams = []; final headerParams = {}; @@ -128,11 +122,18 @@ class FakeApi { /// /// * [String] header1: /// header parameter - Future fakeHttpSignatureTest(Pet pet, { String query1, String header1, }) async { + Future?> fakeHttpSignatureTest(Pet pet, { String? query1, String? header1, }) async { final response = await fakeHttpSignatureTestWithHttpInfo(pet, query1: query1, header1: header1, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + + return response.body as Map; + } } /// Test serialization of outer boolean types @@ -143,14 +144,12 @@ class FakeApi { /// /// * [bool] body: /// Input boolean as post body - Future fakeOuterBooleanSerializeWithHttpInfo({ bool body, }) async { - // Verify required params are set. - + Future fakeOuterBooleanSerializeWithHttpInfo({ bool? body, }) async { // ignore: prefer_const_declarations final path = r'/fake/outer/boolean'; // ignore: prefer_final_locals - Object postBody = body; + Object? postBody = body; final queryParams = []; final headerParams = {}; @@ -178,7 +177,7 @@ class FakeApi { /// /// * [bool] body: /// Input boolean as post body - Future fakeOuterBooleanSerialize({ bool body, }) async { + Future fakeOuterBooleanSerialize({ bool? body, }) async { final response = await fakeOuterBooleanSerializeWithHttpInfo( body: body, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -186,11 +185,10 @@ class FakeApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return response.body as bool; } - return Future.value(); } /// Test serialization of object with outer number type @@ -201,14 +199,12 @@ class FakeApi { /// /// * [OuterComposite] outerComposite: /// Input composite as post body - Future fakeOuterCompositeSerializeWithHttpInfo({ OuterComposite outerComposite, }) async { - // Verify required params are set. - + Future fakeOuterCompositeSerializeWithHttpInfo({ OuterComposite? outerComposite, }) async { // ignore: prefer_const_declarations final path = r'/fake/outer/composite'; // ignore: prefer_final_locals - Object postBody = outerComposite; + Object? postBody = outerComposite; final queryParams = []; final headerParams = {}; @@ -236,7 +232,7 @@ class FakeApi { /// /// * [OuterComposite] outerComposite: /// Input composite as post body - Future fakeOuterCompositeSerialize({ OuterComposite outerComposite, }) async { + Future fakeOuterCompositeSerialize({ OuterComposite? outerComposite, }) async { final response = await fakeOuterCompositeSerializeWithHttpInfo( outerComposite: outerComposite, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -244,11 +240,10 @@ class FakeApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return OuterComposite.fromJson(json.decode(response.body)); } - return Future.value(); } /// Test serialization of outer number types @@ -259,14 +254,12 @@ class FakeApi { /// /// * [num] body: /// Input number as post body - Future fakeOuterNumberSerializeWithHttpInfo({ num body, }) async { - // Verify required params are set. - + Future fakeOuterNumberSerializeWithHttpInfo({ num? body, }) async { // ignore: prefer_const_declarations final path = r'/fake/outer/number'; // ignore: prefer_final_locals - Object postBody = body; + Object? postBody = body; final queryParams = []; final headerParams = {}; @@ -294,7 +287,7 @@ class FakeApi { /// /// * [num] body: /// Input number as post body - Future fakeOuterNumberSerialize({ num body, }) async { + Future fakeOuterNumberSerialize({ num? body, }) async { final response = await fakeOuterNumberSerializeWithHttpInfo( body: body, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -302,11 +295,10 @@ class FakeApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return response.body as num; } - return Future.value(); } /// Test serialization of outer string types @@ -317,14 +309,12 @@ class FakeApi { /// /// * [String] body: /// Input string as post body - Future fakeOuterStringSerializeWithHttpInfo({ String body, }) async { - // Verify required params are set. - + Future fakeOuterStringSerializeWithHttpInfo({ String? body, }) async { // ignore: prefer_const_declarations final path = r'/fake/outer/string'; // ignore: prefer_final_locals - Object postBody = body; + Object? postBody = body; final queryParams = []; final headerParams = {}; @@ -352,7 +342,7 @@ class FakeApi { /// /// * [String] body: /// Input string as post body - Future fakeOuterStringSerialize({ String body, }) async { + Future fakeOuterStringSerialize({ String? body, }) async { final response = await fakeOuterStringSerializeWithHttpInfo( body: body, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -360,11 +350,10 @@ class FakeApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return response.body as String; } - return Future.value(); } /// Test serialization of enum (int) properties with examples @@ -376,16 +365,11 @@ class FakeApi { /// * [OuterObjectWithEnumProperty] outerObjectWithEnumProperty (required): /// Input enum (int) as post body Future fakePropertyEnumIntegerSerializeWithHttpInfo(OuterObjectWithEnumProperty outerObjectWithEnumProperty,) async { - // Verify required params are set. - if (outerObjectWithEnumProperty == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: outerObjectWithEnumProperty'); - } - // ignore: prefer_const_declarations final path = r'/fake/property/enum-int'; // ignore: prefer_final_locals - Object postBody = outerObjectWithEnumProperty; + Object? postBody = outerObjectWithEnumProperty; final queryParams = []; final headerParams = {}; @@ -413,7 +397,7 @@ class FakeApi { /// /// * [OuterObjectWithEnumProperty] outerObjectWithEnumProperty (required): /// Input enum (int) as post body - Future fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty,) async { + Future fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty,) async { final response = await fakePropertyEnumIntegerSerializeWithHttpInfo(outerObjectWithEnumProperty,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -421,11 +405,10 @@ class FakeApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return OuterObjectWithEnumProperty.fromJson(json.decode(response.body)); } - return Future.value(); } /// For this test, the body has to be a binary file. @@ -437,16 +420,11 @@ class FakeApi { /// * [MultipartFile] body (required): /// image to upload Future testBodyWithBinaryWithHttpInfo(MultipartFile body,) async { - // Verify required params are set. - if (body == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: body'); - } - // ignore: prefer_const_declarations final path = r'/fake/body-with-binary'; // ignore: prefer_final_locals - Object postBody = body; + Object? postBody = body; final queryParams = []; final headerParams = {}; @@ -474,11 +452,18 @@ class FakeApi { /// /// * [MultipartFile] body (required): /// image to upload - Future testBodyWithBinary(MultipartFile body,) async { + Future?> testBodyWithBinary(MultipartFile body,) async { final response = await testBodyWithBinaryWithHttpInfo(body,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + + return response.body as Map; + } } /// For this test, the body for this request must reference a schema named `File`. @@ -489,16 +474,11 @@ class FakeApi { /// /// * [FileSchemaTestClass] fileSchemaTestClass (required): Future testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass,) async { - // Verify required params are set. - if (fileSchemaTestClass == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: fileSchemaTestClass'); - } - // ignore: prefer_const_declarations final path = r'/fake/body-with-file-schema'; // ignore: prefer_final_locals - Object postBody = fileSchemaTestClass; + Object? postBody = fileSchemaTestClass; final queryParams = []; final headerParams = {}; @@ -525,11 +505,18 @@ class FakeApi { /// Parameters: /// /// * [FileSchemaTestClass] fileSchemaTestClass (required): - Future testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass,) async { + Future?> testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass,) async { final response = await testBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + + return response.body as Map; + } } /// Performs an HTTP 'PUT /fake/body-with-query-params' operation and returns the [Response]. @@ -539,19 +526,11 @@ class FakeApi { /// /// * [User] user (required): Future testBodyWithQueryParamsWithHttpInfo(String query, User user,) async { - // Verify required params are set. - if (query == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: query'); - } - if (user == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); - } - // ignore: prefer_const_declarations final path = r'/fake/body-with-query-params'; // ignore: prefer_final_locals - Object postBody = user; + Object? postBody = user; final queryParams = []; final headerParams = {}; @@ -580,11 +559,18 @@ class FakeApi { /// * [String] query (required): /// /// * [User] user (required): - Future testBodyWithQueryParams(String query, User user,) async { + Future?> testBodyWithQueryParams(String query, User user,) async { final response = await testBodyWithQueryParamsWithHttpInfo(query, user,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + + return response.body as Map; + } } /// To test \"client\" model @@ -598,16 +584,11 @@ class FakeApi { /// * [ModelClient] modelClient (required): /// client model Future testClientModelWithHttpInfo(ModelClient modelClient,) async { - // Verify required params are set. - if (modelClient == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: modelClient'); - } - // ignore: prefer_const_declarations final path = r'/fake'; // ignore: prefer_final_locals - Object postBody = modelClient; + Object? postBody = modelClient; final queryParams = []; final headerParams = {}; @@ -637,7 +618,7 @@ class FakeApi { /// /// * [ModelClient] modelClient (required): /// client model - Future testClientModel(ModelClient modelClient,) async { + Future testClientModel(ModelClient modelClient,) async { final response = await testClientModelWithHttpInfo(modelClient,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -645,11 +626,10 @@ class FakeApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return ModelClient.fromJson(json.decode(response.body)); } - return Future.value(); } /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -701,26 +681,12 @@ class FakeApi { /// /// * [String] callback: /// None - Future testEndpointParametersWithHttpInfo(num number, double double_, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback, }) async { - // Verify required params are set. - if (number == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: number'); - } - if (double_ == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: double_'); - } - if (patternWithoutDelimiter == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: patternWithoutDelimiter'); - } - if (byte == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: byte'); - } - + Future testEndpointParametersWithHttpInfo(num number, double double_, String patternWithoutDelimiter, String byte, { int? integer, int? int32, int? int64, double? float, String? string, MultipartFile? binary, DateTime? date, DateTime? dateTime, String? password, String? callback, }) async { // ignore: prefer_const_declarations final path = r'/fake'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -828,11 +794,18 @@ class FakeApi { /// /// * [String] callback: /// None - Future testEndpointParameters(num number, double double_, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback, }) async { + Future?> testEndpointParameters(num number, double double_, String patternWithoutDelimiter, String byte, { int? integer, int? int32, int? int64, double? float, String? string, MultipartFile? binary, DateTime? date, DateTime? dateTime, String? password, String? callback, }) async { final response = await testEndpointParametersWithHttpInfo(number, double_, patternWithoutDelimiter, byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + + return response.body as Map; + } } /// To test enum parameters @@ -866,14 +839,12 @@ class FakeApi { /// /// * [String] enumFormString: /// Form parameter enum test (string) - Future testEnumParametersWithHttpInfo({ List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, List enumFormStringArray, String enumFormString, }) async { - // Verify required params are set. - + Future testEnumParametersWithHttpInfo({ List? enumHeaderStringArray, String? enumHeaderString, List? enumQueryStringArray, String? enumQueryString, int? enumQueryInteger, double? enumQueryDouble, List? enumFormStringArray, String? enumFormString, }) async { // ignore: prefer_const_declarations final path = r'/fake'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -950,11 +921,18 @@ class FakeApi { /// /// * [String] enumFormString: /// Form parameter enum test (string) - Future testEnumParameters({ List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, List enumFormStringArray, String enumFormString, }) async { + Future?> testEnumParameters({ List? enumHeaderStringArray, String? enumHeaderString, List? enumQueryStringArray, String? enumQueryString, int? enumQueryInteger, double? enumQueryDouble, List? enumFormStringArray, String? enumFormString, }) async { final response = await testEnumParametersWithHttpInfo( enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + + return response.body as Map; + } } /// Fake endpoint to test group parameters (optional) @@ -982,23 +960,12 @@ class FakeApi { /// /// * [int] int64Group: /// Integer in group parameters - Future testGroupParametersWithHttpInfo(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int stringGroup, bool booleanGroup, int int64Group, }) async { - // Verify required params are set. - if (requiredStringGroup == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: requiredStringGroup'); - } - if (requiredBooleanGroup == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: requiredBooleanGroup'); - } - if (requiredInt64Group == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: requiredInt64Group'); - } - + Future testGroupParametersWithHttpInfo(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int? stringGroup, bool? booleanGroup, int? int64Group, }) async { // ignore: prefer_const_declarations final path = r'/fake'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -1057,11 +1024,18 @@ class FakeApi { /// /// * [int] int64Group: /// Integer in group parameters - Future testGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int stringGroup, bool booleanGroup, int int64Group, }) async { + Future?> testGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int? stringGroup, bool? booleanGroup, int? int64Group, }) async { final response = await testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + + return response.body as Map; + } } /// test inline additionalProperties @@ -1073,16 +1047,11 @@ class FakeApi { /// * [Map] requestBody (required): /// request body Future testInlineAdditionalPropertiesWithHttpInfo(Map requestBody,) async { - // Verify required params are set. - if (requestBody == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: requestBody'); - } - // ignore: prefer_const_declarations final path = r'/fake/inline-additionalProperties'; // ignore: prefer_final_locals - Object postBody = requestBody; + Object? postBody = requestBody; final queryParams = []; final headerParams = {}; @@ -1110,11 +1079,18 @@ class FakeApi { /// /// * [Map] requestBody (required): /// request body - Future testInlineAdditionalProperties(Map requestBody,) async { + Future?> testInlineAdditionalProperties(Map requestBody,) async { final response = await testInlineAdditionalPropertiesWithHttpInfo(requestBody,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + + return response.body as Map; + } } /// test json serialization of form data @@ -1129,19 +1105,11 @@ class FakeApi { /// * [String] param2 (required): /// field2 Future testJsonFormDataWithHttpInfo(String param, String param2,) async { - // Verify required params are set. - if (param == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: param'); - } - if (param2 == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: param2'); - } - // ignore: prefer_const_declarations final path = r'/fake/jsonFormData'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -1178,11 +1146,18 @@ class FakeApi { /// /// * [String] param2 (required): /// field2 - Future testJsonFormData(String param, String param2,) async { + Future?> testJsonFormData(String param, String param2,) async { final response = await testJsonFormDataWithHttpInfo(param, param2,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + + return response.body as Map; + } } /// To test the collection format in query parameters @@ -1204,32 +1179,12 @@ class FakeApi { /// * [String] allowEmpty (required): /// /// * [Map] language: - Future testQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, String allowEmpty, { Map language, }) async { - // Verify required params are set. - if (pipe == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: pipe'); - } - if (ioutil == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: ioutil'); - } - if (http == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: http'); - } - if (url == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: url'); - } - if (context == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: context'); - } - if (allowEmpty == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: allowEmpty'); - } - + Future testQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, String allowEmpty, { Map? language, }) async { // ignore: prefer_const_declarations final path = r'/fake/test-query-parameters'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -1278,10 +1233,17 @@ class FakeApi { /// * [String] allowEmpty (required): /// /// * [Map] language: - Future testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, String allowEmpty, { Map language, }) async { + Future?> testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, String allowEmpty, { Map? language, }) async { final response = await testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, allowEmpty, language: language, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + + return response.body as Map; + } } } diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_classname_tags123_api.dart index 42639bc346e9..6d7cacc38703 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_classname_tags123_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_classname_tags123_api.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -12,7 +12,7 @@ part of openapi.api; class FakeClassnameTags123Api { - FakeClassnameTags123Api([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + FakeClassnameTags123Api([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; @@ -27,16 +27,11 @@ class FakeClassnameTags123Api { /// * [ModelClient] modelClient (required): /// client model Future testClassnameWithHttpInfo(ModelClient modelClient,) async { - // Verify required params are set. - if (modelClient == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: modelClient'); - } - // ignore: prefer_const_declarations final path = r'/fake_classname_test'; // ignore: prefer_final_locals - Object postBody = modelClient; + Object? postBody = modelClient; final queryParams = []; final headerParams = {}; @@ -66,7 +61,7 @@ class FakeClassnameTags123Api { /// /// * [ModelClient] modelClient (required): /// client model - Future testClassname(ModelClient modelClient,) async { + Future testClassname(ModelClient modelClient,) async { final response = await testClassnameWithHttpInfo(modelClient,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -74,10 +69,9 @@ class FakeClassnameTags123Api { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return ModelClient.fromJson(json.decode(response.body)); } - return Future.value(); } } diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/pet_api.dart index 398fd5762245..e3519d1e6795 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/pet_api.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -12,7 +12,7 @@ part of openapi.api; class PetApi { - PetApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + PetApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; @@ -25,16 +25,11 @@ class PetApi { /// * [Pet] pet (required): /// Pet object that needs to be added to the store Future addPetWithHttpInfo(Pet pet,) async { - // Verify required params are set. - if (pet == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: pet'); - } - // ignore: prefer_const_declarations final path = r'/pet'; // ignore: prefer_final_locals - Object postBody = pet; + Object? postBody = pet; final queryParams = []; final headerParams = {}; @@ -62,11 +57,18 @@ class PetApi { /// /// * [Pet] pet (required): /// Pet object that needs to be added to the store - Future addPet(Pet pet,) async { + Future?> addPet(Pet pet,) async { final response = await addPetWithHttpInfo(pet,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + + return response.body as Map; + } } /// Deletes a pet @@ -79,18 +81,13 @@ class PetApi { /// Pet id to delete /// /// * [String] apiKey: - Future deletePetWithHttpInfo(int petId, { String apiKey, }) async { - // Verify required params are set. - if (petId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); - } - + Future deletePetWithHttpInfo(int petId, { String? apiKey, }) async { // ignore: prefer_const_declarations final path = r'/pet/{petId}' .replaceAll('{petId}', petId.toString()); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -124,11 +121,18 @@ class PetApi { /// Pet id to delete /// /// * [String] apiKey: - Future deletePet(int petId, { String apiKey, }) async { + Future?> deletePet(int petId, { String? apiKey, }) async { final response = await deletePetWithHttpInfo(petId, apiKey: apiKey, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + + return response.body as Map; + } } /// Finds Pets by status @@ -142,16 +146,11 @@ class PetApi { /// * [List] status (required): /// Status values that need to be considered for filter Future findPetsByStatusWithHttpInfo(List status,) async { - // Verify required params are set. - if (status == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: status'); - } - // ignore: prefer_const_declarations final path = r'/pet/findByStatus'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -183,7 +182,7 @@ class PetApi { /// /// * [List] status (required): /// Status values that need to be considered for filter - Future> findPetsByStatus(List status,) async { + Future?> findPetsByStatus(List status,) async { final response = await findPetsByStatusWithHttpInfo(status,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -191,13 +190,12 @@ class PetApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return (json.decode(response.body) as List) .map((i) => Pet.fromJson(i)) .toList(); } - return Future>.value(); } /// Finds Pets by tags @@ -211,16 +209,11 @@ class PetApi { /// * [Set] tags (required): /// Tags to filter by Future findPetsByTagsWithHttpInfo(Set tags,) async { - // Verify required params are set. - if (tags == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: tags'); - } - // ignore: prefer_const_declarations final path = r'/pet/findByTags'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -252,7 +245,7 @@ class PetApi { /// /// * [Set] tags (required): /// Tags to filter by - Future> findPetsByTags(Set tags,) async { + Future?> findPetsByTags(Set tags,) async { final response = await findPetsByTagsWithHttpInfo(tags,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -260,13 +253,12 @@ class PetApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return (json.decode(response.body) as List) .map((i) => Pet.fromJson(i)) .toSet(); } - return Future>.value(); } /// Find pet by ID @@ -280,17 +272,12 @@ class PetApi { /// * [int] petId (required): /// ID of pet to return Future getPetByIdWithHttpInfo(int petId,) async { - // Verify required params are set. - if (petId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); - } - // ignore: prefer_const_declarations final path = r'/pet/{petId}' .replaceAll('{petId}', petId.toString()); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -320,7 +307,7 @@ class PetApi { /// /// * [int] petId (required): /// ID of pet to return - Future getPetById(int petId,) async { + Future getPetById(int petId,) async { final response = await getPetByIdWithHttpInfo(petId,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -328,11 +315,10 @@ class PetApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return Pet.fromJson(json.decode(response.body)); } - return Future.value(); } /// Update an existing pet @@ -344,16 +330,11 @@ class PetApi { /// * [Pet] pet (required): /// Pet object that needs to be added to the store Future updatePetWithHttpInfo(Pet pet,) async { - // Verify required params are set. - if (pet == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: pet'); - } - // ignore: prefer_const_declarations final path = r'/pet'; // ignore: prefer_final_locals - Object postBody = pet; + Object? postBody = pet; final queryParams = []; final headerParams = {}; @@ -381,11 +362,18 @@ class PetApi { /// /// * [Pet] pet (required): /// Pet object that needs to be added to the store - Future updatePet(Pet pet,) async { + Future?> updatePet(Pet pet,) async { final response = await updatePetWithHttpInfo(pet,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + + return response.body as Map; + } } /// Updates a pet in the store with form data @@ -402,18 +390,13 @@ class PetApi { /// /// * [String] status: /// Updated status of the pet - Future updatePetWithFormWithHttpInfo(int petId, { String name, String status, }) async { - // Verify required params are set. - if (petId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); - } - + Future updatePetWithFormWithHttpInfo(int petId, { String? name, String? status, }) async { // ignore: prefer_const_declarations final path = r'/pet/{petId}' .replaceAll('{petId}', petId.toString()); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -453,11 +436,18 @@ class PetApi { /// /// * [String] status: /// Updated status of the pet - Future updatePetWithForm(int petId, { String name, String status, }) async { + Future?> updatePetWithForm(int petId, { String? name, String? status, }) async { final response = await updatePetWithFormWithHttpInfo(petId, name: name, status: status, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + + return response.body as Map; + } } /// uploads an image @@ -474,18 +464,13 @@ class PetApi { /// /// * [MultipartFile] file: /// file to upload - Future uploadFileWithHttpInfo(int petId, { String additionalMetadata, MultipartFile file, }) async { - // Verify required params are set. - if (petId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); - } - + Future uploadFileWithHttpInfo(int petId, { String? additionalMetadata, MultipartFile? file, }) async { // ignore: prefer_const_declarations final path = r'/pet/{petId}/uploadImage' .replaceAll('{petId}', petId.toString()); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -533,7 +518,7 @@ class PetApi { /// /// * [MultipartFile] file: /// file to upload - Future uploadFile(int petId, { String additionalMetadata, MultipartFile file, }) async { + Future uploadFile(int petId, { String? additionalMetadata, MultipartFile? file, }) async { final response = await uploadFileWithHttpInfo(petId, additionalMetadata: additionalMetadata, file: file, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -541,11 +526,10 @@ class PetApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return ApiResponse.fromJson(json.decode(response.body)); } - return Future.value(); } /// uploads an image (required) @@ -562,21 +546,13 @@ class PetApi { /// /// * [String] additionalMetadata: /// Additional data to pass to server - Future uploadFileWithRequiredFileWithHttpInfo(int petId, MultipartFile requiredFile, { String additionalMetadata, }) async { - // Verify required params are set. - if (petId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); - } - if (requiredFile == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: requiredFile'); - } - + Future uploadFileWithRequiredFileWithHttpInfo(int petId, MultipartFile requiredFile, { String? additionalMetadata, }) async { // ignore: prefer_const_declarations final path = r'/fake/{petId}/uploadImageWithRequiredFile' .replaceAll('{petId}', petId.toString()); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -624,7 +600,7 @@ class PetApi { /// /// * [String] additionalMetadata: /// Additional data to pass to server - Future uploadFileWithRequiredFile(int petId, MultipartFile requiredFile, { String additionalMetadata, }) async { + Future uploadFileWithRequiredFile(int petId, MultipartFile requiredFile, { String? additionalMetadata, }) async { final response = await uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata: additionalMetadata, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -632,10 +608,9 @@ class PetApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return ApiResponse.fromJson(json.decode(response.body)); } - return Future.value(); } } diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/store_api.dart index 9b60b28a7e57..822d2165653c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/store_api.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -12,7 +12,7 @@ part of openapi.api; class StoreApi { - StoreApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + StoreApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; @@ -27,17 +27,12 @@ class StoreApi { /// * [String] orderId (required): /// ID of the order that needs to be deleted Future deleteOrderWithHttpInfo(String orderId,) async { - // Verify required params are set. - if (orderId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: orderId'); - } - // ignore: prefer_const_declarations final path = r'/store/order/{order_id}' .replaceAll('{order_id}', orderId); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -67,11 +62,18 @@ class StoreApi { /// /// * [String] orderId (required): /// ID of the order that needs to be deleted - Future deleteOrder(String orderId,) async { + Future?> deleteOrder(String orderId,) async { final response = await deleteOrderWithHttpInfo(orderId,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + + return response.body as Map; + } } /// Returns pet inventories by status @@ -84,7 +86,7 @@ class StoreApi { final path = r'/store/inventory'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -109,7 +111,7 @@ class StoreApi { /// Returns pet inventories by status /// /// Returns a map of status codes to quantities - Future> getInventory() async { + Future?> getInventory() async { final response = await getInventoryWithHttpInfo(); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -117,11 +119,10 @@ class StoreApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return Map.from(json.decode(response.body)); } - return Future>.value(); } /// Find purchase order by ID @@ -135,17 +136,12 @@ class StoreApi { /// * [int] orderId (required): /// ID of pet that needs to be fetched Future getOrderByIdWithHttpInfo(int orderId,) async { - // Verify required params are set. - if (orderId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: orderId'); - } - // ignore: prefer_const_declarations final path = r'/store/order/{order_id}' .replaceAll('{order_id}', orderId.toString()); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -175,7 +171,7 @@ class StoreApi { /// /// * [int] orderId (required): /// ID of pet that needs to be fetched - Future getOrderById(int orderId,) async { + Future getOrderById(int orderId,) async { final response = await getOrderByIdWithHttpInfo(orderId,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -183,11 +179,10 @@ class StoreApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return Order.fromJson(json.decode(response.body)); } - return Future.value(); } /// Place an order for a pet @@ -199,16 +194,11 @@ class StoreApi { /// * [Order] order (required): /// order placed for purchasing the pet Future placeOrderWithHttpInfo(Order order,) async { - // Verify required params are set. - if (order == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: order'); - } - // ignore: prefer_const_declarations final path = r'/store/order'; // ignore: prefer_final_locals - Object postBody = order; + Object? postBody = order; final queryParams = []; final headerParams = {}; @@ -236,7 +226,7 @@ class StoreApi { /// /// * [Order] order (required): /// order placed for purchasing the pet - Future placeOrder(Order order,) async { + Future placeOrder(Order order,) async { final response = await placeOrderWithHttpInfo(order,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -244,10 +234,9 @@ class StoreApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return Order.fromJson(json.decode(response.body)); } - return Future.value(); } } diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/user_api.dart index 2e3e07579582..90621378e642 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/user_api.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -12,7 +12,7 @@ part of openapi.api; class UserApi { - UserApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + UserApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; @@ -27,16 +27,11 @@ class UserApi { /// * [User] user (required): /// Created user object Future createUserWithHttpInfo(User user,) async { - // Verify required params are set. - if (user == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); - } - // ignore: prefer_const_declarations final path = r'/user'; // ignore: prefer_final_locals - Object postBody = user; + Object? postBody = user; final queryParams = []; final headerParams = {}; @@ -66,11 +61,18 @@ class UserApi { /// /// * [User] user (required): /// Created user object - Future createUser(User user,) async { + Future?> createUser(User user,) async { final response = await createUserWithHttpInfo(user,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + + return response.body as Map; + } } /// Creates list of users with given input array @@ -82,16 +84,11 @@ class UserApi { /// * [List] user (required): /// List of user object Future createUsersWithArrayInputWithHttpInfo(List user,) async { - // Verify required params are set. - if (user == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); - } - // ignore: prefer_const_declarations final path = r'/user/createWithArray'; // ignore: prefer_final_locals - Object postBody = user; + Object? postBody = user; final queryParams = []; final headerParams = {}; @@ -119,11 +116,18 @@ class UserApi { /// /// * [List] user (required): /// List of user object - Future createUsersWithArrayInput(List user,) async { + Future?> createUsersWithArrayInput(List user,) async { final response = await createUsersWithArrayInputWithHttpInfo(user,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + + return response.body as Map; + } } /// Creates list of users with given input array @@ -135,16 +139,11 @@ class UserApi { /// * [List] user (required): /// List of user object Future createUsersWithListInputWithHttpInfo(List user,) async { - // Verify required params are set. - if (user == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); - } - // ignore: prefer_const_declarations final path = r'/user/createWithList'; // ignore: prefer_final_locals - Object postBody = user; + Object? postBody = user; final queryParams = []; final headerParams = {}; @@ -172,11 +171,18 @@ class UserApi { /// /// * [List] user (required): /// List of user object - Future createUsersWithListInput(List user,) async { + Future?> createUsersWithListInput(List user,) async { final response = await createUsersWithListInputWithHttpInfo(user,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + + return response.body as Map; + } } /// Delete user @@ -190,17 +196,12 @@ class UserApi { /// * [String] username (required): /// The name that needs to be deleted Future deleteUserWithHttpInfo(String username,) async { - // Verify required params are set. - if (username == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); - } - // ignore: prefer_const_declarations final path = r'/user/{username}' .replaceAll('{username}', username); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -230,11 +231,18 @@ class UserApi { /// /// * [String] username (required): /// The name that needs to be deleted - Future deleteUser(String username,) async { + Future?> deleteUser(String username,) async { final response = await deleteUserWithHttpInfo(username,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + + return response.body as Map; + } } /// Get user by user name @@ -246,17 +254,12 @@ class UserApi { /// * [String] username (required): /// The name that needs to be fetched. Use user1 for testing. Future getUserByNameWithHttpInfo(String username,) async { - // Verify required params are set. - if (username == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); - } - // ignore: prefer_const_declarations final path = r'/user/{username}' .replaceAll('{username}', username); // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -284,7 +287,7 @@ class UserApi { /// /// * [String] username (required): /// The name that needs to be fetched. Use user1 for testing. - Future getUserByName(String username,) async { + Future getUserByName(String username,) async { final response = await getUserByNameWithHttpInfo(username,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -292,11 +295,10 @@ class UserApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return User.fromJson(json.decode(response.body)); } - return Future.value(); } /// Logs user into the system @@ -311,19 +313,11 @@ class UserApi { /// * [String] password (required): /// The password for login in clear text Future loginUserWithHttpInfo(String username, String password,) async { - // Verify required params are set. - if (username == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); - } - if (password == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: password'); - } - // ignore: prefer_const_declarations final path = r'/user/login'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -357,7 +351,7 @@ class UserApi { /// /// * [String] password (required): /// The password for login in clear text - Future loginUser(String username, String password,) async { + Future loginUser(String username, String password,) async { final response = await loginUserWithHttpInfo(username, password,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -365,11 +359,10 @@ class UserApi { // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { + if (response.statusCode != HttpStatus.noContent) { return response.body as String; } - return Future.value(); } /// Logs out current logged in user session @@ -380,7 +373,7 @@ class UserApi { final path = r'/user/logout'; // ignore: prefer_final_locals - Object postBody; + Object? postBody; final queryParams = []; final headerParams = {}; @@ -403,11 +396,18 @@ class UserApi { } /// Logs out current logged in user session - Future logoutUser() async { + Future?> logoutUser() async { final response = await logoutUserWithHttpInfo(); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + + return response.body as Map; + } } /// Updated user @@ -424,20 +424,12 @@ class UserApi { /// * [User] user (required): /// Updated user object Future updateUserWithHttpInfo(String username, User user,) async { - // Verify required params are set. - if (username == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); - } - if (user == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); - } - // ignore: prefer_const_declarations final path = r'/user/{username}' .replaceAll('{username}', username); // ignore: prefer_final_locals - Object postBody = user; + Object? postBody = user; final queryParams = []; final headerParams = {}; @@ -470,10 +462,17 @@ class UserApi { /// /// * [User] user (required): /// Updated user object - Future updateUser(String username, User user,) async { + Future?> updateUser(String username, User user,) async { final response = await updateUserWithHttpInfo(username, user,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.statusCode != HttpStatus.noContent) { + + return response.body as Map; + } } } diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_client.dart index 18e47e887157..982cd0903770 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_client.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -30,12 +30,7 @@ class ApiClient { Client get client => _client; /// Requests to use a new HTTP [Client] in this class. - /// - /// If the [newClient] is null, an [ArgumentError] is thrown. set client(Client newClient) { - if (newClient == null) { - throw ArgumentError('New client instance cannot be null.'); - } _client = newClient; } @@ -52,7 +47,7 @@ class ApiClient { /// or deleted. Map get authentications => Map.unmodifiable(_authentications); - T getAuthentication(String name) { + T? getAuthentication(String name) { final authentication = _authentications[name]; return authentication is T ? authentication : null; } @@ -63,10 +58,10 @@ class ApiClient { String path, String method, List queryParams, - Object body, + Object? body, Map headerParams, Map formParams, - String nullableContentType, + String? nullableContentType, List authNames, ) async { _updateParamsForAuth(authNames, queryParams, headerParams); @@ -146,10 +141,10 @@ class ApiClient { } // ignore: deprecated_member_use_from_same_package - Future serializeAsync(Object value) async => serialize(value); + Future serializeAsync(Object? value) async => serialize(value); @Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use serializeAsync() instead.') - String serialize(Object value) => value == null ? '' : json.encode(value); + String serialize(Object? value) => value == null ? '' : json.encode(value); /// Update query and header parameters based on authentication settings. /// @param authNames The authentications to apply @@ -170,4 +165,4 @@ class ApiClient { } /// Primarily intended for use in an isolate. -Future serializeAsync(Object value) async => value == null ? '' : json.encode(value); +Future serializeAsync(Object? value) async => value == null ? '' : json.encode(value); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_exception.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_exception.dart index 8ffc340b4c9d..a01cb9f94a8c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_exception.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_exception.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,9 +16,9 @@ class ApiException implements Exception { ApiException.withInner(this.code, this.message, this.innerException, this.stackTrace); int code = 0; - String message; - Exception innerException; - StackTrace stackTrace; + String? message; + Exception? innerException; + StackTrace? stackTrace; @override String toString() { diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_helper.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_helper.dart index e2ffc78abb79..506e374fc657 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_helper.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_helper.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -14,16 +14,16 @@ class QueryParam { const QueryParam(this.name, this.value); final String name; - final String value; + final String? value; @override - String toString() => '${Uri.encodeQueryComponent(name)}=${Uri.encodeQueryComponent(value)}'; + String toString() => '${Uri.encodeQueryComponent(name)}=${Uri.encodeQueryComponent(value ?? 'null')}'; } // Ported from the Java version. Iterable _convertParametersForCollectionFormat( - String collectionFormat, - String name, + String? collectionFormat, + String? name, dynamic value, ) { final params = []; @@ -83,39 +83,27 @@ String parameterToString(dynamic value) { Future _decodeBodyBytes(Response response) async { final contentType = response.headers['content-type']; return contentType != null && contentType.toLowerCase().startsWith('application/json') - ? response.bodyBytes == null ? null : utf8.decode(response.bodyBytes) + ? utf8.decode(response.bodyBytes) : response.body; } -/// Returns a valid [T] value found at the specified Map [key], null otherwise. -T mapValueOfType(dynamic map, String key) { - final dynamic value = map is Map ? map[key] : null; - return value is T ? value : null; -} - -/// Returns a valid Map found at the specified Map [key], null otherwise. -Map mapCastOfType(dynamic map, String key) { - final dynamic value = map is Map ? map[key] : null; - return value is Map ? value.cast() : null; -} - /// Returns a valid [DateTime] found at the specified Map [key], null otherwise. -DateTime mapDateTime(dynamic map, String key, [String pattern]) { +DateTime mapDateTime(dynamic map, String key, [String? pattern]) { final dynamic value = map is Map ? map[key] : null; if (value != null) { - int millis; + int? millis; if (value is int) { millis = value; } else if (value is String) { if (pattern == _dateEpochMarker) { millis = int.tryParse(value); } else { - return DateTime.tryParse(value); + return DateTime.parse(value); } } if (millis != null) { return DateTime.fromMillisecondsSinceEpoch(millis, isUtc: true); } } - return null; + return DateTime(1970); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/api_key_auth.dart index 0c2303af09e9..abd569b5fb74 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/api_key_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/api_key_auth.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,8 +16,8 @@ class ApiKeyAuth implements Authentication { final String location; final String paramName; - String apiKeyPrefix; - String apiKey; + String? apiKeyPrefix; + String? apiKey; @override void applyToParams(List queryParams, Map headerParams) { diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/authentication.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/authentication.dart index 4257e1900069..6a5eb38902e7 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/authentication.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/authentication.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_basic_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_basic_auth.dart index 0494f402d958..cb0211bd2559 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_basic_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_basic_auth.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -11,8 +11,8 @@ part of openapi.api; class HttpBasicAuth implements Authentication { - String username; - String password; + String? username; + String? password; @override void applyToParams(List queryParams, Map headerParams) { diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_bearer_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_bearer_auth.dart index 23e243523dd8..8d2f6ddb0f89 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_bearer_auth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_bearer_auth.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/oauth.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/oauth.dart index 9299ac13f5bf..1aecb2d3e671 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/oauth.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/oauth.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -13,7 +13,7 @@ part of openapi.api; class OAuth implements Authentication { OAuth({this.accessToken}); - String accessToken; + String? accessToken; @override void applyToParams(List queryParams, Map headerParams) { diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/additional_properties_class.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/additional_properties_class.dart index de1ac810d591..0a185abc8bd8 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/additional_properties_class.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/additional_properties_class.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -23,19 +23,20 @@ class AdditionalPropertiesClass { this.mapOfMapProperty = const {}, }); + @JsonKey( defaultValue: const {}, name: r'map_property', required: false, ) - Map mapProperty; + Map? mapProperty; @JsonKey( defaultValue: const {}, name: r'map_of_map_property', required: false, ) - Map> mapOfMapProperty; + Map>? mapOfMapProperty; @override bool operator ==(Object other) => identical(this, other) || other is AdditionalPropertiesClass && @@ -44,8 +45,8 @@ class AdditionalPropertiesClass { @override int get hashCode => - (mapProperty == null ? 0 : mapProperty.hashCode) + - (mapOfMapProperty == null ? 0 : mapOfMapProperty.hashCode); + mapProperty.hashCode + + mapOfMapProperty.hashCode; factory AdditionalPropertiesClass.fromJson(Map json) => _$AdditionalPropertiesClassFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/animal.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/animal.dart index 8d4772ba251c..6064e0b57dba 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/animal.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/animal.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -19,12 +19,12 @@ part of openapi.api; class Animal { /// Returns a new [Animal] instance. Animal({ - @required this.className, + required this.className, this.color = 'red', }); + @JsonKey( - nullable: false, name: r'className', required: true, ) @@ -35,7 +35,7 @@ class Animal { name: r'color', required: false, ) - String color; + String? color; @override bool operator ==(Object other) => identical(this, other) || other is Animal && @@ -44,8 +44,8 @@ class Animal { @override int get hashCode => - (className == null ? 0 : className.hashCode) + - (color == null ? 0 : color.hashCode); + className.hashCode + + color.hashCode; factory Animal.fromJson(Map json) => _$AnimalFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/api_response.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/api_response.dart index 24516bbcb1c5..30a6b04b283b 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/api_response.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/api_response.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -24,26 +24,24 @@ class ApiResponse { this.message, }); + @JsonKey( - nullable: false, name: r'code', required: false, ) - int code; + int? code; @JsonKey( - nullable: false, name: r'type', required: false, ) - String type; + String? type; @JsonKey( - nullable: false, name: r'message', required: false, ) - String message; + String? message; @override bool operator ==(Object other) => identical(this, other) || other is ApiResponse && @@ -53,9 +51,9 @@ class ApiResponse { @override int get hashCode => - (code == null ? 0 : code.hashCode) + - (type == null ? 0 : type.hashCode) + - (message == null ? 0 : message.hashCode); + code.hashCode + + type.hashCode + + message.hashCode; factory ApiResponse.fromJson(Map json) => _$ApiResponseFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_array_of_number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_array_of_number_only.dart index 7d7d2d004eff..f04cb123cc84 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_array_of_number_only.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_array_of_number_only.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -22,12 +22,13 @@ class ArrayOfArrayOfNumberOnly { this.arrayArrayNumber = const [], }); + @JsonKey( defaultValue: const [], name: r'ArrayArrayNumber', required: false, ) - List> arrayArrayNumber; + List>? arrayArrayNumber; @override bool operator ==(Object other) => identical(this, other) || other is ArrayOfArrayOfNumberOnly && @@ -35,7 +36,7 @@ class ArrayOfArrayOfNumberOnly { @override int get hashCode => - (arrayArrayNumber == null ? 0 : arrayArrayNumber.hashCode); + arrayArrayNumber.hashCode; factory ArrayOfArrayOfNumberOnly.fromJson(Map json) => _$ArrayOfArrayOfNumberOnlyFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_number_only.dart index 27bea05339d4..82f6a83c732f 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_number_only.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_number_only.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -22,12 +22,13 @@ class ArrayOfNumberOnly { this.arrayNumber = const [], }); + @JsonKey( defaultValue: const [], name: r'ArrayNumber', required: false, ) - List arrayNumber; + List? arrayNumber; @override bool operator ==(Object other) => identical(this, other) || other is ArrayOfNumberOnly && @@ -35,7 +36,7 @@ class ArrayOfNumberOnly { @override int get hashCode => - (arrayNumber == null ? 0 : arrayNumber.hashCode); + arrayNumber.hashCode; factory ArrayOfNumberOnly.fromJson(Map json) => _$ArrayOfNumberOnlyFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_test.dart index 03656ce5fbc3..86967509970b 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_test.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -24,26 +24,27 @@ class ArrayTest { this.arrayArrayOfModel = const [], }); + @JsonKey( defaultValue: const [], name: r'array_of_string', required: false, ) - List arrayOfString; + List? arrayOfString; @JsonKey( defaultValue: const [], name: r'array_array_of_integer', required: false, ) - List> arrayArrayOfInteger; + List>? arrayArrayOfInteger; @JsonKey( defaultValue: const [], name: r'array_array_of_model', required: false, ) - List> arrayArrayOfModel; + List>? arrayArrayOfModel; @override bool operator ==(Object other) => identical(this, other) || other is ArrayTest && @@ -53,9 +54,9 @@ class ArrayTest { @override int get hashCode => - (arrayOfString == null ? 0 : arrayOfString.hashCode) + - (arrayArrayOfInteger == null ? 0 : arrayArrayOfInteger.hashCode) + - (arrayArrayOfModel == null ? 0 : arrayArrayOfModel.hashCode); + arrayOfString.hashCode + + arrayArrayOfInteger.hashCode + + arrayArrayOfModel.hashCode; factory ArrayTest.fromJson(Map json) => _$ArrayTestFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/capitalization.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/capitalization.dart index bb906c2c45e3..b365bb3eba3e 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/capitalization.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/capitalization.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -27,48 +27,43 @@ class Capitalization { this.ATT_NAME, }); + @JsonKey( - nullable: false, name: r'smallCamel', required: false, ) - String smallCamel; + String? smallCamel; @JsonKey( - nullable: false, name: r'CapitalCamel', required: false, ) - String capitalCamel; + String? capitalCamel; @JsonKey( - nullable: false, name: r'small_Snake', required: false, ) - String smallSnake; + String? smallSnake; @JsonKey( - nullable: false, name: r'Capital_Snake', required: false, ) - String capitalSnake; + String? capitalSnake; @JsonKey( - nullable: false, name: r'SCA_ETH_Flow_Points', required: false, ) - String sCAETHFlowPoints; + String? sCAETHFlowPoints; - /// Name of the pet + /// Name of the pet @JsonKey( - nullable: false, name: r'ATT_NAME', required: false, ) - String ATT_NAME; + String? ATT_NAME; @override bool operator ==(Object other) => identical(this, other) || other is Capitalization && @@ -81,12 +76,12 @@ class Capitalization { @override int get hashCode => - (smallCamel == null ? 0 : smallCamel.hashCode) + - (capitalCamel == null ? 0 : capitalCamel.hashCode) + - (smallSnake == null ? 0 : smallSnake.hashCode) + - (capitalSnake == null ? 0 : capitalSnake.hashCode) + - (sCAETHFlowPoints == null ? 0 : sCAETHFlowPoints.hashCode) + - (ATT_NAME == null ? 0 : ATT_NAME.hashCode); + smallCamel.hashCode + + capitalCamel.hashCode + + smallSnake.hashCode + + capitalSnake.hashCode + + sCAETHFlowPoints.hashCode + + ATT_NAME.hashCode; factory Capitalization.fromJson(Map json) => _$CapitalizationFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat.dart index 479cf62f2cda..fa47ef94a2d8 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -19,13 +19,13 @@ part of openapi.api; class Cat { /// Returns a new [Cat] instance. Cat({ - @required this.className, + required this.className, this.color = 'red', this.declawed, }); + @JsonKey( - nullable: false, name: r'className', required: true, ) @@ -36,14 +36,13 @@ class Cat { name: r'color', required: false, ) - String color; + String? color; @JsonKey( - nullable: false, name: r'declawed', required: false, ) - bool declawed; + bool? declawed; @override bool operator ==(Object other) => identical(this, other) || other is Cat && @@ -53,9 +52,9 @@ class Cat { @override int get hashCode => - (className == null ? 0 : className.hashCode) + - (color == null ? 0 : color.hashCode) + - (declawed == null ? 0 : declawed.hashCode); + className.hashCode + + color.hashCode + + declawed.hashCode; factory Cat.fromJson(Map json) => _$CatFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat_all_of.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat_all_of.dart index e3ca59d3b37e..4a0f45a8881a 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat_all_of.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat_all_of.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -22,12 +22,12 @@ class CatAllOf { this.declawed, }); + @JsonKey( - nullable: false, name: r'declawed', required: false, ) - bool declawed; + bool? declawed; @override bool operator ==(Object other) => identical(this, other) || other is CatAllOf && @@ -35,7 +35,7 @@ class CatAllOf { @override int get hashCode => - (declawed == null ? 0 : declawed.hashCode); + declawed.hashCode; factory CatAllOf.fromJson(Map json) => _$CatAllOfFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/category.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/category.dart index 1275e305b824..6734da0fd4d0 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/category.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/category.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -23,12 +23,12 @@ class Category { this.name = 'default-name', }); + @JsonKey( - nullable: false, name: r'id', required: false, ) - int id; + int? id; @JsonKey( defaultValue: 'default-name', @@ -44,8 +44,8 @@ class Category { @override int get hashCode => - (id == null ? 0 : id.hashCode) + - (name == null ? 0 : name.hashCode); + id.hashCode + + name.hashCode; factory Category.fromJson(Map json) => _$CategoryFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/class_model.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/class_model.dart index fc2d7534ce79..65b632fe980f 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/class_model.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/class_model.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -22,12 +22,12 @@ class ClassModel { this.class_, }); + @JsonKey( - nullable: false, name: r'_class', required: false, ) - String class_; + String? class_; @override bool operator ==(Object other) => identical(this, other) || other is ClassModel && @@ -35,7 +35,7 @@ class ClassModel { @override int get hashCode => - (class_ == null ? 0 : class_.hashCode); + class_.hashCode; factory ClassModel.fromJson(Map json) => _$ClassModelFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/deprecated_object.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/deprecated_object.dart index 945fbc85e1f3..defb7f3faca9 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/deprecated_object.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/deprecated_object.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -22,12 +22,12 @@ class DeprecatedObject { this.name, }); + @JsonKey( - nullable: false, name: r'name', required: false, ) - String name; + String? name; @override bool operator ==(Object other) => identical(this, other) || other is DeprecatedObject && @@ -35,7 +35,7 @@ class DeprecatedObject { @override int get hashCode => - (name == null ? 0 : name.hashCode); + name.hashCode; factory DeprecatedObject.fromJson(Map json) => _$DeprecatedObjectFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog.dart index 8b8d1d36a04a..ddce52b6d376 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -19,13 +19,13 @@ part of openapi.api; class Dog { /// Returns a new [Dog] instance. Dog({ - @required this.className, + required this.className, this.color = 'red', this.breed, }); + @JsonKey( - nullable: false, name: r'className', required: true, ) @@ -36,14 +36,13 @@ class Dog { name: r'color', required: false, ) - String color; + String? color; @JsonKey( - nullable: false, name: r'breed', required: false, ) - String breed; + String? breed; @override bool operator ==(Object other) => identical(this, other) || other is Dog && @@ -53,9 +52,9 @@ class Dog { @override int get hashCode => - (className == null ? 0 : className.hashCode) + - (color == null ? 0 : color.hashCode) + - (breed == null ? 0 : breed.hashCode); + className.hashCode + + color.hashCode + + breed.hashCode; factory Dog.fromJson(Map json) => _$DogFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog_all_of.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog_all_of.dart index 0a2672d908a5..c799f2231b61 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog_all_of.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog_all_of.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -22,12 +22,12 @@ class DogAllOf { this.breed, }); + @JsonKey( - nullable: false, name: r'breed', required: false, ) - String breed; + String? breed; @override bool operator ==(Object other) => identical(this, other) || other is DogAllOf && @@ -35,7 +35,7 @@ class DogAllOf { @override int get hashCode => - (breed == null ? 0 : breed.hashCode); + breed.hashCode; factory DogAllOf.fromJson(Map json) => _$DogAllOfFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_arrays.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_arrays.dart index f1eb8b7d367b..17b6601b283c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_arrays.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_arrays.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -23,19 +23,19 @@ class EnumArrays { this.arrayEnum = const [], }); + @JsonKey( - nullable: false, name: r'just_symbol', required: false, ) - EnumArraysJustSymbolEnum justSymbol; + EnumArraysJustSymbolEnum? justSymbol; @JsonKey( defaultValue: const [], name: r'array_enum', required: false, ) - List arrayEnum; + List? arrayEnum; @override bool operator ==(Object other) => identical(this, other) || other is EnumArrays && @@ -44,8 +44,8 @@ class EnumArrays { @override int get hashCode => - (justSymbol == null ? 0 : justSymbol.hashCode) + - (arrayEnum == null ? 0 : arrayEnum.hashCode); + justSymbol.hashCode + + arrayEnum.hashCode; factory EnumArrays.fromJson(Map json) => _$EnumArraysFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_class.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_class.dart index 37273211efc4..d4eea03a828d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_class.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_class.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_test.dart index 27d07a985e26..9740cb7fd060 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_test.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -20,7 +20,7 @@ class EnumTest { /// Returns a new [EnumTest] instance. EnumTest({ this.enumString, - @required this.enumStringRequired, + required this.enumStringRequired, this.enumInteger, this.enumNumber, this.outerEnum, @@ -29,61 +29,54 @@ class EnumTest { this.outerEnumIntegerDefaultValue, }); + @JsonKey( - nullable: false, name: r'enum_string', required: false, ) - EnumTestEnumStringEnum enumString; + EnumTestEnumStringEnum? enumString; @JsonKey( - nullable: false, name: r'enum_string_required', required: true, ) EnumTestEnumStringRequiredEnum enumStringRequired; @JsonKey( - nullable: false, name: r'enum_integer', required: false, ) - EnumTestEnumIntegerEnum enumInteger; + EnumTestEnumIntegerEnum? enumInteger; @JsonKey( - nullable: false, name: r'enum_number', required: false, ) - EnumTestEnumNumberEnum enumNumber; + EnumTestEnumNumberEnum? enumNumber; @JsonKey( - nullable: true, name: r'outerEnum', required: false, ) - OuterEnum outerEnum; + OuterEnum? outerEnum; @JsonKey( - nullable: false, name: r'outerEnumInteger', required: false, ) - OuterEnumInteger outerEnumInteger; + OuterEnumInteger? outerEnumInteger; @JsonKey( - nullable: false, name: r'outerEnumDefaultValue', required: false, ) - OuterEnumDefaultValue outerEnumDefaultValue; + OuterEnumDefaultValue? outerEnumDefaultValue; @JsonKey( - nullable: false, name: r'outerEnumIntegerDefaultValue', required: false, ) - OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue; + OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue; @override bool operator ==(Object other) => identical(this, other) || other is EnumTest && @@ -98,14 +91,14 @@ class EnumTest { @override int get hashCode => - (enumString == null ? 0 : enumString.hashCode) + - (enumStringRequired == null ? 0 : enumStringRequired.hashCode) + - (enumInteger == null ? 0 : enumInteger.hashCode) + - (enumNumber == null ? 0 : enumNumber.hashCode) + - (outerEnum == null ? 0 : outerEnum.hashCode) + - (outerEnumInteger == null ? 0 : outerEnumInteger.hashCode) + - (outerEnumDefaultValue == null ? 0 : outerEnumDefaultValue.hashCode) + - (outerEnumIntegerDefaultValue == null ? 0 : outerEnumIntegerDefaultValue.hashCode); + enumString.hashCode + + enumStringRequired.hashCode + + enumInteger.hashCode + + enumNumber.hashCode + + outerEnum.hashCode + + outerEnumInteger.hashCode + + outerEnumDefaultValue.hashCode + + outerEnumIntegerDefaultValue.hashCode; factory EnumTest.fromJson(Map json) => _$EnumTestFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/file_schema_test_class.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/file_schema_test_class.dart index 15a0b8d7daa5..dc67479465e1 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/file_schema_test_class.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/file_schema_test_class.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -23,19 +23,19 @@ class FileSchemaTestClass { this.files = const [], }); + @JsonKey( - nullable: false, name: r'file', required: false, ) - ModelFile file; + ModelFile? file; @JsonKey( defaultValue: const [], name: r'files', required: false, ) - List files; + List? files; @override bool operator ==(Object other) => identical(this, other) || other is FileSchemaTestClass && @@ -44,8 +44,8 @@ class FileSchemaTestClass { @override int get hashCode => - (file == null ? 0 : file.hashCode) + - (files == null ? 0 : files.hashCode); + file.hashCode + + files.hashCode; factory FileSchemaTestClass.fromJson(Map json) => _$FileSchemaTestClassFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/foo.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/foo.dart index a2917b7c2e8f..ed391aed31df 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/foo.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/foo.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -22,12 +22,13 @@ class Foo { this.bar = 'bar', }); + @JsonKey( defaultValue: 'bar', name: r'bar', required: false, ) - String bar; + String? bar; @override bool operator ==(Object other) => identical(this, other) || other is Foo && @@ -35,7 +36,7 @@ class Foo { @override int get hashCode => - (bar == null ? 0 : bar.hashCode); + bar.hashCode; factory Foo.fromJson(Map json) => _$FooFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/format_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/format_test.dart index 6c66d9281754..3a83f384656f 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/format_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/format_test.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -22,140 +22,126 @@ class FormatTest { this.integer, this.int32, this.int64, - @required this.number, + required this.number, this.float, this.double_, this.decimal, this.string, - @required this.byte, + required this.byte, this.binary, - @required this.date, + required this.date, this.dateTime, this.uuid, - @required this.password, + required this.password, this.patternWithDigits, this.patternWithDigitsAndDelimiter, }); - // minimum: 10 - // maximum: 100 + + // minimum: 10 + // maximum: 100 @JsonKey( - nullable: false, name: r'integer', required: false, ) - int integer; + int? integer; - // minimum: 20 - // maximum: 200 + // minimum: 20 + // maximum: 200 @JsonKey( - nullable: false, name: r'int32', required: false, ) - int int32; + int? int32; @JsonKey( - nullable: false, name: r'int64', required: false, ) - int int64; + int? int64; - // minimum: 32.1 - // maximum: 543.2 + // minimum: 32.1 + // maximum: 543.2 @JsonKey( - nullable: false, name: r'number', required: true, ) num number; - // minimum: 54.3 - // maximum: 987.6 + // minimum: 54.3 + // maximum: 987.6 @JsonKey( - nullable: false, name: r'float', required: false, ) - double float; + double? float; - // minimum: 67.8 - // maximum: 123.4 + // minimum: 67.8 + // maximum: 123.4 @JsonKey( - nullable: false, name: r'double', required: false, ) - double double_; + double? double_; @JsonKey( - nullable: false, name: r'decimal', required: false, ) - double decimal; + double? decimal; @JsonKey( - nullable: false, name: r'string', required: false, ) - String string; + String? string; @JsonKey( - nullable: false, name: r'byte', required: true, ) String byte; @JsonKey(ignore: true) - MultipartFile binary; + MultipartFile? binary; @JsonKey( - nullable: false, name: r'date', required: true, ) DateTime date; @JsonKey( - nullable: false, name: r'dateTime', required: false, ) - DateTime dateTime; + DateTime? dateTime; @JsonKey( - nullable: false, name: r'uuid', required: false, ) - String uuid; + String? uuid; @JsonKey( - nullable: false, name: r'password', required: true, ) String password; - /// A string that is a 10 digit number. Can have leading zeros. + /// A string that is a 10 digit number. Can have leading zeros. @JsonKey( - nullable: false, name: r'pattern_with_digits', required: false, ) - String patternWithDigits; + String? patternWithDigits; - /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. @JsonKey( - nullable: false, name: r'pattern_with_digits_and_delimiter', required: false, ) - String patternWithDigitsAndDelimiter; + String? patternWithDigitsAndDelimiter; @override bool operator ==(Object other) => identical(this, other) || other is FormatTest && @@ -178,22 +164,22 @@ class FormatTest { @override int get hashCode => - (integer == null ? 0 : integer.hashCode) + - (int32 == null ? 0 : int32.hashCode) + - (int64 == null ? 0 : int64.hashCode) + - (number == null ? 0 : number.hashCode) + - (float == null ? 0 : float.hashCode) + - (double_ == null ? 0 : double_.hashCode) + - (decimal == null ? 0 : decimal.hashCode) + - (string == null ? 0 : string.hashCode) + - (byte == null ? 0 : byte.hashCode) + - (binary == null ? 0 : binary.hashCode) + - (date == null ? 0 : date.hashCode) + - (dateTime == null ? 0 : dateTime.hashCode) + - (uuid == null ? 0 : uuid.hashCode) + - (password == null ? 0 : password.hashCode) + - (patternWithDigits == null ? 0 : patternWithDigits.hashCode) + - (patternWithDigitsAndDelimiter == null ? 0 : patternWithDigitsAndDelimiter.hashCode); + integer.hashCode + + int32.hashCode + + int64.hashCode + + number.hashCode + + float.hashCode + + double_.hashCode + + decimal.hashCode + + string.hashCode + + byte.hashCode + + binary.hashCode + + date.hashCode + + dateTime.hashCode + + uuid.hashCode + + password.hashCode + + patternWithDigits.hashCode + + patternWithDigitsAndDelimiter.hashCode; factory FormatTest.fromJson(Map json) => _$FormatTestFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/has_only_read_only.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/has_only_read_only.dart index 5d016561de78..7531069f2ba8 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/has_only_read_only.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/has_only_read_only.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -23,19 +23,18 @@ class HasOnlyReadOnly { this.foo, }); + @JsonKey( - nullable: false, name: r'bar', required: false, ) - String bar; + String? bar; @JsonKey( - nullable: false, name: r'foo', required: false, ) - String foo; + String? foo; @override bool operator ==(Object other) => identical(this, other) || other is HasOnlyReadOnly && @@ -44,8 +43,8 @@ class HasOnlyReadOnly { @override int get hashCode => - (bar == null ? 0 : bar.hashCode) + - (foo == null ? 0 : foo.hashCode); + bar.hashCode + + foo.hashCode; factory HasOnlyReadOnly.fromJson(Map json) => _$HasOnlyReadOnlyFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/health_check_result.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/health_check_result.dart index eaa93075b46f..38c2ee79a9d1 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/health_check_result.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/health_check_result.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -22,12 +22,12 @@ class HealthCheckResult { this.nullableMessage, }); + @JsonKey( - nullable: true, name: r'NullableMessage', required: false, ) - String nullableMessage; + String? nullableMessage; @override bool operator ==(Object other) => identical(this, other) || other is HealthCheckResult && @@ -35,7 +35,7 @@ class HealthCheckResult { @override int get hashCode => - (nullableMessage == null ? 0 : nullableMessage.hashCode); + nullableMessage.hashCode; factory HealthCheckResult.fromJson(Map json) => _$HealthCheckResultFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/inline_response_default.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/inline_response_default.dart index 55baf5104085..4af524d63835 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/inline_response_default.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/inline_response_default.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -22,12 +22,12 @@ class InlineResponseDefault { this.string, }); + @JsonKey( - nullable: false, name: r'string', required: false, ) - Foo string; + Foo? string; @override bool operator ==(Object other) => identical(this, other) || other is InlineResponseDefault && @@ -35,7 +35,7 @@ class InlineResponseDefault { @override int get hashCode => - (string == null ? 0 : string.hashCode); + string.hashCode; factory InlineResponseDefault.fromJson(Map json) => _$InlineResponseDefaultFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/map_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/map_test.dart index 3c06f1815f75..26befc75870b 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/map_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/map_test.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -25,33 +25,34 @@ class MapTest { this.indirectMap = const {}, }); + @JsonKey( defaultValue: const {}, name: r'map_map_of_string', required: false, ) - Map> mapMapOfString; + Map>? mapMapOfString; @JsonKey( defaultValue: const {}, name: r'map_of_enum_string', required: false, ) - Map mapOfEnumString; + Map? mapOfEnumString; @JsonKey( defaultValue: const {}, name: r'direct_map', required: false, ) - Map directMap; + Map? directMap; @JsonKey( defaultValue: const {}, name: r'indirect_map', required: false, ) - Map indirectMap; + Map? indirectMap; @override bool operator ==(Object other) => identical(this, other) || other is MapTest && @@ -62,10 +63,10 @@ class MapTest { @override int get hashCode => - (mapMapOfString == null ? 0 : mapMapOfString.hashCode) + - (mapOfEnumString == null ? 0 : mapOfEnumString.hashCode) + - (directMap == null ? 0 : directMap.hashCode) + - (indirectMap == null ? 0 : indirectMap.hashCode); + mapMapOfString.hashCode + + mapOfEnumString.hashCode + + directMap.hashCode + + indirectMap.hashCode; factory MapTest.fromJson(Map json) => _$MapTestFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart index 1fd6acc5160f..8905eefbaf34 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -24,26 +24,25 @@ class MixedPropertiesAndAdditionalPropertiesClass { this.map = const {}, }); + @JsonKey( - nullable: false, name: r'uuid', required: false, ) - String uuid; + String? uuid; @JsonKey( - nullable: false, name: r'dateTime', required: false, ) - DateTime dateTime; + DateTime? dateTime; @JsonKey( defaultValue: const {}, name: r'map', required: false, ) - Map map; + Map? map; @override bool operator ==(Object other) => identical(this, other) || other is MixedPropertiesAndAdditionalPropertiesClass && @@ -53,9 +52,9 @@ class MixedPropertiesAndAdditionalPropertiesClass { @override int get hashCode => - (uuid == null ? 0 : uuid.hashCode) + - (dateTime == null ? 0 : dateTime.hashCode) + - (map == null ? 0 : map.hashCode); + uuid.hashCode + + dateTime.hashCode + + map.hashCode; factory MixedPropertiesAndAdditionalPropertiesClass.fromJson(Map json) => _$MixedPropertiesAndAdditionalPropertiesClassFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model200_response.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model200_response.dart index a1c8996439b5..8cc738ac4864 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model200_response.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model200_response.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -23,19 +23,18 @@ class Model200Response { this.class_, }); + @JsonKey( - nullable: false, name: r'name', required: false, ) - int name; + int? name; @JsonKey( - nullable: false, name: r'class', required: false, ) - String class_; + String? class_; @override bool operator ==(Object other) => identical(this, other) || other is Model200Response && @@ -44,8 +43,8 @@ class Model200Response { @override int get hashCode => - (name == null ? 0 : name.hashCode) + - (class_ == null ? 0 : class_.hashCode); + name.hashCode + + class_.hashCode; factory Model200Response.fromJson(Map json) => _$Model200ResponseFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_client.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_client.dart index 70e3a6ebeb83..b076b0a866f1 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_client.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -22,12 +22,12 @@ class ModelClient { this.client, }); + @JsonKey( - nullable: false, name: r'client', required: false, ) - String client; + String? client; @override bool operator ==(Object other) => identical(this, other) || other is ModelClient && @@ -35,7 +35,7 @@ class ModelClient { @override int get hashCode => - (client == null ? 0 : client.hashCode); + client.hashCode; factory ModelClient.fromJson(Map json) => _$ModelClientFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_file.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_file.dart index 6fb382ebf1c1..7f59bc83353f 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_file.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_file.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -22,13 +22,13 @@ class ModelFile { this.sourceURI, }); - /// Test capitalization + + /// Test capitalization @JsonKey( - nullable: false, name: r'sourceURI', required: false, ) - String sourceURI; + String? sourceURI; @override bool operator ==(Object other) => identical(this, other) || other is ModelFile && @@ -36,7 +36,7 @@ class ModelFile { @override int get hashCode => - (sourceURI == null ? 0 : sourceURI.hashCode); + sourceURI.hashCode; factory ModelFile.fromJson(Map json) => _$ModelFileFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_list.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_list.dart index b69abf130f50..27c895e4df8d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_list.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_list.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -22,12 +22,12 @@ class ModelList { this.n123list, }); + @JsonKey( - nullable: false, name: r'123-list', required: false, ) - String n123list; + String? n123list; @override bool operator ==(Object other) => identical(this, other) || other is ModelList && @@ -35,7 +35,7 @@ class ModelList { @override int get hashCode => - (n123list == null ? 0 : n123list.hashCode); + n123list.hashCode; factory ModelList.fromJson(Map json) => _$ModelListFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_return.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_return.dart index 0a18d3ed4890..dfd17cd68d24 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_return.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_return.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -22,12 +22,12 @@ class ModelReturn { this.return_, }); + @JsonKey( - nullable: false, name: r'return', required: false, ) - int return_; + int? return_; @override bool operator ==(Object other) => identical(this, other) || other is ModelReturn && @@ -35,7 +35,7 @@ class ModelReturn { @override int get hashCode => - (return_ == null ? 0 : return_.hashCode); + return_.hashCode; factory ModelReturn.fromJson(Map json) => _$ModelReturnFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/name.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/name.dart index c554627bfcde..fdde2bcae9f2 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/name.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/name.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -19,39 +19,36 @@ part of openapi.api; class Name { /// Returns a new [Name] instance. Name({ - @required this.name, + required this.name, this.snakeCase, this.property, this.n123number, }); + @JsonKey( - nullable: false, name: r'name', required: true, ) int name; @JsonKey( - nullable: false, name: r'snake_case', required: false, ) - int snakeCase; + int? snakeCase; @JsonKey( - nullable: false, name: r'property', required: false, ) - String property; + String? property; @JsonKey( - nullable: false, name: r'123Number', required: false, ) - int n123number; + int? n123number; @override bool operator ==(Object other) => identical(this, other) || other is Name && @@ -62,10 +59,10 @@ class Name { @override int get hashCode => - (name == null ? 0 : name.hashCode) + - (snakeCase == null ? 0 : snakeCase.hashCode) + - (property == null ? 0 : property.hashCode) + - (n123number == null ? 0 : n123number.hashCode); + name.hashCode + + snakeCase.hashCode + + property.hashCode + + n123number.hashCode; factory Name.fromJson(Map json) => _$NameFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/nullable_class.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/nullable_class.dart index 68c0deefc5af..43d517917971 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/nullable_class.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/nullable_class.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -33,89 +33,84 @@ class NullableClass { this.objectItemsNullable = const {}, }); + @JsonKey( - nullable: true, name: r'integer_prop', required: false, ) - int integerProp; + int? integerProp; @JsonKey( - nullable: true, name: r'number_prop', required: false, ) - num numberProp; + num? numberProp; @JsonKey( - nullable: true, name: r'boolean_prop', required: false, ) - bool booleanProp; + bool? booleanProp; @JsonKey( - nullable: true, name: r'string_prop', required: false, ) - String stringProp; + String? stringProp; @JsonKey( - nullable: true, name: r'date_prop', required: false, ) - DateTime dateProp; + DateTime? dateProp; @JsonKey( - nullable: true, name: r'datetime_prop', required: false, ) - DateTime datetimeProp; + DateTime? datetimeProp; @JsonKey( defaultValue: const [], name: r'array_nullable_prop', required: false, ) - List arrayNullableProp; + List>? arrayNullableProp; @JsonKey( defaultValue: const [], name: r'array_and_items_nullable_prop', required: false, ) - List arrayAndItemsNullableProp; + List>? arrayAndItemsNullableProp; @JsonKey( defaultValue: const [], name: r'array_items_nullable', required: false, ) - List arrayItemsNullable; + List>? arrayItemsNullable; @JsonKey( defaultValue: const {}, name: r'object_nullable_prop', required: false, ) - Map objectNullableProp; + Map? objectNullableProp; @JsonKey( defaultValue: const {}, name: r'object_and_items_nullable_prop', required: false, ) - Map objectAndItemsNullableProp; + Map? objectAndItemsNullableProp; @JsonKey( defaultValue: const {}, name: r'object_items_nullable', required: false, ) - Map objectItemsNullable; + Map? objectItemsNullable; @override bool operator ==(Object other) => identical(this, other) || other is NullableClass && @@ -134,18 +129,18 @@ class NullableClass { @override int get hashCode => - (integerProp == null ? 0 : integerProp.hashCode) + - (numberProp == null ? 0 : numberProp.hashCode) + - (booleanProp == null ? 0 : booleanProp.hashCode) + - (stringProp == null ? 0 : stringProp.hashCode) + - (dateProp == null ? 0 : dateProp.hashCode) + - (datetimeProp == null ? 0 : datetimeProp.hashCode) + - (arrayNullableProp == null ? 0 : arrayNullableProp.hashCode) + - (arrayAndItemsNullableProp == null ? 0 : arrayAndItemsNullableProp.hashCode) + - (arrayItemsNullable == null ? 0 : arrayItemsNullable.hashCode) + - (objectNullableProp == null ? 0 : objectNullableProp.hashCode) + - (objectAndItemsNullableProp == null ? 0 : objectAndItemsNullableProp.hashCode) + - (objectItemsNullable == null ? 0 : objectItemsNullable.hashCode); + integerProp.hashCode + + numberProp.hashCode + + booleanProp.hashCode + + stringProp.hashCode + + dateProp.hashCode + + datetimeProp.hashCode + + arrayNullableProp.hashCode + + arrayAndItemsNullableProp.hashCode + + arrayItemsNullable.hashCode + + objectNullableProp.hashCode + + objectAndItemsNullableProp.hashCode + + objectItemsNullable.hashCode; factory NullableClass.fromJson(Map json) => _$NullableClassFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/number_only.dart index deccb0c854d9..c8c391ddb290 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/number_only.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/number_only.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -22,12 +22,12 @@ class NumberOnly { this.justNumber, }); + @JsonKey( - nullable: false, name: r'JustNumber', required: false, ) - num justNumber; + num? justNumber; @override bool operator ==(Object other) => identical(this, other) || other is NumberOnly && @@ -35,7 +35,7 @@ class NumberOnly { @override int get hashCode => - (justNumber == null ? 0 : justNumber.hashCode); + justNumber.hashCode; factory NumberOnly.fromJson(Map json) => _$NumberOnlyFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/object_with_deprecated_fields.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/object_with_deprecated_fields.dart index 936ecc671f8f..101b0cc84d9a 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/object_with_deprecated_fields.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/object_with_deprecated_fields.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -25,33 +25,31 @@ class ObjectWithDeprecatedFields { this.bars = const [], }); + @JsonKey( - nullable: false, name: r'uuid', required: false, ) - String uuid; + String? uuid; @JsonKey( - nullable: false, name: r'id', required: false, ) - num id; + num? id; @JsonKey( - nullable: false, name: r'deprecatedRef', required: false, ) - DeprecatedObject deprecatedRef; + DeprecatedObject? deprecatedRef; @JsonKey( defaultValue: const [], name: r'bars', required: false, ) - List bars; + List? bars; @override bool operator ==(Object other) => identical(this, other) || other is ObjectWithDeprecatedFields && @@ -62,10 +60,10 @@ class ObjectWithDeprecatedFields { @override int get hashCode => - (uuid == null ? 0 : uuid.hashCode) + - (id == null ? 0 : id.hashCode) + - (deprecatedRef == null ? 0 : deprecatedRef.hashCode) + - (bars == null ? 0 : bars.hashCode); + uuid.hashCode + + id.hashCode + + deprecatedRef.hashCode + + bars.hashCode; factory ObjectWithDeprecatedFields.fromJson(Map json) => _$ObjectWithDeprecatedFieldsFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/order.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/order.dart index 096ccfe4b4ea..677f533350e3 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/order.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/order.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -27,48 +27,44 @@ class Order { this.complete = false, }); + @JsonKey( - nullable: false, name: r'id', required: false, ) - int id; + int? id; @JsonKey( - nullable: false, name: r'petId', required: false, ) - int petId; + int? petId; @JsonKey( - nullable: false, name: r'quantity', required: false, ) - int quantity; + int? quantity; @JsonKey( - nullable: false, name: r'shipDate', required: false, ) - DateTime shipDate; + DateTime? shipDate; - /// Order Status + /// Order Status @JsonKey( - nullable: false, name: r'status', required: false, ) - OrderStatusEnum status; + OrderStatusEnum? status; @JsonKey( defaultValue: false, name: r'complete', required: false, ) - bool complete; + bool? complete; @override bool operator ==(Object other) => identical(this, other) || other is Order && @@ -81,12 +77,12 @@ class Order { @override int get hashCode => - (id == null ? 0 : id.hashCode) + - (petId == null ? 0 : petId.hashCode) + - (quantity == null ? 0 : quantity.hashCode) + - (shipDate == null ? 0 : shipDate.hashCode) + - (status == null ? 0 : status.hashCode) + - (complete == null ? 0 : complete.hashCode); + id.hashCode + + petId.hashCode + + quantity.hashCode + + shipDate.hashCode + + status.hashCode + + complete.hashCode; factory Order.fromJson(Map json) => _$OrderFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_composite.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_composite.dart index 2f2bd6f221ed..c8b88c17bfac 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_composite.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_composite.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -24,26 +24,24 @@ class OuterComposite { this.myBoolean, }); + @JsonKey( - nullable: false, name: r'my_number', required: false, ) - num myNumber; + num? myNumber; @JsonKey( - nullable: false, name: r'my_string', required: false, ) - String myString; + String? myString; @JsonKey( - nullable: false, name: r'my_boolean', required: false, ) - bool myBoolean; + bool? myBoolean; @override bool operator ==(Object other) => identical(this, other) || other is OuterComposite && @@ -53,9 +51,9 @@ class OuterComposite { @override int get hashCode => - (myNumber == null ? 0 : myNumber.hashCode) + - (myString == null ? 0 : myString.hashCode) + - (myBoolean == null ? 0 : myBoolean.hashCode); + myNumber.hashCode + + myString.hashCode + + myBoolean.hashCode; factory OuterComposite.fromJson(Map json) => _$OuterCompositeFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum.dart index a91f63c0ed29..aa95492edc0b 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_default_value.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_default_value.dart index a1e262354556..c69be7155525 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_default_value.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_default_value.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer.dart index 5fa167be541c..385736265f65 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer_default_value.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer_default_value.dart index 5d6ed62ea7c8..aef9c365c0bd 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer_default_value.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer_default_value.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_object_with_enum_property.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_object_with_enum_property.dart index 9971d8b005db..9f423d94c83c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_object_with_enum_property.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_object_with_enum_property.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -19,11 +19,11 @@ part of openapi.api; class OuterObjectWithEnumProperty { /// Returns a new [OuterObjectWithEnumProperty] instance. OuterObjectWithEnumProperty({ - @required this.value, + required this.value, }); + @JsonKey( - nullable: false, name: r'value', required: true, ) @@ -35,7 +35,7 @@ class OuterObjectWithEnumProperty { @override int get hashCode => - (value == null ? 0 : value.hashCode); + value.hashCode; factory OuterObjectWithEnumProperty.fromJson(Map json) => _$OuterObjectWithEnumPropertyFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/pet.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/pet.dart index 572f3e67f7cc..b3ea5adb346d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/pet.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/pet.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -21,28 +21,26 @@ class Pet { Pet({ this.id, this.category, - @required this.name, + required this.name, this.photoUrls = const {}, this.tags = const [], this.status, }); + @JsonKey( - nullable: false, name: r'id', required: false, ) - int id; + int? id; @JsonKey( - nullable: false, name: r'category', required: false, ) - Category category; + Category? category; @JsonKey( - nullable: false, name: r'name', required: true, ) @@ -60,15 +58,14 @@ class Pet { name: r'tags', required: false, ) - List tags; + List? tags; - /// pet status in the store + /// pet status in the store @JsonKey( - nullable: false, name: r'status', required: false, ) - PetStatusEnum status; + PetStatusEnum? status; @override bool operator ==(Object other) => identical(this, other) || other is Pet && @@ -81,12 +78,12 @@ class Pet { @override int get hashCode => - (id == null ? 0 : id.hashCode) + - (category == null ? 0 : category.hashCode) + - (name == null ? 0 : name.hashCode) + - (photoUrls == null ? 0 : photoUrls.hashCode) + - (tags == null ? 0 : tags.hashCode) + - (status == null ? 0 : status.hashCode); + id.hashCode + + category.hashCode + + name.hashCode + + photoUrls.hashCode + + tags.hashCode + + status.hashCode; factory Pet.fromJson(Map json) => _$PetFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/read_only_first.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/read_only_first.dart index 46af402a0e5a..b3228e4f1674 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/read_only_first.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/read_only_first.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -23,19 +23,18 @@ class ReadOnlyFirst { this.baz, }); + @JsonKey( - nullable: false, name: r'bar', required: false, ) - String bar; + String? bar; @JsonKey( - nullable: false, name: r'baz', required: false, ) - String baz; + String? baz; @override bool operator ==(Object other) => identical(this, other) || other is ReadOnlyFirst && @@ -44,8 +43,8 @@ class ReadOnlyFirst { @override int get hashCode => - (bar == null ? 0 : bar.hashCode) + - (baz == null ? 0 : baz.hashCode); + bar.hashCode + + baz.hashCode; factory ReadOnlyFirst.fromJson(Map json) => _$ReadOnlyFirstFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/special_model_name.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/special_model_name.dart index 34e81dbe4d98..522bd095ce97 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/special_model_name.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/special_model_name.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -22,12 +22,12 @@ class SpecialModelName { this.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket, }); + @JsonKey( - nullable: false, name: r'$special[property.name]', required: false, ) - int dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; + int? dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; @override bool operator ==(Object other) => identical(this, other) || other is SpecialModelName && @@ -35,7 +35,7 @@ class SpecialModelName { @override int get hashCode => - (dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket == null ? 0 : dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket.hashCode); + dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket.hashCode; factory SpecialModelName.fromJson(Map json) => _$SpecialModelNameFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/tag.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/tag.dart index 797f3fdcded3..abb25e6749e5 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/tag.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/tag.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -23,19 +23,18 @@ class Tag { this.name, }); + @JsonKey( - nullable: false, name: r'id', required: false, ) - int id; + int? id; @JsonKey( - nullable: false, name: r'name', required: false, ) - String name; + String? name; @override bool operator ==(Object other) => identical(this, other) || other is Tag && @@ -44,8 +43,8 @@ class Tag { @override int get hashCode => - (id == null ? 0 : id.hashCode) + - (name == null ? 0 : name.hashCode); + id.hashCode + + name.hashCode; factory Tag.fromJson(Map json) => _$TagFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/user.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/user.dart index 8ca6ebef6958..2e482c6788fc 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/user.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/user.dart @@ -1,7 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.0 +// @dart=2.14 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -29,62 +29,55 @@ class User { this.userStatus, }); + @JsonKey( - nullable: false, name: r'id', required: false, ) - int id; + int? id; @JsonKey( - nullable: false, name: r'username', required: false, ) - String username; + String? username; @JsonKey( - nullable: false, name: r'firstName', required: false, ) - String firstName; + String? firstName; @JsonKey( - nullable: false, name: r'lastName', required: false, ) - String lastName; + String? lastName; @JsonKey( - nullable: false, name: r'email', required: false, ) - String email; + String? email; @JsonKey( - nullable: false, name: r'password', required: false, ) - String password; + String? password; @JsonKey( - nullable: false, name: r'phone', required: false, ) - String phone; + String? phone; - /// User Status + /// User Status @JsonKey( - nullable: false, name: r'userStatus', required: false, ) - int userStatus; + int? userStatus; @override bool operator ==(Object other) => identical(this, other) || other is User && @@ -99,14 +92,14 @@ class User { @override int get hashCode => - (id == null ? 0 : id.hashCode) + - (username == null ? 0 : username.hashCode) + - (firstName == null ? 0 : firstName.hashCode) + - (lastName == null ? 0 : lastName.hashCode) + - (email == null ? 0 : email.hashCode) + - (password == null ? 0 : password.hashCode) + - (phone == null ? 0 : phone.hashCode) + - (userStatus == null ? 0 : userStatus.hashCode); + id.hashCode + + username.hashCode + + firstName.hashCode + + lastName.hashCode + + email.hashCode + + password.hashCode + + phone.hashCode + + userStatus.hashCode; factory User.fromJson(Map json) => _$UserFromJson(json); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/pom.xml b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/pom.xml deleted file mode 100644 index 708ad4155156..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/pom.xml +++ /dev/null @@ -1,88 +0,0 @@ - - 4.0.0 - org.openapitools - Dart2PetstoreClientJsonSerializableLibTests - pom - 1.0.0-SNAPSHOT - Dart2 Petstore Client with json_serializable Lib - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory} - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - export-dartfmt - pre-install-test - - exec - - - export - - DART_FMT_PATH=/usr/local/bin/dartfmt - - - - - pub-get - pre-integration-test - - exec - - - pub - - get - - - - - pub-build-runner - pre-integration-test - - exec - - - pub - - run - build_runner - build - - - - - pub-test - integration-test - - exec - - - pub - - run - test - - - - - - - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/pubspec.yaml b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/pubspec.yaml index 66b0d5a7acde..ab1ee387cdc2 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/pubspec.yaml +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/pubspec.yaml @@ -7,13 +7,11 @@ version: '1.0.0' description: 'OpenAPI API client' homepage: 'homepage' environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.14.0 <3.0.0' dependencies: http: '>=0.13.0 <0.14.0' intl: '^0.17.0' - meta: '^1.1.8' - json_annotation: '^3.1.1' + json_annotation: '^4.1.0' dev_dependencies: - test: '>=1.16.0 <1.18.0' - build_runner: '^1.10.9' - json_serializable: '^3.5.1' + build_runner: '^2.1.4' + json_serializable: '^5.0.2' diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/additional_properties_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/additional_properties_class_test.dart deleted file mode 100644 index 3f231dddf74d..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/additional_properties_class_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for AdditionalPropertiesClass -void main() { - final instance = AdditionalPropertiesClass(); - - group('test AdditionalPropertiesClass', () { - // Map mapProperty (default value: const {}) - test('to test the property `mapProperty`', () async { - // TODO - }); - - // Map> mapOfMapProperty (default value: const {}) - test('to test the property `mapOfMapProperty`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/animal_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/animal_test.dart deleted file mode 100644 index 3e6526e71957..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/animal_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Animal -void main() { - final instance = Animal(); - - group('test Animal', () { - // String className - test('to test the property `className`', () async { - // TODO - }); - - // String color (default value: 'red') - test('to test the property `color`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/another_fake_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/another_fake_api_test.dart deleted file mode 100644 index 355b4140bdd6..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/another_fake_api_test.dart +++ /dev/null @@ -1,29 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for AnotherFakeApi -void main() { - final instance = AnotherFakeApi(); - - group('tests for AnotherFakeApi', () { - // To test special tags - // - // To test special tags and operation ID starting with number - // - //Future call123testSpecialTags(ModelClient modelClient) async - test('test call123testSpecialTags', () async { - // TODO - }); - - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/api_response_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/api_response_test.dart deleted file mode 100644 index b0c30615b926..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/api_response_test.dart +++ /dev/null @@ -1,36 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ApiResponse -void main() { - final instance = ApiResponse(); - - group('test ApiResponse', () { - // int code - test('to test the property `code`', () async { - // TODO - }); - - // String type - test('to test the property `type`', () async { - // TODO - }); - - // String message - test('to test the property `message`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_of_array_of_number_only_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_of_array_of_number_only_test.dart deleted file mode 100644 index 53ed7123a884..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_of_array_of_number_only_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ArrayOfArrayOfNumberOnly -void main() { - final instance = ArrayOfArrayOfNumberOnly(); - - group('test ArrayOfArrayOfNumberOnly', () { - // List> arrayArrayNumber (default value: const []) - test('to test the property `arrayArrayNumber`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_of_number_only_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_of_number_only_test.dart deleted file mode 100644 index 99fb4e3ddf79..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_of_number_only_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ArrayOfNumberOnly -void main() { - final instance = ArrayOfNumberOnly(); - - group('test ArrayOfNumberOnly', () { - // List arrayNumber (default value: const []) - test('to test the property `arrayNumber`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_test_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_test_test.dart deleted file mode 100644 index f1af158fe2fe..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_test_test.dart +++ /dev/null @@ -1,36 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ArrayTest -void main() { - final instance = ArrayTest(); - - group('test ArrayTest', () { - // List arrayOfString (default value: const []) - test('to test the property `arrayOfString`', () async { - // TODO - }); - - // List> arrayArrayOfInteger (default value: const []) - test('to test the property `arrayArrayOfInteger`', () async { - // TODO - }); - - // List> arrayArrayOfModel (default value: const []) - test('to test the property `arrayArrayOfModel`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/capitalization_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/capitalization_test.dart deleted file mode 100644 index c21e1a31c933..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/capitalization_test.dart +++ /dev/null @@ -1,52 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Capitalization -void main() { - final instance = Capitalization(); - - group('test Capitalization', () { - // String smallCamel - test('to test the property `smallCamel`', () async { - // TODO - }); - - // String capitalCamel - test('to test the property `capitalCamel`', () async { - // TODO - }); - - // String smallSnake - test('to test the property `smallSnake`', () async { - // TODO - }); - - // String capitalSnake - test('to test the property `capitalSnake`', () async { - // TODO - }); - - // String sCAETHFlowPoints - test('to test the property `sCAETHFlowPoints`', () async { - // TODO - }); - - // Name of the pet - // String ATT_NAME - test('to test the property `ATT_NAME`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/cat_all_of_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/cat_all_of_test.dart deleted file mode 100644 index f4d0a69b7ca3..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/cat_all_of_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for CatAllOf -void main() { - final instance = CatAllOf(); - - group('test CatAllOf', () { - // bool declawed - test('to test the property `declawed`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/cat_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/cat_test.dart deleted file mode 100644 index e7d33048bbc4..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/cat_test.dart +++ /dev/null @@ -1,36 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Cat -void main() { - final instance = Cat(); - - group('test Cat', () { - // String className - test('to test the property `className`', () async { - // TODO - }); - - // String color (default value: 'red') - test('to test the property `color`', () async { - // TODO - }); - - // bool declawed - test('to test the property `declawed`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/category_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/category_test.dart deleted file mode 100644 index 54d51663d9d9..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/category_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Category -void main() { - final instance = Category(); - - group('test Category', () { - // int id - test('to test the property `id`', () async { - // TODO - }); - - // String name (default value: 'default-name') - test('to test the property `name`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/class_model_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/class_model_test.dart deleted file mode 100644 index 047ce788765a..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/class_model_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ClassModel -void main() { - final instance = ClassModel(); - - group('test ClassModel', () { - // String class_ - test('to test the property `class_`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/default_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/default_api_test.dart deleted file mode 100644 index 2756c463df1c..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/default_api_test.dart +++ /dev/null @@ -1,25 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for DefaultApi -void main() { - final instance = DefaultApi(); - - group('tests for DefaultApi', () { - //Future fooGet() async - test('test fooGet', () async { - // TODO - }); - - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/deprecated_object_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/deprecated_object_test.dart deleted file mode 100644 index a1c6df250582..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/deprecated_object_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for DeprecatedObject -void main() { - final instance = DeprecatedObject(); - - group('test DeprecatedObject', () { - // String name - test('to test the property `name`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/dog_all_of_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/dog_all_of_test.dart deleted file mode 100644 index 5a0209898b88..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/dog_all_of_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for DogAllOf -void main() { - final instance = DogAllOf(); - - group('test DogAllOf', () { - // String breed - test('to test the property `breed`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/dog_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/dog_test.dart deleted file mode 100644 index bce7e5bbdece..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/dog_test.dart +++ /dev/null @@ -1,36 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Dog -void main() { - final instance = Dog(); - - group('test Dog', () { - // String className - test('to test the property `className`', () async { - // TODO - }); - - // String color (default value: 'red') - test('to test the property `color`', () async { - // TODO - }); - - // String breed - test('to test the property `breed`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_arrays_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_arrays_test.dart deleted file mode 100644 index b3364c9a89a6..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_arrays_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for EnumArrays -void main() { - final instance = EnumArrays(); - - group('test EnumArrays', () { - // String justSymbol - test('to test the property `justSymbol`', () async { - // TODO - }); - - // List arrayEnum (default value: const []) - test('to test the property `arrayEnum`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_class_test.dart deleted file mode 100644 index 496ffbd68cfd..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_class_test.dart +++ /dev/null @@ -1,20 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for EnumClass -void main() { - - group('test EnumClass', () { - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_test_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_test_test.dart deleted file mode 100644 index 52618838aff4..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_test_test.dart +++ /dev/null @@ -1,61 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for EnumTest -void main() { - final instance = EnumTest(); - - group('test EnumTest', () { - // String enumString - test('to test the property `enumString`', () async { - // TODO - }); - - // String enumStringRequired - test('to test the property `enumStringRequired`', () async { - // TODO - }); - - // int enumInteger - test('to test the property `enumInteger`', () async { - // TODO - }); - - // double enumNumber - test('to test the property `enumNumber`', () async { - // TODO - }); - - // OuterEnum outerEnum - test('to test the property `outerEnum`', () async { - // TODO - }); - - // OuterEnumInteger outerEnumInteger - test('to test the property `outerEnumInteger`', () async { - // TODO - }); - - // OuterEnumDefaultValue outerEnumDefaultValue - test('to test the property `outerEnumDefaultValue`', () async { - // TODO - }); - - // OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue - test('to test the property `outerEnumIntegerDefaultValue`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/fake_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/fake_api_test.dart deleted file mode 100644 index 065e89afdc1e..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/fake_api_test.dart +++ /dev/null @@ -1,138 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for FakeApi -void main() { - final instance = FakeApi(); - - group('tests for FakeApi', () { - // Health check endpoint - // - //Future fakeHealthGet() async - test('test fakeHealthGet', () async { - // TODO - }); - - // test http signature authentication - // - //Future fakeHttpSignatureTest(Pet pet, { String query1, String header1 }) async - test('test fakeHttpSignatureTest', () async { - // TODO - }); - - // Test serialization of outer boolean types - // - //Future fakeOuterBooleanSerialize({ bool body }) async - test('test fakeOuterBooleanSerialize', () async { - // TODO - }); - - // Test serialization of object with outer number type - // - //Future fakeOuterCompositeSerialize({ OuterComposite outerComposite }) async - test('test fakeOuterCompositeSerialize', () async { - // TODO - }); - - // Test serialization of outer number types - // - //Future fakeOuterNumberSerialize({ num body }) async - test('test fakeOuterNumberSerialize', () async { - // TODO - }); - - // Test serialization of outer string types - // - //Future fakeOuterStringSerialize({ String body }) async - test('test fakeOuterStringSerialize', () async { - // TODO - }); - - // Test serialization of enum (int) properties with examples - // - //Future fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty) async - test('test fakePropertyEnumIntegerSerialize', () async { - // TODO - }); - - // For this test, the body for this request much reference a schema named `File`. - // - //Future testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) async - test('test testBodyWithFileSchema', () async { - // TODO - }); - - //Future testBodyWithQueryParams(String query, User user) async - test('test testBodyWithQueryParams', () async { - // TODO - }); - - // To test \"client\" model - // - // To test \"client\" model - // - //Future testClientModel(ModelClient modelClient) async - test('test testClientModel', () async { - // TODO - }); - - // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - // - // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - // - //Future testEndpointParameters(num number, double double_, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback }) async - test('test testEndpointParameters', () async { - // TODO - }); - - // To test enum parameters - // - // To test enum parameters - // - //Future testEnumParameters({ List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, List enumFormStringArray, String enumFormString }) async - test('test testEnumParameters', () async { - // TODO - }); - - // Fake endpoint to test group parameters (optional) - // - // Fake endpoint to test group parameters (optional) - // - //Future testGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int stringGroup, bool booleanGroup, int int64Group }) async - test('test testGroupParameters', () async { - // TODO - }); - - // test inline additionalProperties - // - //Future testInlineAdditionalProperties(Map requestBody) async - test('test testInlineAdditionalProperties', () async { - // TODO - }); - - // test json serialization of form data - // - //Future testJsonFormData(String param, String param2) async - test('test testJsonFormData', () async { - // TODO - }); - - // To test the collection format in query parameters - // - //Future testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context) async - test('test testQueryParameterCollectionFormat', () async { - // TODO - }); - - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/fake_classname_tags123_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/fake_classname_tags123_api_test.dart deleted file mode 100644 index 1a0f96589476..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/fake_classname_tags123_api_test.dart +++ /dev/null @@ -1,29 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for FakeClassnameTags123Api -void main() { - final instance = FakeClassnameTags123Api(); - - group('tests for FakeClassnameTags123Api', () { - // To test class name in snake case - // - // To test class name in snake case - // - //Future testClassname(ModelClient modelClient) async - test('test testClassname', () async { - // TODO - }); - - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/file_schema_test_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/file_schema_test_class_test.dart deleted file mode 100644 index 4316bb385a76..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/file_schema_test_class_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for FileSchemaTestClass -void main() { - final instance = FileSchemaTestClass(); - - group('test FileSchemaTestClass', () { - // ModelFile file - test('to test the property `file`', () async { - // TODO - }); - - // List files (default value: const []) - test('to test the property `files`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/foo_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/foo_test.dart deleted file mode 100644 index 7b72da51b0e8..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/foo_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Foo -void main() { - final instance = Foo(); - - group('test Foo', () { - // String bar (default value: 'bar') - test('to test the property `bar`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/format_test_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/format_test_test.dart deleted file mode 100644 index e776be1d9f68..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/format_test_test.dart +++ /dev/null @@ -1,103 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for FormatTest -void main() { - final instance = FormatTest(); - - group('test FormatTest', () { - // int integer - test('to test the property `integer`', () async { - // TODO - }); - - // int int32 - test('to test the property `int32`', () async { - // TODO - }); - - // int int64 - test('to test the property `int64`', () async { - // TODO - }); - - // num number - test('to test the property `number`', () async { - // TODO - }); - - // double float - test('to test the property `float`', () async { - // TODO - }); - - // double double_ - test('to test the property `double_`', () async { - // TODO - }); - - // double decimal - test('to test the property `decimal`', () async { - // TODO - }); - - // String string - test('to test the property `string`', () async { - // TODO - }); - - // String byte - test('to test the property `byte`', () async { - // TODO - }); - - // MultipartFile binary - test('to test the property `binary`', () async { - // TODO - }); - - // DateTime date - test('to test the property `date`', () async { - // TODO - }); - - // DateTime dateTime - test('to test the property `dateTime`', () async { - // TODO - }); - - // String uuid - test('to test the property `uuid`', () async { - // TODO - }); - - // String password - test('to test the property `password`', () async { - // TODO - }); - - // A string that is a 10 digit number. Can have leading zeros. - // String patternWithDigits - test('to test the property `patternWithDigits`', () async { - // TODO - }); - - // A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. - // String patternWithDigitsAndDelimiter - test('to test the property `patternWithDigitsAndDelimiter`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/has_only_read_only_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/has_only_read_only_test.dart deleted file mode 100644 index 16b36e117094..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/has_only_read_only_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for HasOnlyReadOnly -void main() { - final instance = HasOnlyReadOnly(); - - group('test HasOnlyReadOnly', () { - // String bar - test('to test the property `bar`', () async { - // TODO - }); - - // String foo - test('to test the property `foo`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/health_check_result_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/health_check_result_test.dart deleted file mode 100644 index 1599fc46a283..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/health_check_result_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for HealthCheckResult -void main() { - final instance = HealthCheckResult(); - - group('test HealthCheckResult', () { - // String nullableMessage - test('to test the property `nullableMessage`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/inline_response_default_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/inline_response_default_test.dart deleted file mode 100644 index ecb2a874f05f..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/inline_response_default_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for InlineResponseDefault -void main() { - final instance = InlineResponseDefault(); - - group('test InlineResponseDefault', () { - // Foo string - test('to test the property `string`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/map_test_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/map_test_test.dart deleted file mode 100644 index 21af0b85fa36..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/map_test_test.dart +++ /dev/null @@ -1,41 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for MapTest -void main() { - final instance = MapTest(); - - group('test MapTest', () { - // Map> mapMapOfString (default value: const {}) - test('to test the property `mapMapOfString`', () async { - // TODO - }); - - // Map mapOfEnumString (default value: const {}) - test('to test the property `mapOfEnumString`', () async { - // TODO - }); - - // Map directMap (default value: const {}) - test('to test the property `directMap`', () async { - // TODO - }); - - // Map indirectMap (default value: const {}) - test('to test the property `indirectMap`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart deleted file mode 100644 index a8e0fdd8da64..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart +++ /dev/null @@ -1,36 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for MixedPropertiesAndAdditionalPropertiesClass -void main() { - final instance = MixedPropertiesAndAdditionalPropertiesClass(); - - group('test MixedPropertiesAndAdditionalPropertiesClass', () { - // String uuid - test('to test the property `uuid`', () async { - // TODO - }); - - // DateTime dateTime - test('to test the property `dateTime`', () async { - // TODO - }); - - // Map map (default value: const {}) - test('to test the property `map`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model200_response_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model200_response_test.dart deleted file mode 100644 index c28d3671dfc1..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model200_response_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Model200Response -void main() { - final instance = Model200Response(); - - group('test Model200Response', () { - // int name - test('to test the property `name`', () async { - // TODO - }); - - // String class_ - test('to test the property `class_`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_client_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_client_test.dart deleted file mode 100644 index c0a59729e3d5..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_client_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ModelClient -void main() { - final instance = ModelClient(); - - group('test ModelClient', () { - // String client - test('to test the property `client`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_file_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_file_test.dart deleted file mode 100644 index b2f6d48afa74..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_file_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ModelFile -void main() { - final instance = ModelFile(); - - group('test ModelFile', () { - // Test capitalization - // String sourceURI - test('to test the property `sourceURI`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_list_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_list_test.dart deleted file mode 100644 index 02e98011b21f..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_list_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ModelList -void main() { - final instance = ModelList(); - - group('test ModelList', () { - // String n123list - test('to test the property `n123list`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_return_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_return_test.dart deleted file mode 100644 index b7f065e4fb45..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_return_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ModelReturn -void main() { - final instance = ModelReturn(); - - group('test ModelReturn', () { - // int return_ - test('to test the property `return_`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/name_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/name_test.dart deleted file mode 100644 index 8e0ef41e9f2f..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/name_test.dart +++ /dev/null @@ -1,41 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Name -void main() { - final instance = Name(); - - group('test Name', () { - // int name - test('to test the property `name`', () async { - // TODO - }); - - // int snakeCase - test('to test the property `snakeCase`', () async { - // TODO - }); - - // String property - test('to test the property `property`', () async { - // TODO - }); - - // int n123number - test('to test the property `n123number`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/nullable_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/nullable_class_test.dart deleted file mode 100644 index 6147fbe1336b..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/nullable_class_test.dart +++ /dev/null @@ -1,81 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for NullableClass -void main() { - final instance = NullableClass(); - - group('test NullableClass', () { - // int integerProp - test('to test the property `integerProp`', () async { - // TODO - }); - - // num numberProp - test('to test the property `numberProp`', () async { - // TODO - }); - - // bool booleanProp - test('to test the property `booleanProp`', () async { - // TODO - }); - - // String stringProp - test('to test the property `stringProp`', () async { - // TODO - }); - - // DateTime dateProp - test('to test the property `dateProp`', () async { - // TODO - }); - - // DateTime datetimeProp - test('to test the property `datetimeProp`', () async { - // TODO - }); - - // List arrayNullableProp (default value: const []) - test('to test the property `arrayNullableProp`', () async { - // TODO - }); - - // List arrayAndItemsNullableProp (default value: const []) - test('to test the property `arrayAndItemsNullableProp`', () async { - // TODO - }); - - // List arrayItemsNullable (default value: const []) - test('to test the property `arrayItemsNullable`', () async { - // TODO - }); - - // Map objectNullableProp (default value: const {}) - test('to test the property `objectNullableProp`', () async { - // TODO - }); - - // Map objectAndItemsNullableProp (default value: const {}) - test('to test the property `objectAndItemsNullableProp`', () async { - // TODO - }); - - // Map objectItemsNullable (default value: const {}) - test('to test the property `objectItemsNullable`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/number_only_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/number_only_test.dart deleted file mode 100644 index 3662bff150d9..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/number_only_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for NumberOnly -void main() { - final instance = NumberOnly(); - - group('test NumberOnly', () { - // num justNumber - test('to test the property `justNumber`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/object_with_deprecated_fields_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/object_with_deprecated_fields_test.dart deleted file mode 100644 index b5769dc67490..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/object_with_deprecated_fields_test.dart +++ /dev/null @@ -1,41 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ObjectWithDeprecatedFields -void main() { - final instance = ObjectWithDeprecatedFields(); - - group('test ObjectWithDeprecatedFields', () { - // String uuid - test('to test the property `uuid`', () async { - // TODO - }); - - // num id - test('to test the property `id`', () async { - // TODO - }); - - // DeprecatedObject deprecatedRef - test('to test the property `deprecatedRef`', () async { - // TODO - }); - - // List bars (default value: const []) - test('to test the property `bars`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/order_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/order_test.dart deleted file mode 100644 index 614a14e42bb9..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/order_test.dart +++ /dev/null @@ -1,52 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Order -void main() { - final instance = Order(); - - group('test Order', () { - // int id - test('to test the property `id`', () async { - // TODO - }); - - // int petId - test('to test the property `petId`', () async { - // TODO - }); - - // int quantity - test('to test the property `quantity`', () async { - // TODO - }); - - // DateTime shipDate - test('to test the property `shipDate`', () async { - // TODO - }); - - // Order Status - // String status - test('to test the property `status`', () async { - // TODO - }); - - // bool complete (default value: false) - test('to test the property `complete`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_composite_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_composite_test.dart deleted file mode 100644 index 294c823443c3..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_composite_test.dart +++ /dev/null @@ -1,36 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for OuterComposite -void main() { - final instance = OuterComposite(); - - group('test OuterComposite', () { - // num myNumber - test('to test the property `myNumber`', () async { - // TODO - }); - - // String myString - test('to test the property `myString`', () async { - // TODO - }); - - // bool myBoolean - test('to test the property `myBoolean`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_default_value_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_default_value_test.dart deleted file mode 100644 index 84ae975ef189..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_default_value_test.dart +++ /dev/null @@ -1,20 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for OuterEnumDefaultValue -void main() { - - group('test OuterEnumDefaultValue', () { - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_integer_default_value_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_integer_default_value_test.dart deleted file mode 100644 index bf3399ba4281..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_integer_default_value_test.dart +++ /dev/null @@ -1,20 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for OuterEnumIntegerDefaultValue -void main() { - - group('test OuterEnumIntegerDefaultValue', () { - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_integer_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_integer_test.dart deleted file mode 100644 index d807f03227ff..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_integer_test.dart +++ /dev/null @@ -1,20 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for OuterEnumInteger -void main() { - - group('test OuterEnumInteger', () { - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_test.dart deleted file mode 100644 index a2b79ce0c1c6..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_test.dart +++ /dev/null @@ -1,20 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for OuterEnum -void main() { - - group('test OuterEnum', () { - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_object_with_enum_property_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_object_with_enum_property_test.dart deleted file mode 100644 index 6995c37ebb4c..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_object_with_enum_property_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for OuterObjectWithEnumProperty -void main() { - final instance = OuterObjectWithEnumProperty(); - - group('test OuterObjectWithEnumProperty', () { - // OuterEnumInteger value - test('to test the property `value`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/pet_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/pet_api_test.dart deleted file mode 100644 index 5f4c994acefa..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/pet_api_test.dart +++ /dev/null @@ -1,89 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for PetApi -void main() { - final instance = PetApi(); - - group('tests for PetApi', () { - // Add a new pet to the store - // - //Future addPet(Pet pet) async - test('test addPet', () async { - // TODO - }); - - // Deletes a pet - // - //Future deletePet(int petId, { String apiKey }) async - test('test deletePet', () async { - // TODO - }); - - // Finds Pets by status - // - // Multiple status values can be provided with comma separated strings - // - //Future> findPetsByStatus(List status) async - test('test findPetsByStatus', () async { - // TODO - }); - - // Finds Pets by tags - // - // Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - // - //Future> findPetsByTags(Set tags) async - test('test findPetsByTags', () async { - // TODO - }); - - // Find pet by ID - // - // Returns a single pet - // - //Future getPetById(int petId) async - test('test getPetById', () async { - // TODO - }); - - // Update an existing pet - // - //Future updatePet(Pet pet) async - test('test updatePet', () async { - // TODO - }); - - // Updates a pet in the store with form data - // - //Future updatePetWithForm(int petId, { String name, String status }) async - test('test updatePetWithForm', () async { - // TODO - }); - - // uploads an image - // - //Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async - test('test uploadFile', () async { - // TODO - }); - - // uploads an image (required) - // - //Future uploadFileWithRequiredFile(int petId, MultipartFile requiredFile, { String additionalMetadata }) async - test('test uploadFileWithRequiredFile', () async { - // TODO - }); - - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/pet_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/pet_test.dart deleted file mode 100644 index 23c26595c85c..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/pet_test.dart +++ /dev/null @@ -1,52 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Pet -void main() { - final instance = Pet(); - - group('test Pet', () { - // int id - test('to test the property `id`', () async { - // TODO - }); - - // Category category - test('to test the property `category`', () async { - // TODO - }); - - // String name - test('to test the property `name`', () async { - // TODO - }); - - // Set photoUrls (default value: const {}) - test('to test the property `photoUrls`', () async { - // TODO - }); - - // List tags (default value: const []) - test('to test the property `tags`', () async { - // TODO - }); - - // pet status in the store - // String status - test('to test the property `status`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/read_only_first_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/read_only_first_test.dart deleted file mode 100644 index d3326fd494d0..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/read_only_first_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ReadOnlyFirst -void main() { - final instance = ReadOnlyFirst(); - - group('test ReadOnlyFirst', () { - // String bar - test('to test the property `bar`', () async { - // TODO - }); - - // String baz - test('to test the property `baz`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/special_model_name_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/special_model_name_test.dart deleted file mode 100644 index f3b461364fbe..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/special_model_name_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for SpecialModelName -void main() { - final instance = SpecialModelName(); - - group('test SpecialModelName', () { - // int dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket - test('to test the property `dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/store_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/store_api_test.dart deleted file mode 100644 index 4a7ed54abbbc..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/store_api_test.dart +++ /dev/null @@ -1,54 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for StoreApi -void main() { - final instance = StoreApi(); - - group('tests for StoreApi', () { - // Delete purchase order by ID - // - // For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - // - //Future deleteOrder(String orderId) async - test('test deleteOrder', () async { - // TODO - }); - - // Returns pet inventories by status - // - // Returns a map of status codes to quantities - // - //Future> getInventory() async - test('test getInventory', () async { - // TODO - }); - - // Find purchase order by ID - // - // For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - // - //Future getOrderById(int orderId) async - test('test getOrderById', () async { - // TODO - }); - - // Place an order for a pet - // - //Future placeOrder(Order order) async - test('test placeOrder', () async { - // TODO - }); - - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/tag_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/tag_test.dart deleted file mode 100644 index 66ecdfe488dc..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/tag_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Tag -void main() { - final instance = Tag(); - - group('test Tag', () { - // int id - test('to test the property `id`', () async { - // TODO - }); - - // String name - test('to test the property `name`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/user_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/user_api_test.dart deleted file mode 100644 index 73ee89a29451..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/user_api_test.dart +++ /dev/null @@ -1,82 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for UserApi -void main() { - final instance = UserApi(); - - group('tests for UserApi', () { - // Create user - // - // This can only be done by the logged in user. - // - //Future createUser(User user) async - test('test createUser', () async { - // TODO - }); - - // Creates list of users with given input array - // - //Future createUsersWithArrayInput(List user) async - test('test createUsersWithArrayInput', () async { - // TODO - }); - - // Creates list of users with given input array - // - //Future createUsersWithListInput(List user) async - test('test createUsersWithListInput', () async { - // TODO - }); - - // Delete user - // - // This can only be done by the logged in user. - // - //Future deleteUser(String username) async - test('test deleteUser', () async { - // TODO - }); - - // Get user by user name - // - //Future getUserByName(String username) async - test('test getUserByName', () async { - // TODO - }); - - // Logs user into the system - // - //Future loginUser(String username, String password) async - test('test loginUser', () async { - // TODO - }); - - // Logs out current logged in user session - // - //Future logoutUser() async - test('test logoutUser', () async { - // TODO - }); - - // Updated user - // - // This can only be done by the logged in user. - // - //Future updateUser(String username, User user) async - test('test updateUser', () async { - // TODO - }); - - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/user_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/user_test.dart deleted file mode 100644 index b89cd360489d..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/user_test.dart +++ /dev/null @@ -1,62 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for User -void main() { - final instance = User(); - - group('test User', () { - // int id - test('to test the property `id`', () async { - // TODO - }); - - // String username - test('to test the property `username`', () async { - // TODO - }); - - // String firstName - test('to test the property `firstName`', () async { - // TODO - }); - - // String lastName - test('to test the property `lastName`', () async { - // TODO - }); - - // String email - test('to test the property `email`', () async { - // TODO - }); - - // String password - test('to test the property `password`', () async { - // TODO - }); - - // String phone - test('to test the property `phone`', () async { - // TODO - }); - - // User Status - // int userStatus - test('to test the property `userStatus`', () async { - // TODO - }); - - - }); - -}