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 01/39] 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 02/39] 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 - }); - - - }); - -} From 14d32064b6cd75e260b1f3e52124dc0f7f91aa36 Mon Sep 17 00:00:00 2001 From: agilob Date: Tue, 12 Oct 2021 22:37:26 +0100 Subject: [PATCH 03/39] Re-add deleted test files --- .../languages/AbstractDartCodegen.java | 3 + .../main/resources/dart2/api_test.mustache | 29 ++++ .../main/resources/dart2/model_test.mustache | 29 ++++ .../.openapi-generator/FILES | 9 ++ .../test/api_response_test.dart | 37 +++++ .../test/category_test.dart | 32 ++++ .../petstore_client_lib/test/order_test.dart | 53 +++++++ .../test/pet_api_test.dart | 83 ++++++++++ .../petstore_client_lib/test/pet_test.dart | 53 +++++++ .../test/store_api_test.dart | 55 +++++++ .../petstore_client_lib/test/tag_test.dart | 32 ++++ .../test/user_api_test.dart | 83 ++++++++++ .../petstore_client_lib/test/user_test.dart | 63 ++++++++ .../.openapi-generator/FILES | 53 +++++++ .../additional_properties_class_test.dart | 32 ++++ .../test/animal_test.dart | 32 ++++ .../test/another_fake_api_test.dart | 30 ++++ .../test/api_response_test.dart | 37 +++++ .../array_of_array_of_number_only_test.dart | 27 ++++ .../test/array_of_number_only_test.dart | 27 ++++ .../test/array_test_test.dart | 37 +++++ .../test/capitalization_test.dart | 53 +++++++ .../test/cat_all_of_test.dart | 27 ++++ .../test/cat_test.dart | 37 +++++ .../test/category_test.dart | 32 ++++ .../test/class_model_test.dart | 27 ++++ .../test/default_api_test.dart | 26 ++++ .../test/deprecated_object_test.dart | 27 ++++ .../test/dog_all_of_test.dart | 27 ++++ .../test/dog_test.dart | 37 +++++ .../test/enum_arrays_test.dart | 32 ++++ .../test/enum_class_test.dart | 21 +++ .../test/enum_test_test.dart | 62 ++++++++ .../test/fake_api_test.dart | 146 ++++++++++++++++++ .../test/fake_classname_tags123_api_test.dart | 30 ++++ .../test/file_schema_test_class_test.dart | 32 ++++ .../test/foo_test.dart | 27 ++++ .../test/format_test_test.dart | 104 +++++++++++++ .../test/has_only_read_only_test.dart | 32 ++++ .../test/health_check_result_test.dart | 27 ++++ .../test/inline_response_default_test.dart | 27 ++++ .../test/map_test_test.dart | 42 +++++ ..._and_additional_properties_class_test.dart | 37 +++++ .../test/model200_response_test.dart | 32 ++++ .../test/model_client_test.dart | 27 ++++ .../test/model_file_test.dart | 28 ++++ .../test/model_list_test.dart | 27 ++++ .../test/model_return_test.dart | 27 ++++ .../test/name_test.dart | 42 +++++ .../test/nullable_class_test.dart | 82 ++++++++++ .../test/number_only_test.dart | 27 ++++ .../object_with_deprecated_fields_test.dart | 42 +++++ .../test/order_test.dart | 53 +++++++ .../test/outer_composite_test.dart | 37 +++++ .../test/outer_enum_default_value_test.dart | 21 +++ ...outer_enum_integer_default_value_test.dart | 21 +++ .../test/outer_enum_integer_test.dart | 21 +++ .../test/outer_enum_test.dart | 21 +++ .../outer_object_with_enum_property_test.dart | 27 ++++ .../test/pet_api_test.dart | 90 +++++++++++ .../test/pet_test.dart | 53 +++++++ .../test/read_only_first_test.dart | 32 ++++ .../test/special_model_name_test.dart | 27 ++++ .../test/store_api_test.dart | 55 +++++++ .../test/tag_test.dart | 32 ++++ .../test/user_api_test.dart | 83 ++++++++++ .../test/user_test.dart | 63 ++++++++ 67 files changed, 2718 insertions(+) create mode 100644 modules/openapi-generator/src/main/resources/dart2/api_test.mustache create mode 100644 modules/openapi-generator/src/main/resources/dart2/model_test.mustache create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/api_response_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/category_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/order_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/store_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/tag_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/additional_properties_class_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/animal_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/another_fake_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/api_response_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_array_of_number_only_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_number_only_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_test_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/capitalization_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_all_of_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/category_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/class_model_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/default_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/deprecated_object_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_all_of_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_arrays_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_class_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_test_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_classname_tags123_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/file_schema_test_class_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/foo_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/format_test_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/has_only_read_only_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/health_check_result_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_response_default_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/map_test_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model200_response_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_client_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_file_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_list_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_return_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/name_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/nullable_class_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/number_only_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/object_with_deprecated_fields_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/order_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_composite_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_default_value_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_default_value_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_object_with_enum_property_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/read_only_first_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/special_model_name_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/store_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/tag_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_test.dart 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 ec1494c29a1f..e0a2f0bdfe34 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,6 +98,9 @@ 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"), diff --git a/modules/openapi-generator/src/main/resources/dart2/api_test.mustache b/modules/openapi-generator/src/main/resources/dart2/api_test.mustache new file mode 100644 index 000000000000..319945b2c3b5 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart2/api_test.mustache @@ -0,0 +1,29 @@ +{{>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/model_test.mustache b/modules/openapi-generator/src/main/resources/dart2/model_test.mustache new file mode 100644 index 000000000000..5d4f1c161c52 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart2/model_test.mustache @@ -0,0 +1,29 @@ +{{>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/samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator/FILES index 733ecbe30622..f8469eb1644a 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator/FILES @@ -31,3 +31,12 @@ lib/model/pet.dart lib/model/tag.dart lib/model/user.dart pubspec.yaml +test/api_response_test.dart +test/category_test.dart +test/order_test.dart +test/pet_api_test.dart +test/pet_test.dart +test/store_api_test.dart +test/tag_test.dart +test/user_api_test.dart +test/user_test.dart 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 new file mode 100644 index 000000000000..f430af15d42f --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/api_response_test.dart @@ -0,0 +1,37 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..5444937d5429 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/category_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..daaa4a238417 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/order_test.dart @@ -0,0 +1,53 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..b49f5e99547e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_api_test.dart @@ -0,0 +1,83 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..3a30b8afed22 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_test.dart @@ -0,0 +1,53 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..ed229fde3e49 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/store_api_test.dart @@ -0,0 +1,55 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..3cac49435577 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/tag_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..4da72ffbda2e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_api_test.dart @@ -0,0 +1,83 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..7e6eb1ba9d3a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_test.dart @@ -0,0 +1,63 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES index 15809529435e..ed25217aaa7d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES @@ -119,3 +119,56 @@ lib/model/special_model_name.dart lib/model/tag.dart lib/model/user.dart pubspec.yaml +test/additional_properties_class_test.dart +test/animal_test.dart +test/another_fake_api_test.dart +test/api_response_test.dart +test/array_of_array_of_number_only_test.dart +test/array_of_number_only_test.dart +test/array_test_test.dart +test/capitalization_test.dart +test/cat_all_of_test.dart +test/cat_test.dart +test/category_test.dart +test/class_model_test.dart +test/default_api_test.dart +test/deprecated_object_test.dart +test/dog_all_of_test.dart +test/dog_test.dart +test/enum_arrays_test.dart +test/enum_class_test.dart +test/enum_test_test.dart +test/fake_api_test.dart +test/fake_classname_tags123_api_test.dart +test/file_schema_test_class_test.dart +test/foo_test.dart +test/format_test_test.dart +test/has_only_read_only_test.dart +test/health_check_result_test.dart +test/inline_response_default_test.dart +test/map_test_test.dart +test/mixed_properties_and_additional_properties_class_test.dart +test/model200_response_test.dart +test/model_client_test.dart +test/model_file_test.dart +test/model_list_test.dart +test/model_return_test.dart +test/name_test.dart +test/nullable_class_test.dart +test/number_only_test.dart +test/object_with_deprecated_fields_test.dart +test/order_test.dart +test/outer_composite_test.dart +test/outer_enum_default_value_test.dart +test/outer_enum_integer_default_value_test.dart +test/outer_enum_integer_test.dart +test/outer_enum_test.dart +test/outer_object_with_enum_property_test.dart +test/pet_api_test.dart +test/pet_test.dart +test/read_only_first_test.dart +test/special_model_name_test.dart +test/store_api_test.dart +test/tag_test.dart +test/user_api_test.dart +test/user_test.dart 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 new file mode 100644 index 000000000000..0afc687f94d7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/additional_properties_class_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..b41d7362f8ea --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/animal_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..a00ad691a81c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/another_fake_api_test.dart @@ -0,0 +1,30 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..f430af15d42f --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/api_response_test.dart @@ -0,0 +1,37 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..c2648dde7a02 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_array_of_number_only_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..27e7f2295fb2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_number_only_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..75520cf53dd3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_test_test.dart @@ -0,0 +1,37 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..834412a48922 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/capitalization_test.dart @@ -0,0 +1,53 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..e427d6d110d8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_all_of_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..3b11870cd2fe --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_test.dart @@ -0,0 +1,37 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..21dd7202b112 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/category_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..5372bad38c57 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/class_model_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..176860d62237 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/default_api_test.dart @@ -0,0 +1,26 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..17b55967b044 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/deprecated_object_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..4f6aa6a11081 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_all_of_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..5816888169ce --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_test.dart @@ -0,0 +1,37 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..db1f5fcf1e41 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_arrays_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..048f4f4223c9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_class_test.dart @@ -0,0 +1,21 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..519f578023ff --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_test_test.dart @@ -0,0 +1,62 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..ba7aedca186a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_api_test.dart @@ -0,0 +1,146 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 has to be a binary file. + // + //Future> testBodyWithBinary(MultipartFile body) async + test('test testBodyWithBinary', () async { + // TODO + }); + + // For this test, the body for this request must 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, String allowEmpty, { Map language }) 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 new file mode 100644 index 000000000000..6d8586e981c2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_classname_tags123_api_test.dart @@ -0,0 +1,30 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..de19f413d9cd --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/file_schema_test_class_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..41358813749d --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/foo_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..5ac1b8d9c20f --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/format_test_test.dart @@ -0,0 +1,104 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..9d9750b53f60 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/has_only_read_only_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..475a03293389 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/health_check_result_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..ebaa2938c9d6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_response_default_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..5d0b72a56aa2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/map_test_test.dart @@ -0,0 +1,42 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..580337da3570 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart @@ -0,0 +1,37 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..926416dcce3b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model200_response_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..5fa410574c73 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_client_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..b1ea27738c30 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_file_test.dart @@ -0,0 +1,28 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..f99d009f8d42 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_list_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..49c9097abc35 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_return_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..5b7e111f045d --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/name_test.dart @@ -0,0 +1,42 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..51262ef6d50d --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/nullable_class_test.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..f5d660cc0de8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/number_only_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..4bfd78eb06b7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/object_with_deprecated_fields_test.dart @@ -0,0 +1,42 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..daaa4a238417 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/order_test.dart @@ -0,0 +1,53 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..9bfe086e93a7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_composite_test.dart @@ -0,0 +1,37 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..4a7ba6be2338 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_default_value_test.dart @@ -0,0 +1,21 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..a1b56f1bcf81 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_default_value_test.dart @@ -0,0 +1,21 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..428b76464f1a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_test.dart @@ -0,0 +1,21 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..a0dfb5d3fe2a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_test.dart @@ -0,0 +1,21 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..9facb11ef5f3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_object_with_enum_property_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..9cd13f6a31af --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_api_test.dart @@ -0,0 +1,90 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..9e4ced6f823e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_test.dart @@ -0,0 +1,53 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..213e1032b7e3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/read_only_first_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..995a92ce3cc7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/special_model_name_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..ed229fde3e49 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/store_api_test.dart @@ -0,0 +1,55 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..3cac49435577 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/tag_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..4da72ffbda2e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_api_test.dart @@ -0,0 +1,83 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 new file mode 100644 index 000000000000..7e6eb1ba9d3a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_test.dart @@ -0,0 +1,63 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.14 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// 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 + }); + + + }); + +} From 8387b25430924b9373f4e9b3a2c4f2f59f934074 Mon Sep 17 00:00:00 2001 From: agilob Date: Tue, 12 Oct 2021 22:39:30 +0100 Subject: [PATCH 04/39] Lower dart version to 2.12 --- .../src/main/resources/dart2/README.mustache | 2 +- .../main/resources/dart2/auth/header.mustache | 2 +- .../src/main/resources/dart2/header.mustache | 2 +- .../src/main/resources/dart2/travis.mustache | 2 +- .../.openapi-generator/FILES | 9 ---- .../dart2/petstore_client_lib/.travis.yml | 2 +- .../dart2/petstore_client_lib/README.md | 2 +- .../dart2/petstore_client_lib/lib/api.dart | 2 +- .../petstore_client_lib/lib/api/pet_api.dart | 2 +- .../lib/api/store_api.dart | 2 +- .../petstore_client_lib/lib/api/user_api.dart | 2 +- .../petstore_client_lib/lib/api_client.dart | 2 +- .../lib/api_exception.dart | 2 +- .../petstore_client_lib/lib/api_helper.dart | 2 +- .../lib/auth/api_key_auth.dart | 2 +- .../lib/auth/authentication.dart | 2 +- .../lib/auth/http_basic_auth.dart | 2 +- .../lib/auth/http_bearer_auth.dart | 2 +- .../petstore_client_lib/lib/auth/oauth.dart | 2 +- .../lib/model/api_response.dart | 2 +- .../lib/model/category.dart | 2 +- .../petstore_client_lib/lib/model/order.dart | 2 +- .../petstore_client_lib/lib/model/pet.dart | 2 +- .../petstore_client_lib/lib/model/tag.dart | 2 +- .../petstore_client_lib/lib/model/user.dart | 2 +- .../.openapi-generator/FILES | 53 ------------------- .../petstore_client_lib_fake/.travis.yml | 2 +- .../dart2/petstore_client_lib_fake/README.md | 2 +- .../petstore_client_lib_fake/lib/api.dart | 2 +- .../lib/api/another_fake_api.dart | 2 +- .../lib/api/default_api.dart | 2 +- .../lib/api/fake_api.dart | 2 +- .../lib/api/fake_classname_tags123_api.dart | 2 +- .../lib/api/pet_api.dart | 2 +- .../lib/api/store_api.dart | 2 +- .../lib/api/user_api.dart | 2 +- .../lib/api_client.dart | 2 +- .../lib/api_exception.dart | 2 +- .../lib/api_helper.dart | 2 +- .../lib/auth/api_key_auth.dart | 2 +- .../lib/auth/authentication.dart | 2 +- .../lib/auth/http_basic_auth.dart | 2 +- .../lib/auth/http_bearer_auth.dart | 2 +- .../lib/auth/oauth.dart | 2 +- .../model/additional_properties_class.dart | 2 +- .../lib/model/animal.dart | 2 +- .../lib/model/api_response.dart | 2 +- .../model/array_of_array_of_number_only.dart | 2 +- .../lib/model/array_of_number_only.dart | 2 +- .../lib/model/array_test.dart | 2 +- .../lib/model/capitalization.dart | 2 +- .../lib/model/cat.dart | 2 +- .../lib/model/cat_all_of.dart | 2 +- .../lib/model/category.dart | 2 +- .../lib/model/class_model.dart | 2 +- .../lib/model/deprecated_object.dart | 2 +- .../lib/model/dog.dart | 2 +- .../lib/model/dog_all_of.dart | 2 +- .../lib/model/enum_arrays.dart | 2 +- .../lib/model/enum_class.dart | 2 +- .../lib/model/enum_test.dart | 2 +- .../lib/model/file_schema_test_class.dart | 2 +- .../lib/model/foo.dart | 2 +- .../lib/model/format_test.dart | 2 +- .../lib/model/has_only_read_only.dart | 2 +- .../lib/model/health_check_result.dart | 2 +- .../lib/model/inline_response_default.dart | 2 +- .../lib/model/map_test.dart | 2 +- ...rties_and_additional_properties_class.dart | 2 +- .../lib/model/model200_response.dart | 2 +- .../lib/model/model_client.dart | 2 +- .../lib/model/model_file.dart | 2 +- .../lib/model/model_list.dart | 2 +- .../lib/model/model_return.dart | 2 +- .../lib/model/name.dart | 2 +- .../lib/model/nullable_class.dart | 2 +- .../lib/model/number_only.dart | 2 +- .../model/object_with_deprecated_fields.dart | 2 +- .../lib/model/order.dart | 2 +- .../lib/model/outer_composite.dart | 2 +- .../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 | 2 +- .../lib/model/pet.dart | 2 +- .../lib/model/read_only_first.dart | 2 +- .../lib/model/special_model_name.dart | 2 +- .../lib/model/tag.dart | 2 +- .../lib/model/user.dart | 2 +- 90 files changed, 88 insertions(+), 150 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/dart2/README.mustache b/modules/openapi-generator/src/main/resources/dart2/README.mustache index d3d86486807c..ba99ace33f36 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.14 or later +Dart 2.12 or later ## Installation & Usage 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 c41fc334d1c2..3799d9d04658 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.14 +// @dart=2.12 // 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/header.mustache b/modules/openapi-generator/src/main/resources/dart2/header.mustache index c41fc334d1c2..3799d9d04658 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.14 +// @dart=2.12 // 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/travis.mustache b/modules/openapi-generator/src/main/resources/dart2/travis.mustache index 86197dbb22c8..2774ccbba0e9 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.14.2" +- "2.12" install: - pub get diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator/FILES index f8469eb1644a..733ecbe30622 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator/FILES @@ -31,12 +31,3 @@ lib/model/pet.dart lib/model/tag.dart lib/model/user.dart pubspec.yaml -test/api_response_test.dart -test/category_test.dart -test/order_test.dart -test/pet_api_test.dart -test/pet_test.dart -test/store_api_test.dart -test/tag_test.dart -test/user_api_test.dart -test/user_test.dart 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 86197dbb22c8..2774ccbba0e9 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.14.2" +- "2.12" 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 5e981c61070f..dd7e2f923537 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.14 or later +Dart 2.12 or later ## Installation & Usage 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 c98ba2e71c9c..742bcfa11543 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.14 +// @dart=2.12 // 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 2c1a0a15302f..6e1989ac654f 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.14 +// @dart=2.12 // 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/store_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart index 2deab1a77ef6..efb38091aef0 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.14 +// @dart=2.12 // 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/user_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart index bb525c1a2b6e..44a3fd574fdd 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.14 +// @dart=2.12 // 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_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart index 45cdc6288bba..6957d076d7b7 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.14 +// @dart=2.12 // 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_exception.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_exception.dart index a01cb9f94a8c..796f7f7ee74e 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.14 +// @dart=2.12 // 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_helper.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_helper.dart index 9f7e83abbcc7..03bc620096b7 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.14 +// @dart=2.12 // 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/api_key_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart index abd569b5fb74..2af78a62bcf0 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.14 +// @dart=2.12 // 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/authentication.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart index 6a5eb38902e7..49baf7c46a9c 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.14 +// @dart=2.12 // 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 cb0211bd2559..978b513abdcc 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.14 +// @dart=2.12 // 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_bearer_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart index 8d2f6ddb0f89..07f105666dc0 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.14 +// @dart=2.12 // 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 1aecb2d3e671..66ec4cda0864 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.14 +// @dart=2.12 // 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/model/api_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart index 734fd7dfc050..794799e433a2 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.14 +// @dart=2.12 // 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/model/category.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/category.dart index 4b743901eac2..130eb41286df 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.14 +// @dart=2.12 // 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/model/order.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart index 94761631bf4e..6879d1868e10 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.14 +// @dart=2.12 // 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/model/pet.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart index de0a37ffeb13..48f0d97e6faa 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.14 +// @dart=2.12 // 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/model/tag.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart index e23a04b1c36e..6966abac0d1f 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.14 +// @dart=2.12 // 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/model/user.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/user.dart index 8afafd11c536..7324ba6d01b8 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.14 +// @dart=2.12 // 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/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES index ed25217aaa7d..15809529435e 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES @@ -119,56 +119,3 @@ lib/model/special_model_name.dart lib/model/tag.dart lib/model/user.dart pubspec.yaml -test/additional_properties_class_test.dart -test/animal_test.dart -test/another_fake_api_test.dart -test/api_response_test.dart -test/array_of_array_of_number_only_test.dart -test/array_of_number_only_test.dart -test/array_test_test.dart -test/capitalization_test.dart -test/cat_all_of_test.dart -test/cat_test.dart -test/category_test.dart -test/class_model_test.dart -test/default_api_test.dart -test/deprecated_object_test.dart -test/dog_all_of_test.dart -test/dog_test.dart -test/enum_arrays_test.dart -test/enum_class_test.dart -test/enum_test_test.dart -test/fake_api_test.dart -test/fake_classname_tags123_api_test.dart -test/file_schema_test_class_test.dart -test/foo_test.dart -test/format_test_test.dart -test/has_only_read_only_test.dart -test/health_check_result_test.dart -test/inline_response_default_test.dart -test/map_test_test.dart -test/mixed_properties_and_additional_properties_class_test.dart -test/model200_response_test.dart -test/model_client_test.dart -test/model_file_test.dart -test/model_list_test.dart -test/model_return_test.dart -test/name_test.dart -test/nullable_class_test.dart -test/number_only_test.dart -test/object_with_deprecated_fields_test.dart -test/order_test.dart -test/outer_composite_test.dart -test/outer_enum_default_value_test.dart -test/outer_enum_integer_default_value_test.dart -test/outer_enum_integer_test.dart -test/outer_enum_test.dart -test/outer_object_with_enum_property_test.dart -test/pet_api_test.dart -test/pet_test.dart -test/read_only_first_test.dart -test/special_model_name_test.dart -test/store_api_test.dart -test/tag_test.dart -test/user_api_test.dart -test/user_test.dart 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 86197dbb22c8..2774ccbba0e9 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.14.2" +- "2.12" 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 faa893ff1b1e..408714551412 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.14 or later +Dart 2.12 or later ## Installation & Usage 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 1e655a5a9ef3..48f61a0d5f5d 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.14 +// @dart=2.12 // 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 ca2036462338..349b54ce5ee4 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.14 +// @dart=2.12 // 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/default_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart index 29d6542ca5d9..24ff987cd3f3 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.14 +// @dart=2.12 // 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/fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart index 9d3d057601bc..a9c4fa54244a 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.14 +// @dart=2.12 // 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/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart index 6848872ac4a3..73e8973d2ce4 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.14 +// @dart=2.12 // 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/pet_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart index e604cb0fc879..6d40c3d256ba 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.14 +// @dart=2.12 // 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/store_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/store_api.dart index 5dbe6aaba29d..a6847ca18f99 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.14 +// @dart=2.12 // 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/user_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/user_api.dart index 2afba7da99fb..9b9e5edd5cb0 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.14 +// @dart=2.12 // 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_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart index 6a2f433bb23e..0dc275fb2add 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.14 +// @dart=2.12 // 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_exception.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_exception.dart index a01cb9f94a8c..796f7f7ee74e 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.14 +// @dart=2.12 // 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_helper.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_helper.dart index beb8bfa27f04..72aec21e8f1a 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.14 +// @dart=2.12 // 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/api_key_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/api_key_auth.dart index abd569b5fb74..2af78a62bcf0 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.14 +// @dart=2.12 // 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/authentication.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/authentication.dart index 6a5eb38902e7..49baf7c46a9c 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.14 +// @dart=2.12 // 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 cb0211bd2559..978b513abdcc 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.14 +// @dart=2.12 // 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_bearer_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_bearer_auth.dart index 8d2f6ddb0f89..07f105666dc0 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.14 +// @dart=2.12 // 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 1aecb2d3e671..66ec4cda0864 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.14 +// @dart=2.12 // 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/model/additional_properties_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/additional_properties_class.dart index 44c68719a4b1..ceb0f35cb930 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.14 +// @dart=2.12 // 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/model/animal.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart index 6afb6467961f..15e84c725f1d 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.14 +// @dart=2.12 // 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/model/api_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/api_response.dart index 734fd7dfc050..794799e433a2 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.14 +// @dart=2.12 // 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/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 704f51efc485..32ae30aaacac 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.14 +// @dart=2.12 // 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/model/array_of_number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_number_only.dart index ab336203e40e..ca95a3ac9a59 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.14 +// @dart=2.12 // 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/model/array_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_test.dart index febb3cf7a382..2a356c1d4872 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.14 +// @dart=2.12 // 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/model/capitalization.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/capitalization.dart index aa03db6d6e5f..381599788e03 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.14 +// @dart=2.12 // 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/model/cat.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart index c3d64f701272..7203bef0ce94 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.14 +// @dart=2.12 // 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/model/cat_all_of.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat_all_of.dart index f09e1206d76c..e2ff24127f1e 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.14 +// @dart=2.12 // 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/model/category.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/category.dart index 29b8cb353dcb..6f3ab498059b 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.14 +// @dart=2.12 // 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/model/class_model.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/class_model.dart index bb8722ab1812..c6228fdd53e2 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.14 +// @dart=2.12 // 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/model/deprecated_object.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/deprecated_object.dart index bb9088a1d85e..ec364b6d7480 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.14 +// @dart=2.12 // 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/model/dog.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart index 3e5e3502b93f..1398b41bbd6c 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.14 +// @dart=2.12 // 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/model/dog_all_of.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog_all_of.dart index d050b885f9d5..bc338a878082 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.14 +// @dart=2.12 // 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/model/enum_arrays.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart index c7138f35720a..da344a268419 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.14 +// @dart=2.12 // 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/model/enum_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_class.dart index dd8ae5138bbb..3b72c0674936 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.14 +// @dart=2.12 // 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/model/enum_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart index 8ed7b95c2fec..8e2cf3ca4a15 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.14 +// @dart=2.12 // 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/model/file_schema_test_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/file_schema_test_class.dart index 2472f89c3593..5406ef54b4ec 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.14 +// @dart=2.12 // 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/model/foo.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo.dart index cde11a705614..0cea19939846 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.14 +// @dart=2.12 // 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/model/format_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/format_test.dart index b35530e111cc..b1fb7517ebc4 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.14 +// @dart=2.12 // 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/model/has_only_read_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/has_only_read_only.dart index 7a374dadcaad..c931608c5142 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.14 +// @dart=2.12 // 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/model/health_check_result.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/health_check_result.dart index 3066119e00d0..9bd6a6bf1315 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.14 +// @dart=2.12 // 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/model/inline_response_default.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_response_default.dart index 042020b1e74d..5cadde36e695 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.14 +// @dart=2.12 // 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/model/map_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart index e9b9b1ec02e1..428a03fae1e3 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.14 +// @dart=2.12 // 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/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 5a3849f632a8..238164f5806b 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.14 +// @dart=2.12 // 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/model/model200_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model200_response.dart index 2412a820c176..e514e69f6619 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.14 +// @dart=2.12 // 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/model/model_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_client.dart index a005c0eddbf0..a5a7c91c422b 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.14 +// @dart=2.12 // 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/model/model_file.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_file.dart index 873819dc91e6..37437e1bbaff 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.14 +// @dart=2.12 // 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/model/model_list.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_list.dart index 96d33f818209..f1c1b8a57990 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.14 +// @dart=2.12 // 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/model/model_return.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_return.dart index b7a70dec9b6a..aefd97aa3bef 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.14 +// @dart=2.12 // 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/model/name.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/name.dart index 09fa45e5638e..669e8293df87 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.14 +// @dart=2.12 // 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/model/nullable_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/nullable_class.dart index c6ae36b497c1..38d389ff96ef 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.14 +// @dart=2.12 // 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/model/number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/number_only.dart index 64a29725e24c..cbbb4908f4ff 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.14 +// @dart=2.12 // 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/model/object_with_deprecated_fields.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/object_with_deprecated_fields.dart index 3b2295f89fac..068a1b6d1db4 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.14 +// @dart=2.12 // 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/model/order.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart index 94761631bf4e..6879d1868e10 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.14 +// @dart=2.12 // 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/model/outer_composite.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_composite.dart index 04b07892308b..c9050d662aef 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.14 +// @dart=2.12 // 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/model/outer_enum.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum.dart index 6060149f0e37..a146bf506cba 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.14 +// @dart=2.12 // 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/model/outer_enum_default_value.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_default_value.dart index 7b334b1b082c..686667afa27e 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.14 +// @dart=2.12 // 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/model/outer_enum_integer.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer.dart index f25026a0c057..4f74ef2d264d 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.14 +// @dart=2.12 // 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/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 aaa012153cf3..65d61f66cc1b 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.14 +// @dart=2.12 // 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/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 e59dc888ddbc..68bb42944050 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.14 +// @dart=2.12 // 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/model/pet.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart index e4b997f11b33..f8b0e5ba16a1 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.14 +// @dart=2.12 // 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/model/read_only_first.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/read_only_first.dart index 01a6620ee722..bdfb3ede8aa0 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.14 +// @dart=2.12 // 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/model/special_model_name.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/special_model_name.dart index 3847a3bcea0f..743c6a17313f 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.14 +// @dart=2.12 // 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/model/tag.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/tag.dart index e23a04b1c36e..6966abac0d1f 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.14 +// @dart=2.12 // 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/model/user.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/user.dart index 8afafd11c536..7324ba6d01b8 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.14 +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first From f449f9659f6074e31b6dc79244e55808f0388fdb Mon Sep 17 00:00:00 2001 From: agilob Date: Tue, 12 Oct 2021 22:41:46 +0100 Subject: [PATCH 05/39] Make username and pass not null in http basic auth --- .../main/resources/dart2/auth/http_basic_auth.mustache | 9 ++++++--- .../petstore_client_lib/lib/auth/http_basic_auth.dart | 9 ++++++--- .../lib/auth/http_basic_auth.dart | 9 ++++++--- 3 files changed, 18 insertions(+), 9 deletions(-) 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 2f6a542f5d54..8bbf21af1c9a 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,12 +1,15 @@ {{>header}} {{>part_of}} class HttpBasicAuth implements Authentication { - String? username; - String? password; + + HttpBasicAuth(this.username, this.password); + + String username; + String password; @override void applyToParams(List queryParams, Map headerParams) { - final credentials = '${username ?? ''}:${password ?? ''}'; + final credentials = '${username}:${password}'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; } } 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 978b513abdcc..4ac4528c27ca 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 @@ -11,12 +11,15 @@ part of openapi.api; class HttpBasicAuth implements Authentication { - String? username; - String? password; + + HttpBasicAuth(this.username, this.password); + + String username; + String password; @override void applyToParams(List queryParams, Map headerParams) { - final credentials = '${username ?? ''}:${password ?? ''}'; + final credentials = '${username}:${password}'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; } } 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 978b513abdcc..4ac4528c27ca 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 @@ -11,12 +11,15 @@ part of openapi.api; class HttpBasicAuth implements Authentication { - String? username; - String? password; + + HttpBasicAuth(this.username, this.password); + + String username; + String password; @override void applyToParams(List queryParams, Map headerParams) { - final credentials = '${username ?? ''}:${password ?? ''}'; + final credentials = '${username}:${password}'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; } } From 932964b8aba1be62bfe78f21f444c1eda48e15a9 Mon Sep 17 00:00:00 2001 From: agilob Date: Tue, 19 Oct 2021 15:34:49 +0100 Subject: [PATCH 06/39] Delete json_serializable --- .../json_serializable_class.mustache | 67 - .../.gitignore | 17 - .../.travis.yml | 14 - .../README.md | 193 --- .../doc/FakeApi.md | 826 ----------- .../doc/NullableClass.md | 26 - .../doc/PetApi.md | 431 ------ .../doc/StoreApi.md | 187 --- .../doc/UserApi.md | 355 ----- .../lib/api.dart | 95 -- .../lib/api/another_fake_api.dart | 77 - .../lib/api/default_api.dart | 60 - .../lib/api/fake_api.dart | 1249 ----------------- .../lib/api/fake_classname_tags123_api.dart | 77 - .../lib/api/pet_api.dart | 616 -------- .../lib/api/store_api.dart | 242 ---- .../lib/api/user_api.dart | 478 ------- .../lib/api_client.dart | 168 --- .../lib/api_exception.dart | 33 - .../lib/api_helper.dart | 109 -- .../lib/auth/api_key_auth.dart | 38 - .../lib/auth/authentication.dart | 17 - .../lib/auth/http_basic_auth.dart | 22 - .../lib/auth/http_bearer_auth.dart | 39 - .../lib/auth/oauth.dart | 24 - .../model/additional_properties_class.dart | 58 - .../lib/model/animal.dart | 57 - .../lib/model/api_response.dart | 65 - .../model/array_of_array_of_number_only.dart | 48 - .../lib/model/array_of_number_only.dart | 48 - .../lib/model/array_test.dart | 68 - .../lib/model/capitalization.dart | 93 -- .../lib/model/cat.dart | 66 - .../lib/model/cat_all_of.dart | 47 - .../lib/model/category.dart | 57 - .../lib/model/class_model.dart | 47 - .../lib/model/deprecated_object.dart | 47 - .../lib/model/dog.dart | 66 - .../lib/model/dog_all_of.dart | 47 - .../lib/model/enum_arrays.dart | 69 - .../lib/model/enum_class.dart | 17 - .../lib/model/enum_test.dart | 136 -- .../lib/model/file_schema_test_class.dart | 57 - .../lib/model/foo.dart | 48 - .../lib/model/format_test.dart | 191 --- .../lib/model/has_only_read_only.dart | 56 - .../lib/model/health_check_result.dart | 47 - .../lib/model/inline_response_default.dart | 47 - .../lib/model/map_test.dart | 84 -- ...rties_and_additional_properties_class.dart | 66 - .../lib/model/model200_response.dart | 56 - .../lib/model/model_client.dart | 47 - .../lib/model/model_file.dart | 48 - .../lib/model/model_list.dart | 47 - .../lib/model/model_return.dart | 47 - .../lib/model/name.dart | 74 - .../lib/model/nullable_class.dart | 152 -- .../lib/model/number_only.dart | 47 - .../model/object_with_deprecated_fields.dart | 75 - .../lib/model/order.dart | 101 -- .../lib/model/outer_composite.dart | 65 - .../lib/model/outer_enum.dart | 17 - .../lib/model/outer_enum_default_value.dart | 17 - .../lib/model/outer_enum_integer.dart | 17 - .../outer_enum_integer_default_value.dart | 17 - .../outer_object_with_enum_property.dart | 47 - .../lib/model/pet.dart | 102 -- .../lib/model/read_only_first.dart | 56 - .../lib/model/special_model_name.dart | 47 - .../lib/model/tag.dart | 56 - .../lib/model/user.dart | 111 -- .../pubspec.yaml | 17 - 72 files changed, 8355 deletions(-) delete mode 100644 modules/openapi-generator/src/main/resources/dart2/serialization/json_serializable/json_serializable_class.mustache delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.gitignore delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.travis.yml delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/README.md delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeApi.md delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/NullableClass.md delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/PetApi.md delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/StoreApi.md delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/UserApi.md delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/another_fake_api.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/default_api.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_api.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_classname_tags123_api.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/pet_api.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/store_api.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/user_api.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_client.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_exception.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_helper.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/api_key_auth.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/authentication.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_basic_auth.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_bearer_auth.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/oauth.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/additional_properties_class.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/animal.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/api_response.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_array_of_number_only.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_number_only.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/capitalization.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat_all_of.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/category.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/class_model.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/deprecated_object.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog_all_of.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_arrays.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_class.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/file_schema_test_class.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/foo.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/format_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/has_only_read_only.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/health_check_result.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/inline_response_default.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/map_test.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model200_response.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_client.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_file.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_list.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_return.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/name.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/nullable_class.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/number_only.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/object_with_deprecated_fields.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/order.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_composite.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_default_value.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer_default_value.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_object_with_enum_property.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/pet.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/read_only_first.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/special_model_name.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/tag.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/user.dart delete mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/pubspec.yaml 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 deleted file mode 100644 index 0e57b0ecff37..000000000000 --- a/modules/openapi-generator/src/main/resources/dart2/serialization/json_serializable/json_serializable_class.mustache +++ /dev/null @@ -1,67 +0,0 @@ -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class {{{classname}}} { -{{>dart_constructor}} - -{{#vars}} - {{#description}} - /// {{{.}}} - {{/description}} - {{^isEnum}} - {{#minimum}} - // minimum: {{{.}}} - {{/minimum}} - {{#maximum}} - // maximum: {{{.}}} - {{/maximum}} - {{/isEnum}} - {{^isBinary}} - @JsonKey( - {{#defaultValue}}defaultValue: {{{.}}}, - {{/defaultValue}}name: r'{{{baseName}}}', - required: {{#required}}true{{/required}}{{^required}}false{{/required}}, - ) - {{/isBinary}} - {{#isBinary}} - @JsonKey(ignore: true) - {{/isBinary}} - {{{datatypeWithEnum}}}{{^required}}?{{/required}} {{{name}}}; - -{{/vars}} - @override - bool operator ==(Object other) => identical(this, other) || other is {{{classname}}} && - {{#vars}} - other.{{{name}}} == {{{name}}}{{^-last}} &&{{/-last}}{{#-last}};{{/-last}} - {{/vars}} - - @override - int get hashCode => - {{#vars}} - {{{name}}}.hashCode{{^-last}} +{{/-last}}{{#-last}};{{/-last}} - {{/vars}} - - factory {{{classname}}}.fromJson(Map json) => _${{{classname}}}FromJson(json); - - Map toJson() => _${{{classname}}}ToJson(this); - - @override - String toString() => toJson().toString(); -} -{{#vars}} - {{#isEnum}} - {{^isContainer}} - -{{>serialization/json_serializable/json_serializable_enum_inline}} - {{/isContainer}} - {{#isContainer}} - {{#mostInnerItems}} - -{{>serialization/json_serializable/json_serializable_enum_inline}} - {{/mostInnerItems}} - {{/isContainer}} - {{/isEnum}} -{{/vars}} 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 deleted file mode 100644 index 1be28ced0940..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -# See https://dart.dev/guides/libraries/private-files - -.dart_tool/ -.packages -build/ -pubspec.lock # Except for application packages - -doc/api/ - -# 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 deleted file mode 100644 index 86197dbb22c8..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -# -# AUTO-GENERATED FILE, DO NOT MODIFY! -# -# https://docs.travis-ci.com/user/languages/dart/ -# -language: dart -dart: -# Install a specific stable release -- "2.14.2" -install: -- pub get - -script: -- pub run test 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 deleted file mode 100644 index faa893ff1b1e..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/README.md +++ /dev/null @@ -1,193 +0,0 @@ -# openapi -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - -This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - -- API version: 1.0.0 -- Build package: org.openapitools.codegen.languages.DartClientCodegen - -## Requirements - -Dart 2.14 or later - -## Installation & Usage - -### Github -If this Dart package is published to Github, add the following dependency to your pubspec.yaml -``` -dependencies: - openapi: - git: https://github.com/GIT_USER_ID/GIT_REPO_ID.git -``` - -### Local -To use the package in your local drive, add the following dependency to your pubspec.yaml -``` -dependencies: - openapi: - path: /path/to/openapi -``` - -## Tests - -TODO - -## Getting Started - -Please follow the [installation procedure](#installation--usage) and then run the following: - -```dart -import 'package:openapi/api.dart'; - - -final api_instance = AnotherFakeApi(); -final modelClient = ModelClient(); // ModelClient | client model - -try { - final result = api_instance.call123testSpecialTags(modelClient); - print(result); -} catch (e) { - print('Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n'); -} - -``` - -## Documentation for API Endpoints - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*AnotherFakeApi* | [**call123testSpecialTags**](doc//AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags -*DefaultApi* | [**fooGet**](doc//DefaultApi.md#fooget) | **GET** /foo | -*FakeApi* | [**fakeHealthGet**](doc//FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint -*FakeApi* | [**fakeHttpSignatureTest**](doc//FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication -*FakeApi* | [**fakeOuterBooleanSerialize**](doc//FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | -*FakeApi* | [**fakeOuterCompositeSerialize**](doc//FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | -*FakeApi* | [**fakeOuterNumberSerialize**](doc//FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | -*FakeApi* | [**fakeOuterStringSerialize**](doc//FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | -*FakeApi* | [**fakePropertyEnumIntegerSerialize**](doc//FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | -*FakeApi* | [**testBodyWithBinary**](doc//FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary | -*FakeApi* | [**testBodyWithFileSchema**](doc//FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | -*FakeApi* | [**testBodyWithQueryParams**](doc//FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | -*FakeApi* | [**testClientModel**](doc//FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model -*FakeApi* | [**testEndpointParameters**](doc//FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -*FakeApi* | [**testEnumParameters**](doc//FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters -*FakeApi* | [**testGroupParameters**](doc//FakeApi.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) -*FakeApi* | [**testInlineAdditionalProperties**](doc//FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties -*FakeApi* | [**testJsonFormData**](doc//FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data -*FakeApi* | [**testQueryParameterCollectionFormat**](doc//FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters | -*FakeClassnameTags123Api* | [**testClassname**](doc//FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case -*PetApi* | [**addPet**](doc//PetApi.md#addpet) | **POST** /pet | Add a new pet to the store -*PetApi* | [**deletePet**](doc//PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet -*PetApi* | [**findPetsByStatus**](doc//PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status -*PetApi* | [**findPetsByTags**](doc//PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags -*PetApi* | [**getPetById**](doc//PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*PetApi* | [**updatePet**](doc//PetApi.md#updatepet) | **PUT** /pet | Update an existing pet -*PetApi* | [**updatePetWithForm**](doc//PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data -*PetApi* | [**uploadFile**](doc//PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image -*PetApi* | [**uploadFileWithRequiredFile**](doc//PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) -*StoreApi* | [**deleteOrder**](doc//StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID -*StoreApi* | [**getInventory**](doc//StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status -*StoreApi* | [**getOrderById**](doc//StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID -*StoreApi* | [**placeOrder**](doc//StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet -*UserApi* | [**createUser**](doc//UserApi.md#createuser) | **POST** /user | Create user -*UserApi* | [**createUsersWithArrayInput**](doc//UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array -*UserApi* | [**createUsersWithListInput**](doc//UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array -*UserApi* | [**deleteUser**](doc//UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user -*UserApi* | [**getUserByName**](doc//UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name -*UserApi* | [**loginUser**](doc//UserApi.md#loginuser) | **GET** /user/login | Logs user into the system -*UserApi* | [**logoutUser**](doc//UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session -*UserApi* | [**updateUser**](doc//UserApi.md#updateuser) | **PUT** /user/{username} | Updated user - - -## Documentation For Models - - - [AdditionalPropertiesClass](doc//AdditionalPropertiesClass.md) - - [Animal](doc//Animal.md) - - [ApiResponse](doc//ApiResponse.md) - - [ArrayOfArrayOfNumberOnly](doc//ArrayOfArrayOfNumberOnly.md) - - [ArrayOfNumberOnly](doc//ArrayOfNumberOnly.md) - - [ArrayTest](doc//ArrayTest.md) - - [Capitalization](doc//Capitalization.md) - - [Cat](doc//Cat.md) - - [CatAllOf](doc//CatAllOf.md) - - [Category](doc//Category.md) - - [ClassModel](doc//ClassModel.md) - - [DeprecatedObject](doc//DeprecatedObject.md) - - [Dog](doc//Dog.md) - - [DogAllOf](doc//DogAllOf.md) - - [EnumArrays](doc//EnumArrays.md) - - [EnumClass](doc//EnumClass.md) - - [EnumTest](doc//EnumTest.md) - - [FileSchemaTestClass](doc//FileSchemaTestClass.md) - - [Foo](doc//Foo.md) - - [FormatTest](doc//FormatTest.md) - - [HasOnlyReadOnly](doc//HasOnlyReadOnly.md) - - [HealthCheckResult](doc//HealthCheckResult.md) - - [InlineResponseDefault](doc//InlineResponseDefault.md) - - [MapTest](doc//MapTest.md) - - [MixedPropertiesAndAdditionalPropertiesClass](doc//MixedPropertiesAndAdditionalPropertiesClass.md) - - [Model200Response](doc//Model200Response.md) - - [ModelClient](doc//ModelClient.md) - - [ModelFile](doc//ModelFile.md) - - [ModelList](doc//ModelList.md) - - [ModelReturn](doc//ModelReturn.md) - - [Name](doc//Name.md) - - [NullableClass](doc//NullableClass.md) - - [NumberOnly](doc//NumberOnly.md) - - [ObjectWithDeprecatedFields](doc//ObjectWithDeprecatedFields.md) - - [Order](doc//Order.md) - - [OuterComposite](doc//OuterComposite.md) - - [OuterEnum](doc//OuterEnum.md) - - [OuterEnumDefaultValue](doc//OuterEnumDefaultValue.md) - - [OuterEnumInteger](doc//OuterEnumInteger.md) - - [OuterEnumIntegerDefaultValue](doc//OuterEnumIntegerDefaultValue.md) - - [OuterObjectWithEnumProperty](doc//OuterObjectWithEnumProperty.md) - - [Pet](doc//Pet.md) - - [ReadOnlyFirst](doc//ReadOnlyFirst.md) - - [SpecialModelName](doc//SpecialModelName.md) - - [Tag](doc//Tag.md) - - [User](doc//User.md) - - -## Documentation For Authorization - - -## api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - -## api_key_query - -- **Type**: API key -- **API key parameter name**: api_key_query -- **Location**: URL query string - -## bearer_test - -- **Type**: HTTP Bearer authentication - -## http_basic_test - -- **Type**: HTTP Basic authentication - -## http_signature_test - - -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - - -## Author - - - 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 deleted file mode 100644 index b22ee07386ec..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeApi.md +++ /dev/null @@ -1,826 +0,0 @@ -# openapi.api.FakeApi - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**fakeHealthGet**](FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint -[**fakeHttpSignatureTest**](FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication -[**fakeOuterBooleanSerialize**](FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | -[**fakeOuterCompositeSerialize**](FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | -[**fakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | -[**fakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | -[**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | -[**testBodyWithBinary**](FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary | -[**testBodyWithFileSchema**](FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | -[**testBodyWithQueryParams**](FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | -[**testClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model -[**testEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -[**testEnumParameters**](FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters -[**testGroupParameters**](FakeApi.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) -[**testInlineAdditionalProperties**](FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties -[**testJsonFormData**](FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data -[**testQueryParameterCollectionFormat**](FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters | - - -# **fakeHealthGet** -> HealthCheckResult fakeHealthGet() - -Health check endpoint - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); - -try { - final result = api_instance.fakeHealthGet(); - print(result); -} catch (e) { - print('Exception when calling FakeApi->fakeHealthGet: $e\n'); -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -[**HealthCheckResult**](HealthCheckResult.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -[[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** -> Map fakeHttpSignatureTest(pet, query1, header1) - -test http signature authentication - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final pet = Pet(); // Pet | Pet object that needs to be added to the store -final query1 = query1_example; // String | query parameter -final header1 = header1_example; // String | header parameter - -try { - final result = api_instance.fakeHttpSignatureTest(pet, query1, header1); - print(result); -} catch (e) { - print('Exception when calling FakeApi->fakeHttpSignatureTest: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | - **query1** | **String**| query parameter | [optional] - **header1** | **String**| header parameter | [optional] - -### Return type - -**Map** - -### Authorization - -[http_signature_test](../README.md#http_signature_test) - -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **fakeOuterBooleanSerialize** -> bool fakeOuterBooleanSerialize(body) - - - -Test serialization of outer boolean types - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final body = bool(); // bool | Input boolean as post body - -try { - final result = api_instance.fakeOuterBooleanSerialize(body); - print(result); -} catch (e) { - print('Exception when calling FakeApi->fakeOuterBooleanSerialize: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **bool**| Input boolean as post body | [optional] - -### Return type - -**bool** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: */* - -[[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) - -# **fakeOuterCompositeSerialize** -> OuterComposite fakeOuterCompositeSerialize(outerComposite) - - - -Test serialization of object with outer number type - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final outerComposite = OuterComposite(); // OuterComposite | Input composite as post body - -try { - final result = api_instance.fakeOuterCompositeSerialize(outerComposite); - print(result); -} catch (e) { - print('Exception when calling FakeApi->fakeOuterCompositeSerialize: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **outerComposite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] - -### Return type - -[**OuterComposite**](OuterComposite.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: */* - -[[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) - -# **fakeOuterNumberSerialize** -> num fakeOuterNumberSerialize(body) - - - -Test serialization of outer number types - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final body = num(); // num | Input number as post body - -try { - final result = api_instance.fakeOuterNumberSerialize(body); - print(result); -} catch (e) { - print('Exception when calling FakeApi->fakeOuterNumberSerialize: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **num**| Input number as post body | [optional] - -### Return type - -**num** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: */* - -[[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) - -# **fakeOuterStringSerialize** -> String fakeOuterStringSerialize(body) - - - -Test serialization of outer string types - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final body = String(); // String | Input string as post body - -try { - final result = api_instance.fakeOuterStringSerialize(body); - print(result); -} catch (e) { - print('Exception when calling FakeApi->fakeOuterStringSerialize: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **String**| Input string as post body | [optional] - -### Return type - -**String** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: */* - -[[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) - -# **fakePropertyEnumIntegerSerialize** -> OuterObjectWithEnumProperty fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty) - - - -Test serialization of enum (int) properties with examples - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final outerObjectWithEnumProperty = OuterObjectWithEnumProperty(); // OuterObjectWithEnumProperty | Input enum (int) as post body - -try { - final result = api_instance.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty); - print(result); -} catch (e) { - print('Exception when calling FakeApi->fakePropertyEnumIntegerSerialize: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **outerObjectWithEnumProperty** | [**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)| Input enum (int) as post body | - -### Return type - -[**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: */* - -[[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** -> Map testBodyWithBinary(body) - - - -For this test, the body has to be a binary file. - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final body = MultipartFile(); // MultipartFile | image to upload - -try { - final result = api_instance.testBodyWithBinary(body); - print(result); -} catch (e) { - print('Exception when calling FakeApi->testBodyWithBinary: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **MultipartFile**| image to upload | - -### Return type - -**Map** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: image/png - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **testBodyWithFileSchema** -> Map testBodyWithFileSchema(fileSchemaTestClass) - - - -For this test, the body for this request must reference a schema named `File`. - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final fileSchemaTestClass = FileSchemaTestClass(); // FileSchemaTestClass | - -try { - final result = api_instance.testBodyWithFileSchema(fileSchemaTestClass); - print(result); -} catch (e) { - print('Exception when calling FakeApi->testBodyWithFileSchema: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | - -### Return type - -**Map** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **testBodyWithQueryParams** -> Map testBodyWithQueryParams(query, user) - - - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final query = query_example; // String | -final user = User(); // User | - -try { - final result = api_instance.testBodyWithQueryParams(query, user); - print(result); -} catch (e) { - print('Exception when calling FakeApi->testBodyWithQueryParams: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **query** | **String**| | - **user** | [**User**](User.md)| | - -### Return type - -**Map** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **testClientModel** -> ModelClient testClientModel(modelClient) - -To test \"client\" model - -To test \"client\" model - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final modelClient = ModelClient(); // ModelClient | client model - -try { - final result = api_instance.testClientModel(modelClient); - print(result); -} catch (e) { - print('Exception when calling FakeApi->testClientModel: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **modelClient** | [**ModelClient**](ModelClient.md)| client model | - -### Return type - -[**ModelClient**](ModelClient.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[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** -> Map testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) - -Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - -Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure HTTP basic authorization: http_basic_test -//defaultApiClient.getAuthentication('http_basic_test').username = 'YOUR_USERNAME' -//defaultApiClient.getAuthentication('http_basic_test').password = 'YOUR_PASSWORD'; - -final api_instance = FakeApi(); -final number = 8.14; // num | None -final double_ = 1.2; // double | None -final patternWithoutDelimiter = patternWithoutDelimiter_example; // String | None -final byte = BYTE_ARRAY_DATA_HERE; // String | None -final integer = 56; // int | None -final int32 = 56; // int | None -final int64 = 789; // int | None -final float = 3.4; // double | None -final string = string_example; // String | None -final binary = BINARY_DATA_HERE; // MultipartFile | None -final date = 2013-10-20; // DateTime | None -final dateTime = 2013-10-20T19:20:30+01:00; // DateTime | None -final password = password_example; // String | None -final callback = callback_example; // String | None - -try { - 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'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **number** | **num**| None | - **double_** | **double**| None | - **patternWithoutDelimiter** | **String**| None | - **byte** | **String**| None | - **integer** | **int**| None | [optional] - **int32** | **int**| None | [optional] - **int64** | **int**| None | [optional] - **float** | **double**| None | [optional] - **string** | **String**| None | [optional] - **binary** | **MultipartFile**| None | [optional] - **date** | **DateTime**| None | [optional] - **dateTime** | **DateTime**| None | [optional] - **password** | **String**| None | [optional] - **callback** | **String**| None | [optional] - -### Return type - -**Map** - -### Authorization - -[http_basic_test](../README.md#http_basic_test) - -### HTTP request headers - - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **testEnumParameters** -> Map testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) - -To test enum parameters - -To test enum parameters - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final enumHeaderStringArray = []; // List | Header parameter enum test (string array) -final enumHeaderString = enumHeaderString_example; // String | Header parameter enum test (string) -final enumQueryStringArray = []; // List | Query parameter enum test (string array) -final enumQueryString = enumQueryString_example; // String | Query parameter enum test (string) -final enumQueryInteger = 56; // int | Query parameter enum test (double) -final enumQueryDouble = 1.2; // double | Query parameter enum test (double) -final enumFormStringArray = []; // List | Form parameter enum test (string array) -final enumFormString = enumFormString_example; // String | Form parameter enum test (string) - -try { - 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'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **enumHeaderStringArray** | [**List**](String.md)| Header parameter enum test (string array) | [optional] [default to const []] - **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to '-efg'] - **enumQueryStringArray** | [**List**](String.md)| Query parameter enum test (string array) | [optional] [default to const []] - **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to '-efg'] - **enumQueryInteger** | **int**| Query parameter enum test (double) | [optional] - **enumQueryDouble** | **double**| Query parameter enum test (double) | [optional] - **enumFormStringArray** | [**List**](String.md)| Form parameter enum test (string array) | [optional] [default to '$'] - **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to '-efg'] - -### Return type - -**Map** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **testGroupParameters** -> Map testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) - -Fake endpoint to test group parameters (optional) - -Fake endpoint to test group parameters (optional) - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure HTTP Bearer authorization: bearer_test -// Case 1. Use String Token -//defaultApiClient.getAuthentication('bearer_test').setAccessToken('YOUR_ACCESS_TOKEN'); -// Case 2. Use Function which generate token. -// String yourTokenGeneratorFunction() { ... } -//defaultApiClient.getAuthentication('bearer_test').setAccessToken(yourTokenGeneratorFunction); - -final api_instance = FakeApi(); -final requiredStringGroup = 56; // int | Required String in group parameters -final requiredBooleanGroup = true; // bool | Required Boolean in group parameters -final requiredInt64Group = 789; // int | Required Integer in group parameters -final stringGroup = 56; // int | String in group parameters -final booleanGroup = true; // bool | Boolean in group parameters -final int64Group = 789; // int | Integer in group parameters - -try { - final result = api_instance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); - print(result); -} catch (e) { - print('Exception when calling FakeApi->testGroupParameters: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **requiredStringGroup** | **int**| Required String in group parameters | - **requiredBooleanGroup** | **bool**| Required Boolean in group parameters | - **requiredInt64Group** | **int**| Required Integer in group parameters | - **stringGroup** | **int**| String in group parameters | [optional] - **booleanGroup** | **bool**| Boolean in group parameters | [optional] - **int64Group** | **int**| Integer in group parameters | [optional] - -### Return type - -**Map** - -### Authorization - -[bearer_test](../README.md#bearer_test) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **testInlineAdditionalProperties** -> Map testInlineAdditionalProperties(requestBody) - -test inline additionalProperties - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final requestBody = Map(); // Map | request body - -try { - final result = api_instance.testInlineAdditionalProperties(requestBody); - print(result); -} catch (e) { - print('Exception when calling FakeApi->testInlineAdditionalProperties: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **requestBody** | [**Map**](String.md)| request body | - -### Return type - -**Map** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **testJsonFormData** -> Map testJsonFormData(param, param2) - -test json serialization of form data - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final param = param_example; // String | field1 -final param2 = param2_example; // String | field2 - -try { - final result = api_instance.testJsonFormData(param, param2); - print(result); -} catch (e) { - print('Exception when calling FakeApi->testJsonFormData: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **param** | **String**| field1 | - **param2** | **String**| field2 | - -### Return type - -**Map** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **testQueryParameterCollectionFormat** -> Map testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) - - - -To test the collection format in query parameters - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final pipe = []; // List | -final ioutil = []; // List | -final http = []; // List | -final url = []; // List | -final context = []; // List | -final allowEmpty = allowEmpty_example; // String | -final language = ; // Map | - -try { - final result = api_instance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); - print(result); -} catch (e) { - print('Exception when calling FakeApi->testQueryParameterCollectionFormat: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pipe** | [**List**](String.md)| | [default to const []] - **ioutil** | [**List**](String.md)| | [default to const []] - **http** | [**List**](String.md)| | [default to const []] - **url** | [**List**](String.md)| | [default to const []] - **context** | [**List**](String.md)| | [default to const []] - **allowEmpty** | **String**| | - **language** | [**Map**](String.md)| | [optional] [default to const {}] - -### Return type - -**Map** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/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 deleted file mode 100644 index a3fff4ca709c..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/NullableClass.md +++ /dev/null @@ -1,26 +0,0 @@ -# openapi.model.NullableClass - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**integerProp** | **int** | | [optional] -**numberProp** | **num** | | [optional] -**booleanProp** | **bool** | | [optional] -**stringProp** | **String** | | [optional] -**dateProp** | [**DateTime**](DateTime.md) | | [optional] -**datetimeProp** | [**DateTime**](DateTime.md) | | [optional] -**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 deleted file mode 100644 index f6452b7bfc9a..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/PetApi.md +++ /dev/null @@ -1,431 +0,0 @@ -# openapi.api.PetApi - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**addPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store -[**deletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet -[**findPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status -[**findPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags -[**getPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -[**updatePet**](PetApi.md#updatepet) | **PUT** /pet | Update an existing pet -[**updatePetWithForm**](PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data -[**uploadFile**](PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image -[**uploadFileWithRequiredFile**](PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) - - -# **addPet** -> Map addPet(pet) - -Add a new pet to the store - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api_instance = PetApi(); -final pet = Pet(); // Pet | Pet object that needs to be added to the store - -try { - final result = api_instance.addPet(pet); - print(result); -} catch (e) { - print('Exception when calling PetApi->addPet: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | - -### Return type - -**Map** - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **deletePet** -> Map deletePet(petId, apiKey) - -Deletes a pet - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api_instance = PetApi(); -final petId = 789; // int | Pet id to delete -final apiKey = apiKey_example; // String | - -try { - final result = api_instance.deletePet(petId, apiKey); - print(result); -} catch (e) { - print('Exception when calling PetApi->deletePet: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| Pet id to delete | - **apiKey** | **String**| | [optional] - -### Return type - -**Map** - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **findPetsByStatus** -> List findPetsByStatus(status) - -Finds Pets by status - -Multiple status values can be provided with comma separated strings - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api_instance = PetApi(); -final status = []; // List | Status values that need to be considered for filter - -try { - final result = api_instance.findPetsByStatus(status); - print(result); -} catch (e) { - print('Exception when calling PetApi->findPetsByStatus: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **status** | [**List**](String.md)| Status values that need to be considered for filter | [default to const []] - -### Return type - -[**List**](Pet.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **findPetsByTags** -> Set findPetsByTags(tags) - -Finds Pets by tags - -Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api_instance = PetApi(); -final tags = []; // Set | Tags to filter by - -try { - final result = api_instance.findPetsByTags(tags); - print(result); -} catch (e) { - print('Exception when calling PetApi->findPetsByTags: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **tags** | [**Set**](String.md)| Tags to filter by | [default to const {}] - -### Return type - -[**Set**](Pet.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[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) - -# **getPetById** -> Pet getPetById(petId) - -Find pet by ID - -Returns a single pet - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure API key authorization: api_key -//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; -// uncomment below to setup prefix (e.g. Bearer) for API key, if needed -//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; - -final api_instance = PetApi(); -final petId = 789; // int | ID of pet to return - -try { - final result = api_instance.getPetById(petId); - print(result); -} catch (e) { - print('Exception when calling PetApi->getPetById: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to return | - -### Return type - -[**Pet**](Pet.md) - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[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** -> Map updatePet(pet) - -Update an existing pet - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api_instance = PetApi(); -final pet = Pet(); // Pet | Pet object that needs to be added to the store - -try { - final result = api_instance.updatePet(pet); - print(result); -} catch (e) { - print('Exception when calling PetApi->updatePet: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | - -### Return type - -**Map** - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **updatePetWithForm** -> Map updatePetWithForm(petId, name, status) - -Updates a pet in the store with form data - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api_instance = PetApi(); -final petId = 789; // int | ID of pet that needs to be updated -final name = name_example; // String | Updated name of the pet -final status = status_example; // String | Updated status of the pet - -try { - final result = api_instance.updatePetWithForm(petId, name, status); - print(result); -} catch (e) { - print('Exception when calling PetApi->updatePetWithForm: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet that needs to be updated | - **name** | **String**| Updated name of the pet | [optional] - **status** | **String**| Updated status of the pet | [optional] - -### Return type - -**Map** - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **uploadFile** -> ApiResponse uploadFile(petId, additionalMetadata, file) - -uploads an image - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api_instance = PetApi(); -final petId = 789; // int | ID of pet to update -final additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server -final file = BINARY_DATA_HERE; // MultipartFile | file to upload - -try { - final result = api_instance.uploadFile(petId, additionalMetadata, file); - print(result); -} catch (e) { - print('Exception when calling PetApi->uploadFile: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to update | - **additionalMetadata** | **String**| Additional data to pass to server | [optional] - **file** | **MultipartFile**| file to upload | [optional] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: multipart/form-data - - **Accept**: application/json - -[[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) - -# **uploadFileWithRequiredFile** -> ApiResponse uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) - -uploads an image (required) - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api_instance = PetApi(); -final petId = 789; // int | ID of pet to update -final requiredFile = BINARY_DATA_HERE; // MultipartFile | file to upload -final additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server - -try { - final result = api_instance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); - print(result); -} catch (e) { - print('Exception when calling PetApi->uploadFileWithRequiredFile: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to update | - **requiredFile** | **MultipartFile**| file to upload | - **additionalMetadata** | **String**| Additional data to pass to server | [optional] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: multipart/form-data - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/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 deleted file mode 100644 index b573d982109a..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/StoreApi.md +++ /dev/null @@ -1,187 +0,0 @@ -# openapi.api.StoreApi - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**deleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID -[**getInventory**](StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status -[**getOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID -[**placeOrder**](StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet - - -# **deleteOrder** -> Map deleteOrder(orderId) - -Delete purchase order by ID - -For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = StoreApi(); -final orderId = orderId_example; // String | ID of the order that needs to be deleted - -try { - final result = api_instance.deleteOrder(orderId); - print(result); -} catch (e) { - print('Exception when calling StoreApi->deleteOrder: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **orderId** | **String**| ID of the order that needs to be deleted | - -### Return type - -**Map** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **getInventory** -> Map getInventory() - -Returns pet inventories by status - -Returns a map of status codes to quantities - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure API key authorization: api_key -//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; -// uncomment below to setup prefix (e.g. Bearer) for API key, if needed -//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; - -final api_instance = StoreApi(); - -try { - final result = api_instance.getInventory(); - print(result); -} catch (e) { - print('Exception when calling StoreApi->getInventory: $e\n'); -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -**Map** - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -[[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) - -# **getOrderById** -> Order getOrderById(orderId) - -Find purchase order by ID - -For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = StoreApi(); -final orderId = 789; // int | ID of pet that needs to be fetched - -try { - final result = api_instance.getOrderById(orderId); - print(result); -} catch (e) { - print('Exception when calling StoreApi->getOrderById: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **orderId** | **int**| ID of pet that needs to be fetched | - -### Return type - -[**Order**](Order.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **placeOrder** -> Order placeOrder(order) - -Place an order for a pet - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = StoreApi(); -final order = Order(); // Order | order placed for purchasing the pet - -try { - final result = api_instance.placeOrder(order); - print(result); -} catch (e) { - print('Exception when calling StoreApi->placeOrder: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **order** | [**Order**](Order.md)| order placed for purchasing the pet | - -### Return type - -[**Order**](Order.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/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 deleted file mode 100644 index 909b184c1a0c..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/UserApi.md +++ /dev/null @@ -1,355 +0,0 @@ -# openapi.api.UserApi - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createUser**](UserApi.md#createuser) | **POST** /user | Create user -[**createUsersWithArrayInput**](UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array -[**createUsersWithListInput**](UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array -[**deleteUser**](UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user -[**getUserByName**](UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name -[**loginUser**](UserApi.md#loginuser) | **GET** /user/login | Logs user into the system -[**logoutUser**](UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session -[**updateUser**](UserApi.md#updateuser) | **PUT** /user/{username} | Updated user - - -# **createUser** -> Map createUser(user) - -Create user - -This can only be done by the logged in user. - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = UserApi(); -final user = User(); // User | Created user object - -try { - final result = api_instance.createUser(user); - print(result); -} catch (e) { - print('Exception when calling UserApi->createUser: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **user** | [**User**](User.md)| Created user object | - -### Return type - -**Map** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **createUsersWithArrayInput** -> Map createUsersWithArrayInput(user) - -Creates list of users with given input array - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = UserApi(); -final user = [List()]; // List | List of user object - -try { - final result = api_instance.createUsersWithArrayInput(user); - print(result); -} catch (e) { - print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **user** | [**List**](User.md)| List of user object | - -### Return type - -**Map** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **createUsersWithListInput** -> Map createUsersWithListInput(user) - -Creates list of users with given input array - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = UserApi(); -final user = [List()]; // List | List of user object - -try { - final result = api_instance.createUsersWithListInput(user); - print(result); -} catch (e) { - print('Exception when calling UserApi->createUsersWithListInput: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **user** | [**List**](User.md)| List of user object | - -### Return type - -**Map** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **deleteUser** -> Map deleteUser(username) - -Delete user - -This can only be done by the logged in user. - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = UserApi(); -final username = username_example; // String | The name that needs to be deleted - -try { - final result = api_instance.deleteUser(username); - print(result); -} catch (e) { - print('Exception when calling UserApi->deleteUser: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| The name that needs to be deleted | - -### Return type - -**Map** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **getUserByName** -> User getUserByName(username) - -Get user by user name - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = UserApi(); -final username = username_example; // String | The name that needs to be fetched. Use user1 for testing. - -try { - final result = api_instance.getUserByName(username); - print(result); -} catch (e) { - print('Exception when calling UserApi->getUserByName: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| The name that needs to be fetched. Use user1 for testing. | - -### Return type - -[**User**](User.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[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) - -# **loginUser** -> String loginUser(username, password) - -Logs user into the system - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = UserApi(); -final username = username_example; // String | The user name for login -final password = password_example; // String | The password for login in clear text - -try { - final result = api_instance.loginUser(username, password); - print(result); -} catch (e) { - print('Exception when calling UserApi->loginUser: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| The user name for login | - **password** | **String**| The password for login in clear text | - -### Return type - -**String** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[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** -> Map logoutUser() - -Logs out current logged in user session - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = UserApi(); - -try { - final result = api_instance.logoutUser(); - print(result); -} catch (e) { - print('Exception when calling UserApi->logoutUser: $e\n'); -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -**Map** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **updateUser** -> Map updateUser(username, user) - -Updated user - -This can only be done by the logged in user. - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = UserApi(); -final username = username_example; // String | name that need to be deleted -final user = User(); // User | Updated user object - -try { - final result = api_instance.updateUser(username, user); - print(result); -} catch (e) { - print('Exception when calling UserApi->updateUser: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| name that need to be deleted | - **user** | [**User**](User.md)| Updated user object | - -### Return type - -**Map** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/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 deleted file mode 100644 index 592fecd1c906..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api.dart +++ /dev/null @@ -1,95 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -library openapi.api; - -import 'dart:async'; -import 'dart:convert'; -import 'dart:io'; - -import 'package:http/http.dart'; -import 'package:intl/intl.dart'; -import 'package:json_annotation/json_annotation.dart'; -import 'package:meta/meta.dart'; - -part 'api_client.dart'; -part 'api_helper.dart'; -part 'api_exception.dart'; -part 'auth/authentication.dart'; -part 'auth/api_key_auth.dart'; -part 'auth/oauth.dart'; -part 'auth/http_basic_auth.dart'; -part 'auth/http_bearer_auth.dart'; - -part 'api/another_fake_api.dart'; -part 'api/default_api.dart'; -part 'api/fake_api.dart'; -part 'api/fake_classname_tags123_api.dart'; -part 'api/pet_api.dart'; -part 'api/store_api.dart'; -part 'api/user_api.dart'; - -part 'model/additional_properties_class.dart'; -part 'model/animal.dart'; -part 'model/api_response.dart'; -part 'model/array_of_array_of_number_only.dart'; -part 'model/array_of_number_only.dart'; -part 'model/array_test.dart'; -part 'model/capitalization.dart'; -part 'model/cat.dart'; -part 'model/cat_all_of.dart'; -part 'model/category.dart'; -part 'model/class_model.dart'; -part 'model/deprecated_object.dart'; -part 'model/dog.dart'; -part 'model/dog_all_of.dart'; -part 'model/enum_arrays.dart'; -part 'model/enum_class.dart'; -part 'model/enum_test.dart'; -part 'model/file_schema_test_class.dart'; -part 'model/foo.dart'; -part 'model/format_test.dart'; -part 'model/has_only_read_only.dart'; -part 'model/health_check_result.dart'; -part 'model/inline_response_default.dart'; -part 'model/map_test.dart'; -part 'model/mixed_properties_and_additional_properties_class.dart'; -part 'model/model200_response.dart'; -part 'model/model_client.dart'; -part 'model/model_file.dart'; -part 'model/model_list.dart'; -part 'model/model_return.dart'; -part 'model/name.dart'; -part 'model/nullable_class.dart'; -part 'model/number_only.dart'; -part 'model/object_with_deprecated_fields.dart'; -part 'model/order.dart'; -part 'model/outer_composite.dart'; -part 'model/outer_enum.dart'; -part 'model/outer_enum_default_value.dart'; -part 'model/outer_enum_integer.dart'; -part 'model/outer_enum_integer_default_value.dart'; -part 'model/outer_object_with_enum_property.dart'; -part 'model/pet.dart'; -part 'model/read_only_first.dart'; -part 'model/special_model_name.dart'; -part 'model/tag.dart'; -part 'model/user.dart'; - - -part 'api.g.dart'; -const _delimiters = {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; -const _dateEpochMarker = 'epoch'; -final _dateFormatter = DateFormat('yyyy-MM-dd'); -final _regList = RegExp(r'^List<(.*)>$'); -final _regSet = RegExp(r'^Set<(.*)>$'); -final _regMap = RegExp(r'^Map$'); - -ApiClient defaultApiClient = ApiClient(); 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 deleted file mode 100644 index 3bad820de469..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/another_fake_api.dart +++ /dev/null @@ -1,77 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - - -class AnotherFakeApi { - AnotherFakeApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; - - final ApiClient apiClient; - - /// To test special tags - /// - /// To test special tags and operation ID starting with number - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [ModelClient] modelClient (required): - /// client model - Future call123testSpecialTagsWithHttpInfo(ModelClient modelClient,) async { - // ignore: prefer_const_declarations - final path = r'/another-fake/dummy'; - - // ignore: prefer_final_locals - Object? postBody = modelClient; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'PATCH', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// To test special tags - /// - /// To test special tags and operation ID starting with number - /// - /// Parameters: - /// - /// * [ModelClient] modelClient (required): - /// client model - Future call123testSpecialTags(ModelClient modelClient,) async { - final response = await call123testSpecialTagsWithHttpInfo(modelClient,); - 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 ModelClient.fromJson(json.decode(response.body)); - } - } -} 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 deleted file mode 100644 index 40753875d970..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/default_api.dart +++ /dev/null @@ -1,60 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - - -class DefaultApi { - DefaultApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; - - final ApiClient apiClient; - - /// Performs an HTTP 'GET /foo' operation and returns the [Response]. - Future fooGetWithHttpInfo() async { - // ignore: prefer_const_declarations - final path = r'/foo'; - - // ignore: prefer_final_locals - Object? postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - Future fooGet() async { - final response = await fooGetWithHttpInfo(); - 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 InlineResponseDefault.fromJson(json.decode(response.body)); - } - } -} 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 deleted file mode 100644 index f87ac09abe2d..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_api.dart +++ /dev/null @@ -1,1249 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - - -class FakeApi { - FakeApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; - - final ApiClient apiClient; - - /// Health check endpoint - /// - /// Note: This method returns the HTTP [Response]. - Future fakeHealthGetWithHttpInfo() async { - // ignore: prefer_const_declarations - final path = r'/fake/health'; - - // ignore: prefer_final_locals - Object? postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Health check endpoint - Future fakeHealthGet() async { - final response = await fakeHealthGetWithHttpInfo(); - 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 HealthCheckResult.fromJson(json.decode(response.body)); - } - } - - /// test http signature authentication - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [Pet] pet (required): - /// Pet object that needs to be added to the store - /// - /// * [String] query1: - /// query parameter - /// - /// * [String] header1: - /// header parameter - 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; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - if (query1 != null) { - queryParams.addAll(_convertParametersForCollectionFormat('', 'query_1', query1)); - } - - if (header1 != null) { - headerParams[r'header_1'] = parameterToString(header1); - } - - const authNames = ['http_signature_test']; - const contentTypes = ['application/json', 'application/xml']; - - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// test http signature authentication - /// - /// Parameters: - /// - /// * [Pet] pet (required): - /// Pet object that needs to be added to the store - /// - /// * [String] query1: - /// query parameter - /// - /// * [String] header1: - /// header parameter - 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 - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [bool] body: - /// Input boolean as post body - Future fakeOuterBooleanSerializeWithHttpInfo({ bool? body, }) async { - // ignore: prefer_const_declarations - final path = r'/fake/outer/boolean'; - - // ignore: prefer_final_locals - Object? postBody = body; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Test serialization of outer boolean types - /// - /// Parameters: - /// - /// * [bool] body: - /// Input boolean as post body - Future fakeOuterBooleanSerialize({ bool? body, }) async { - final response = await fakeOuterBooleanSerializeWithHttpInfo( body: 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 bool; - } - } - - /// Test serialization of object with outer number type - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [OuterComposite] outerComposite: - /// Input composite as post body - Future fakeOuterCompositeSerializeWithHttpInfo({ OuterComposite? outerComposite, }) async { - // ignore: prefer_const_declarations - final path = r'/fake/outer/composite'; - - // ignore: prefer_final_locals - Object? postBody = outerComposite; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Test serialization of object with outer number type - /// - /// Parameters: - /// - /// * [OuterComposite] outerComposite: - /// Input composite as post body - Future fakeOuterCompositeSerialize({ OuterComposite? outerComposite, }) async { - final response = await fakeOuterCompositeSerializeWithHttpInfo( outerComposite: outerComposite, ); - 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 OuterComposite.fromJson(json.decode(response.body)); - } - } - - /// Test serialization of outer number types - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [num] body: - /// Input number as post body - Future fakeOuterNumberSerializeWithHttpInfo({ num? body, }) async { - // ignore: prefer_const_declarations - final path = r'/fake/outer/number'; - - // ignore: prefer_final_locals - Object? postBody = body; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Test serialization of outer number types - /// - /// Parameters: - /// - /// * [num] body: - /// Input number as post body - Future fakeOuterNumberSerialize({ num? body, }) async { - final response = await fakeOuterNumberSerializeWithHttpInfo( body: 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 num; - } - } - - /// Test serialization of outer string types - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [String] body: - /// Input string as post body - Future fakeOuterStringSerializeWithHttpInfo({ String? body, }) async { - // ignore: prefer_const_declarations - final path = r'/fake/outer/string'; - - // ignore: prefer_final_locals - Object? postBody = body; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Test serialization of outer string types - /// - /// Parameters: - /// - /// * [String] body: - /// Input string as post body - Future fakeOuterStringSerialize({ String? body, }) async { - final response = await fakeOuterStringSerializeWithHttpInfo( body: 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 String; - } - } - - /// Test serialization of enum (int) properties with examples - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [OuterObjectWithEnumProperty] outerObjectWithEnumProperty (required): - /// Input enum (int) as post body - Future fakePropertyEnumIntegerSerializeWithHttpInfo(OuterObjectWithEnumProperty outerObjectWithEnumProperty,) async { - // ignore: prefer_const_declarations - final path = r'/fake/property/enum-int'; - - // ignore: prefer_final_locals - Object? postBody = outerObjectWithEnumProperty; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Test serialization of enum (int) properties with examples - /// - /// Parameters: - /// - /// * [OuterObjectWithEnumProperty] outerObjectWithEnumProperty (required): - /// Input enum (int) as post body - Future fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty,) async { - final response = await fakePropertyEnumIntegerSerializeWithHttpInfo(outerObjectWithEnumProperty,); - 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 OuterObjectWithEnumProperty.fromJson(json.decode(response.body)); - } - } - - /// For this test, the body has to be a binary file. - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [MultipartFile] body (required): - /// image to upload - Future testBodyWithBinaryWithHttpInfo(MultipartFile body,) async { - // ignore: prefer_const_declarations - final path = r'/fake/body-with-binary'; - - // ignore: prefer_final_locals - Object? postBody = body; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['image/png']; - - - return apiClient.invokeAPI( - path, - 'PUT', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// For this test, the body has to be a binary file. - /// - /// Parameters: - /// - /// * [MultipartFile] body (required): - /// image to upload - 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`. - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [FileSchemaTestClass] fileSchemaTestClass (required): - Future testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass,) async { - // ignore: prefer_const_declarations - final path = r'/fake/body-with-file-schema'; - - // ignore: prefer_final_locals - Object? postBody = fileSchemaTestClass; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'PUT', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// For this test, the body for this request must reference a schema named `File`. - /// - /// Parameters: - /// - /// * [FileSchemaTestClass] fileSchemaTestClass (required): - 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]. - /// Parameters: - /// - /// * [String] query (required): - /// - /// * [User] user (required): - Future testBodyWithQueryParamsWithHttpInfo(String query, User user,) async { - // ignore: prefer_const_declarations - final path = r'/fake/body-with-query-params'; - - // ignore: prefer_final_locals - Object? postBody = user; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - queryParams.addAll(_convertParametersForCollectionFormat('', 'query', query)); - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'PUT', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Parameters: - /// - /// * [String] query (required): - /// - /// * [User] user (required): - 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 - /// - /// To test \"client\" model - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [ModelClient] modelClient (required): - /// client model - Future testClientModelWithHttpInfo(ModelClient modelClient,) async { - // ignore: prefer_const_declarations - final path = r'/fake'; - - // ignore: prefer_final_locals - Object? postBody = modelClient; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'PATCH', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// To test \"client\" model - /// - /// To test \"client\" model - /// - /// Parameters: - /// - /// * [ModelClient] modelClient (required): - /// client model - Future testClientModel(ModelClient modelClient,) async { - final response = await testClientModelWithHttpInfo(modelClient,); - 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 ModelClient.fromJson(json.decode(response.body)); - } - } - - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [num] number (required): - /// None - /// - /// * [double] double_ (required): - /// None - /// - /// * [String] patternWithoutDelimiter (required): - /// None - /// - /// * [String] byte (required): - /// None - /// - /// * [int] integer: - /// None - /// - /// * [int] int32: - /// None - /// - /// * [int] int64: - /// None - /// - /// * [double] float: - /// None - /// - /// * [String] string: - /// None - /// - /// * [MultipartFile] binary: - /// None - /// - /// * [DateTime] date: - /// None - /// - /// * [DateTime] dateTime: - /// None - /// - /// * [String] password: - /// None - /// - /// * [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 { - // ignore: prefer_const_declarations - final path = r'/fake'; - - // ignore: prefer_final_locals - Object? postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = ['http_basic_test']; - const contentTypes = ['application/x-www-form-urlencoded']; - - if (integer != null) { - formParams[r'integer'] = parameterToString(integer); - } - if (int32 != null) { - formParams[r'int32'] = parameterToString(int32); - } - if (int64 != null) { - formParams[r'int64'] = parameterToString(int64); - } - if (number != null) { - formParams[r'number'] = parameterToString(number); - } - if (float != null) { - formParams[r'float'] = parameterToString(float); - } - if (double_ != null) { - formParams[r'double'] = parameterToString(double_); - } - if (string != null) { - formParams[r'string'] = parameterToString(string); - } - if (patternWithoutDelimiter != null) { - formParams[r'pattern_without_delimiter'] = parameterToString(patternWithoutDelimiter); - } - if (byte != null) { - formParams[r'byte'] = parameterToString(byte); - } - if (date != null) { - formParams[r'date'] = parameterToString(date); - } - if (dateTime != null) { - formParams[r'dateTime'] = parameterToString(dateTime); - } - if (password != null) { - formParams[r'password'] = parameterToString(password); - } - if (callback != null) { - formParams[r'callback'] = parameterToString(callback); - } - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Parameters: - /// - /// * [num] number (required): - /// None - /// - /// * [double] double_ (required): - /// None - /// - /// * [String] patternWithoutDelimiter (required): - /// None - /// - /// * [String] byte (required): - /// None - /// - /// * [int] integer: - /// None - /// - /// * [int] int32: - /// None - /// - /// * [int] int64: - /// None - /// - /// * [double] float: - /// None - /// - /// * [String] string: - /// None - /// - /// * [MultipartFile] binary: - /// None - /// - /// * [DateTime] date: - /// None - /// - /// * [DateTime] dateTime: - /// None - /// - /// * [String] password: - /// None - /// - /// * [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 { - 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 - /// - /// To test enum parameters - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [List] enumHeaderStringArray: - /// Header parameter enum test (string array) - /// - /// * [String] enumHeaderString: - /// Header parameter enum test (string) - /// - /// * [List] enumQueryStringArray: - /// Query parameter enum test (string array) - /// - /// * [String] enumQueryString: - /// Query parameter enum test (string) - /// - /// * [int] enumQueryInteger: - /// Query parameter enum test (double) - /// - /// * [double] enumQueryDouble: - /// Query parameter enum test (double) - /// - /// * [List] enumFormStringArray: - /// Form parameter enum test (string array) - /// - /// * [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 { - // ignore: prefer_const_declarations - final path = r'/fake'; - - // ignore: prefer_final_locals - Object? postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - if (enumQueryStringArray != null) { - queryParams.addAll(_convertParametersForCollectionFormat('multi', 'enum_query_string_array', enumQueryStringArray)); - } - if (enumQueryString != null) { - queryParams.addAll(_convertParametersForCollectionFormat('', 'enum_query_string', enumQueryString)); - } - if (enumQueryInteger != null) { - queryParams.addAll(_convertParametersForCollectionFormat('', 'enum_query_integer', enumQueryInteger)); - } - if (enumQueryDouble != null) { - queryParams.addAll(_convertParametersForCollectionFormat('', 'enum_query_double', enumQueryDouble)); - } - - if (enumHeaderStringArray != null) { - headerParams[r'enum_header_string_array'] = parameterToString(enumHeaderStringArray); - } - if (enumHeaderString != null) { - headerParams[r'enum_header_string'] = parameterToString(enumHeaderString); - } - - const authNames = []; - const contentTypes = ['application/x-www-form-urlencoded']; - - if (enumFormStringArray != null) { - formParams[r'enum_form_string_array'] = parameterToString(enumFormStringArray); - } - if (enumFormString != null) { - formParams[r'enum_form_string'] = parameterToString(enumFormString); - } - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// To test enum parameters - /// - /// To test enum parameters - /// - /// Parameters: - /// - /// * [List] enumHeaderStringArray: - /// Header parameter enum test (string array) - /// - /// * [String] enumHeaderString: - /// Header parameter enum test (string) - /// - /// * [List] enumQueryStringArray: - /// Query parameter enum test (string array) - /// - /// * [String] enumQueryString: - /// Query parameter enum test (string) - /// - /// * [int] enumQueryInteger: - /// Query parameter enum test (double) - /// - /// * [double] enumQueryDouble: - /// Query parameter enum test (double) - /// - /// * [List] enumFormStringArray: - /// Form parameter enum test (string array) - /// - /// * [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 { - 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) - /// - /// Fake endpoint to test group parameters (optional) - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [int] requiredStringGroup (required): - /// Required String in group parameters - /// - /// * [bool] requiredBooleanGroup (required): - /// Required Boolean in group parameters - /// - /// * [int] requiredInt64Group (required): - /// Required Integer in group parameters - /// - /// * [int] stringGroup: - /// String in group parameters - /// - /// * [bool] booleanGroup: - /// Boolean in group parameters - /// - /// * [int] int64Group: - /// Integer in group parameters - 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; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - queryParams.addAll(_convertParametersForCollectionFormat('', 'required_string_group', requiredStringGroup)); - queryParams.addAll(_convertParametersForCollectionFormat('', 'required_int64_group', requiredInt64Group)); - if (stringGroup != null) { - queryParams.addAll(_convertParametersForCollectionFormat('', 'string_group', stringGroup)); - } - if (int64Group != null) { - queryParams.addAll(_convertParametersForCollectionFormat('', 'int64_group', int64Group)); - } - - headerParams[r'required_boolean_group'] = parameterToString(requiredBooleanGroup); - if (booleanGroup != null) { - headerParams[r'boolean_group'] = parameterToString(booleanGroup); - } - - const authNames = ['bearer_test']; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'DELETE', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Fake endpoint to test group parameters (optional) - /// - /// Fake endpoint to test group parameters (optional) - /// - /// Parameters: - /// - /// * [int] requiredStringGroup (required): - /// Required String in group parameters - /// - /// * [bool] requiredBooleanGroup (required): - /// Required Boolean in group parameters - /// - /// * [int] requiredInt64Group (required): - /// Required Integer in group parameters - /// - /// * [int] stringGroup: - /// String in group parameters - /// - /// * [bool] booleanGroup: - /// Boolean in group parameters - /// - /// * [int] int64Group: - /// Integer in group parameters - 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 - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [Map] requestBody (required): - /// request body - Future testInlineAdditionalPropertiesWithHttpInfo(Map requestBody,) async { - // ignore: prefer_const_declarations - final path = r'/fake/inline-additionalProperties'; - - // ignore: prefer_final_locals - Object? postBody = requestBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// test inline additionalProperties - /// - /// Parameters: - /// - /// * [Map] requestBody (required): - /// request body - 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 - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [String] param (required): - /// field1 - /// - /// * [String] param2 (required): - /// field2 - Future testJsonFormDataWithHttpInfo(String param, String param2,) async { - // ignore: prefer_const_declarations - final path = r'/fake/jsonFormData'; - - // ignore: prefer_final_locals - Object? postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/x-www-form-urlencoded']; - - if (param != null) { - formParams[r'param'] = parameterToString(param); - } - if (param2 != null) { - formParams[r'param2'] = parameterToString(param2); - } - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// test json serialization of form data - /// - /// Parameters: - /// - /// * [String] param (required): - /// field1 - /// - /// * [String] param2 (required): - /// field2 - 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 - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [List] pipe (required): - /// - /// * [List] ioutil (required): - /// - /// * [List] http (required): - /// - /// * [List] url (required): - /// - /// * [List] context (required): - /// - /// * [String] allowEmpty (required): - /// - /// * [Map] language: - 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; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - queryParams.addAll(_convertParametersForCollectionFormat('pipes', 'pipe', pipe)); - queryParams.addAll(_convertParametersForCollectionFormat('csv', 'ioutil', ioutil)); - queryParams.addAll(_convertParametersForCollectionFormat('ssv', 'http', http)); - queryParams.addAll(_convertParametersForCollectionFormat('csv', 'url', url)); - queryParams.addAll(_convertParametersForCollectionFormat('multi', 'context', context)); - if (language != null) { - queryParams.addAll(_convertParametersForCollectionFormat('', 'language', language)); - } - queryParams.addAll(_convertParametersForCollectionFormat('', 'allowEmpty', allowEmpty)); - - const authNames = []; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'PUT', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// To test the collection format in query parameters - /// - /// Parameters: - /// - /// * [List] pipe (required): - /// - /// * [List] ioutil (required): - /// - /// * [List] http (required): - /// - /// * [List] url (required): - /// - /// * [List] context (required): - /// - /// * [String] allowEmpty (required): - /// - /// * [Map] language: - 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 deleted file mode 100644 index 6d7cacc38703..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_classname_tags123_api.dart +++ /dev/null @@ -1,77 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - - -class FakeClassnameTags123Api { - FakeClassnameTags123Api([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; - - final ApiClient apiClient; - - /// To test class name in snake case - /// - /// To test class name in snake case - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [ModelClient] modelClient (required): - /// client model - Future testClassnameWithHttpInfo(ModelClient modelClient,) async { - // ignore: prefer_const_declarations - final path = r'/fake_classname_test'; - - // ignore: prefer_final_locals - Object? postBody = modelClient; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = ['api_key_query']; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'PATCH', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// To test class name in snake case - /// - /// To test class name in snake case - /// - /// Parameters: - /// - /// * [ModelClient] modelClient (required): - /// client model - Future testClassname(ModelClient modelClient,) async { - final response = await testClassnameWithHttpInfo(modelClient,); - 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 ModelClient.fromJson(json.decode(response.body)); - } - } -} 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 deleted file mode 100644 index e3519d1e6795..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/pet_api.dart +++ /dev/null @@ -1,616 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - - -class PetApi { - PetApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; - - final ApiClient apiClient; - - /// Add a new pet to the store - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [Pet] pet (required): - /// Pet object that needs to be added to the store - Future addPetWithHttpInfo(Pet pet,) async { - // ignore: prefer_const_declarations - final path = r'/pet'; - - // ignore: prefer_final_locals - Object? postBody = pet; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = ['petstore_auth']; - const contentTypes = ['application/json', 'application/xml']; - - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Add a new pet to the store - /// - /// Parameters: - /// - /// * [Pet] pet (required): - /// Pet object that needs to be added to the store - 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 - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [int] petId (required): - /// Pet id to delete - /// - /// * [String] apiKey: - 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; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - if (apiKey != null) { - headerParams[r'api_key'] = parameterToString(apiKey); - } - - const authNames = ['petstore_auth']; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'DELETE', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Deletes a pet - /// - /// Parameters: - /// - /// * [int] petId (required): - /// Pet id to delete - /// - /// * [String] apiKey: - 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 - /// - /// Multiple status values can be provided with comma separated strings - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [List] status (required): - /// Status values that need to be considered for filter - Future findPetsByStatusWithHttpInfo(List status,) async { - // ignore: prefer_const_declarations - final path = r'/pet/findByStatus'; - - // ignore: prefer_final_locals - Object? postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - queryParams.addAll(_convertParametersForCollectionFormat('csv', 'status', status)); - - const authNames = ['petstore_auth']; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Finds Pets by status - /// - /// Multiple status values can be provided with comma separated strings - /// - /// Parameters: - /// - /// * [List] status (required): - /// Status values that need to be considered for filter - Future?> findPetsByStatus(List status,) async { - final response = await findPetsByStatusWithHttpInfo(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 (json.decode(response.body) as List) - .map((i) => Pet.fromJson(i)) - .toList(); - } - } - - /// Finds Pets by tags - /// - /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [Set] tags (required): - /// Tags to filter by - Future findPetsByTagsWithHttpInfo(Set tags,) async { - // ignore: prefer_const_declarations - final path = r'/pet/findByTags'; - - // ignore: prefer_final_locals - Object? postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - queryParams.addAll(_convertParametersForCollectionFormat('csv', 'tags', tags)); - - const authNames = ['petstore_auth']; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Finds Pets by tags - /// - /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Parameters: - /// - /// * [Set] tags (required): - /// Tags to filter by - Future?> findPetsByTags(Set tags,) async { - final response = await findPetsByTagsWithHttpInfo(tags,); - 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 (json.decode(response.body) as List) - .map((i) => Pet.fromJson(i)) - .toSet(); - } - } - - /// Find pet by ID - /// - /// Returns a single pet - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [int] petId (required): - /// ID of pet to return - Future getPetByIdWithHttpInfo(int petId,) async { - // ignore: prefer_const_declarations - final path = r'/pet/{petId}' - .replaceAll('{petId}', petId.toString()); - - // ignore: prefer_final_locals - Object? postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = ['api_key']; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Find pet by ID - /// - /// Returns a single pet - /// - /// Parameters: - /// - /// * [int] petId (required): - /// ID of pet to return - Future getPetById(int petId,) async { - final response = await getPetByIdWithHttpInfo(petId,); - 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 Pet.fromJson(json.decode(response.body)); - } - } - - /// Update an existing pet - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [Pet] pet (required): - /// Pet object that needs to be added to the store - Future updatePetWithHttpInfo(Pet pet,) async { - // ignore: prefer_const_declarations - final path = r'/pet'; - - // ignore: prefer_final_locals - Object? postBody = pet; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = ['petstore_auth']; - const contentTypes = ['application/json', 'application/xml']; - - - return apiClient.invokeAPI( - path, - 'PUT', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Update an existing pet - /// - /// Parameters: - /// - /// * [Pet] pet (required): - /// Pet object that needs to be added to the store - 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 - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [int] petId (required): - /// ID of pet that needs to be updated - /// - /// * [String] name: - /// Updated name of the pet - /// - /// * [String] status: - /// Updated status of the pet - 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; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = ['petstore_auth']; - const contentTypes = ['application/x-www-form-urlencoded']; - - if (name != null) { - formParams[r'name'] = parameterToString(name); - } - if (status != null) { - formParams[r'status'] = parameterToString(status); - } - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Updates a pet in the store with form data - /// - /// Parameters: - /// - /// * [int] petId (required): - /// ID of pet that needs to be updated - /// - /// * [String] name: - /// Updated name of the pet - /// - /// * [String] status: - /// Updated status of the pet - 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 - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [int] petId (required): - /// ID of pet to update - /// - /// * [String] additionalMetadata: - /// Additional data to pass to server - /// - /// * [MultipartFile] file: - /// file to upload - 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; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = ['petstore_auth']; - const contentTypes = ['multipart/form-data']; - - bool hasFields = false; - final mp = MultipartRequest('POST', Uri.parse(path)); - if (additionalMetadata != null) { - hasFields = true; - mp.fields[r'additionalMetadata'] = parameterToString(additionalMetadata); - } - if (file != null) { - hasFields = true; - mp.fields[r'file'] = file.field; - mp.files.add(file); - } - if (hasFields) { - postBody = mp; - } - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// uploads an image - /// - /// Parameters: - /// - /// * [int] petId (required): - /// ID of pet to update - /// - /// * [String] additionalMetadata: - /// Additional data to pass to server - /// - /// * [MultipartFile] file: - /// file to upload - 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)); - } - // 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 ApiResponse.fromJson(json.decode(response.body)); - } - } - - /// uploads an image (required) - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [int] petId (required): - /// ID of pet to update - /// - /// * [MultipartFile] requiredFile (required): - /// file to upload - /// - /// * [String] additionalMetadata: - /// Additional data to pass to server - 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; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = ['petstore_auth']; - const contentTypes = ['multipart/form-data']; - - bool hasFields = false; - final mp = MultipartRequest('POST', Uri.parse(path)); - if (additionalMetadata != null) { - hasFields = true; - mp.fields[r'additionalMetadata'] = parameterToString(additionalMetadata); - } - if (requiredFile != null) { - hasFields = true; - mp.fields[r'requiredFile'] = requiredFile.field; - mp.files.add(requiredFile); - } - if (hasFields) { - postBody = mp; - } - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// uploads an image (required) - /// - /// Parameters: - /// - /// * [int] petId (required): - /// ID of pet to update - /// - /// * [MultipartFile] requiredFile (required): - /// file to upload - /// - /// * [String] additionalMetadata: - /// Additional data to pass to server - 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)); - } - // 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 ApiResponse.fromJson(json.decode(response.body)); - } - } -} 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 deleted file mode 100644 index 822d2165653c..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/store_api.dart +++ /dev/null @@ -1,242 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - - -class StoreApi { - StoreApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; - - final ApiClient apiClient; - - /// Delete purchase order by ID - /// - /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [String] orderId (required): - /// ID of the order that needs to be deleted - Future deleteOrderWithHttpInfo(String orderId,) async { - // ignore: prefer_const_declarations - final path = r'/store/order/{order_id}' - .replaceAll('{order_id}', orderId); - - // ignore: prefer_final_locals - Object? postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'DELETE', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Delete purchase order by ID - /// - /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Parameters: - /// - /// * [String] orderId (required): - /// ID of the order that needs to be deleted - 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 - /// - /// Returns a map of status codes to quantities - /// - /// Note: This method returns the HTTP [Response]. - Future getInventoryWithHttpInfo() async { - // ignore: prefer_const_declarations - final path = r'/store/inventory'; - - // ignore: prefer_final_locals - Object? postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = ['api_key']; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Returns pet inventories by status - /// - /// Returns a map of status codes to quantities - Future?> getInventory() async { - final response = await getInventoryWithHttpInfo(); - 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 Map.from(json.decode(response.body)); - } - } - - /// Find purchase order by ID - /// - /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [int] orderId (required): - /// ID of pet that needs to be fetched - Future getOrderByIdWithHttpInfo(int orderId,) async { - // ignore: prefer_const_declarations - final path = r'/store/order/{order_id}' - .replaceAll('{order_id}', orderId.toString()); - - // ignore: prefer_final_locals - Object? postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Find purchase order by ID - /// - /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - /// - /// Parameters: - /// - /// * [int] orderId (required): - /// ID of pet that needs to be fetched - Future getOrderById(int orderId,) async { - final response = await getOrderByIdWithHttpInfo(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 Order.fromJson(json.decode(response.body)); - } - } - - /// Place an order for a pet - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [Order] order (required): - /// order placed for purchasing the pet - Future placeOrderWithHttpInfo(Order order,) async { - // ignore: prefer_const_declarations - final path = r'/store/order'; - - // ignore: prefer_final_locals - Object? postBody = order; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Place an order for a pet - /// - /// Parameters: - /// - /// * [Order] order (required): - /// order placed for purchasing the pet - Future placeOrder(Order order,) async { - final response = await placeOrderWithHttpInfo(order,); - 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 Order.fromJson(json.decode(response.body)); - } - } -} 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 deleted file mode 100644 index 90621378e642..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/user_api.dart +++ /dev/null @@ -1,478 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - - -class UserApi { - UserApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; - - final ApiClient apiClient; - - /// Create user - /// - /// This can only be done by the logged in user. - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [User] user (required): - /// Created user object - Future createUserWithHttpInfo(User user,) async { - // ignore: prefer_const_declarations - final path = r'/user'; - - // ignore: prefer_final_locals - Object? postBody = user; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Create user - /// - /// This can only be done by the logged in user. - /// - /// Parameters: - /// - /// * [User] user (required): - /// Created user object - 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 - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [List] user (required): - /// List of user object - Future createUsersWithArrayInputWithHttpInfo(List user,) async { - // ignore: prefer_const_declarations - final path = r'/user/createWithArray'; - - // ignore: prefer_final_locals - Object? postBody = user; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Creates list of users with given input array - /// - /// Parameters: - /// - /// * [List] user (required): - /// List of user object - 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 - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [List] user (required): - /// List of user object - Future createUsersWithListInputWithHttpInfo(List user,) async { - // ignore: prefer_const_declarations - final path = r'/user/createWithList'; - - // ignore: prefer_final_locals - Object? postBody = user; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Creates list of users with given input array - /// - /// Parameters: - /// - /// * [List] user (required): - /// List of user object - 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 - /// - /// This can only be done by the logged in user. - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [String] username (required): - /// The name that needs to be deleted - Future deleteUserWithHttpInfo(String username,) async { - // ignore: prefer_const_declarations - final path = r'/user/{username}' - .replaceAll('{username}', username); - - // ignore: prefer_final_locals - Object? postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'DELETE', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Delete user - /// - /// This can only be done by the logged in user. - /// - /// Parameters: - /// - /// * [String] username (required): - /// The name that needs to be deleted - 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 - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [String] username (required): - /// The name that needs to be fetched. Use user1 for testing. - Future getUserByNameWithHttpInfo(String username,) async { - // ignore: prefer_const_declarations - final path = r'/user/{username}' - .replaceAll('{username}', username); - - // ignore: prefer_final_locals - Object? postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Get user by user name - /// - /// Parameters: - /// - /// * [String] username (required): - /// The name that needs to be fetched. Use user1 for testing. - Future getUserByName(String username,) async { - final response = await getUserByNameWithHttpInfo(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 User.fromJson(json.decode(response.body)); - } - } - - /// Logs user into the system - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [String] username (required): - /// The user name for login - /// - /// * [String] password (required): - /// The password for login in clear text - Future loginUserWithHttpInfo(String username, String password,) async { - // ignore: prefer_const_declarations - final path = r'/user/login'; - - // ignore: prefer_final_locals - Object? postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - queryParams.addAll(_convertParametersForCollectionFormat('', 'username', username)); - queryParams.addAll(_convertParametersForCollectionFormat('', 'password', password)); - - const authNames = []; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Logs user into the system - /// - /// Parameters: - /// - /// * [String] username (required): - /// The user name for login - /// - /// * [String] password (required): - /// The password for login in clear text - 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)); - } - // 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 String; - } - } - - /// Logs out current logged in user session - /// - /// Note: This method returns the HTTP [Response]. - Future logoutUserWithHttpInfo() async { - // ignore: prefer_const_declarations - final path = r'/user/logout'; - - // ignore: prefer_final_locals - Object? postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Logs out current logged in user session - 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 - /// - /// This can only be done by the logged in user. - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [String] username (required): - /// name that need to be deleted - /// - /// * [User] user (required): - /// Updated user object - Future updateUserWithHttpInfo(String username, User user,) async { - // ignore: prefer_const_declarations - final path = r'/user/{username}' - .replaceAll('{username}', username); - - // ignore: prefer_final_locals - Object? postBody = user; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'PUT', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Updated user - /// - /// This can only be done by the logged in user. - /// - /// Parameters: - /// - /// * [String] username (required): - /// name that need to be deleted - /// - /// * [User] user (required): - /// Updated user object - 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 deleted file mode 100644 index 982cd0903770..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_client.dart +++ /dev/null @@ -1,168 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -class ApiClient { - ApiClient({this.basePath = 'http://petstore.swagger.io:80/v2'}) { - // Setup authentications (key: authentication name, value: authentication). - _authentications[r'api_key'] = ApiKeyAuth('header', 'api_key'); - _authentications[r'api_key_query'] = ApiKeyAuth('query', 'api_key_query'); - _authentications[r'bearer_test'] = HttpBearerAuth(); - _authentications[r'http_basic_test'] = HttpBasicAuth(); - _authentications[r'petstore_auth'] = OAuth(); - } - - final String basePath; - - var _client = Client(); - - /// Returns the current HTTP [Client] instance to use in this class. - /// - /// The return value is guaranteed to never be null. - Client get client => _client; - - /// Requests to use a new HTTP [Client] in this class. - set client(Client newClient) { - _client = newClient; - } - - final _defaultHeaderMap = {}; - final _authentications = {}; - - void addDefaultHeader(String key, String value) { - _defaultHeaderMap[key] = value; - } - - Map get defaultHeaderMap => _defaultHeaderMap; - - /// Returns an unmodifiable [Map] of the authentications, since none should be added - /// or deleted. - Map get authentications => Map.unmodifiable(_authentications); - - T? getAuthentication(String name) { - final authentication = _authentications[name]; - return authentication is T ? authentication : null; - } - - // We don't use a Map for queryParams. - // If collectionFormat is 'multi', a key might appear multiple times. - Future invokeAPI( - String path, - String method, - List queryParams, - Object? body, - Map headerParams, - Map formParams, - String? nullableContentType, - List authNames, - ) async { - _updateParamsForAuth(authNames, queryParams, headerParams); - - headerParams.addAll(_defaultHeaderMap); - - final urlEncodedQueryParams = queryParams - .where((param) => param.value != null) - .map((param) => '$param'); - - final queryString = urlEncodedQueryParams.isNotEmpty - ? '?${urlEncodedQueryParams.join('&')}' - : ''; - - final uri = Uri.parse('$basePath$path$queryString'); - - if (nullableContentType != null) { - headerParams['Content-Type'] = nullableContentType; - } - - try { - // Special case for uploading a single file which isn't a 'multipart/form-data'. - if ( - body is MultipartFile && (nullableContentType == null || - !nullableContentType.toLowerCase().startsWith('multipart/form-data')) - ) { - final request = StreamedRequest(method, uri); - request.headers.addAll(headerParams); - request.contentLength = body.length; - body.finalize().listen( - request.sink.add, - onDone: request.sink.close, - // ignore: avoid_types_on_closure_parameters - onError: (Object error, StackTrace trace) => request.sink.close(), - cancelOnError: true, - ); - final response = await _client.send(request); - return Response.fromStream(response); - } - - if (body is MultipartRequest) { - final request = MultipartRequest(method, uri); - request.fields.addAll(body.fields); - request.files.addAll(body.files); - request.headers.addAll(body.headers); - request.headers.addAll(headerParams); - final response = await _client.send(request); - return Response.fromStream(response); - } - - final msgBody = nullableContentType == 'application/x-www-form-urlencoded' - ? formParams - : await serializeAsync(body); - final nullableHeaderParams = headerParams.isEmpty ? null : headerParams; - - switch(method) { - case 'POST': return await _client.post(uri, headers: nullableHeaderParams, body: msgBody,); - case 'PUT': return await _client.put(uri, headers: nullableHeaderParams, body: msgBody,); - case 'DELETE': return await _client.delete(uri, headers: nullableHeaderParams, body: msgBody,); - case 'PATCH': return await _client.patch(uri, headers: nullableHeaderParams, body: msgBody,); - case 'HEAD': return await _client.head(uri, headers: nullableHeaderParams,); - case 'GET': return await _client.get(uri, headers: nullableHeaderParams,); - } - } on SocketException catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'Socket operation failed: $method $path', e, trace,); - } on TlsException catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'TLS/SSL communication failed: $method $path', e, trace,); - } on IOException catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'I/O operation failed: $method $path', e, trace,); - } on ClientException catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'HTTP connection failed: $method $path', e, trace,); - } on Exception catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'Exception occurred: $method $path', e, trace,); - } - - throw ApiException(HttpStatus.badRequest, 'Invalid HTTP operation: $method $path',); - } - - // ignore: deprecated_member_use_from_same_package - 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); - - /// Update query and header parameters based on authentication settings. - /// @param authNames The authentications to apply - void _updateParamsForAuth( - List authNames, - List queryParams, - Map headerParams, - ) { - for(final authName in authNames) { - final auth = _authentications[authName]; - if (auth == null) { - throw ArgumentError('Authentication undefined: $authName'); - } - auth.applyToParams(queryParams, headerParams); - } - } - -} - -/// Primarily intended for use in an isolate. -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 deleted file mode 100644 index a01cb9f94a8c..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_exception.dart +++ /dev/null @@ -1,33 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -class ApiException implements Exception { - ApiException(this.code, this.message); - - ApiException.withInner(this.code, this.message, this.innerException, this.stackTrace); - - int code = 0; - String? message; - Exception? innerException; - StackTrace? stackTrace; - - @override - String toString() { - if (message == null) { - return 'ApiException'; - } - if (innerException == null) { - return 'ApiException $code: $message'; - } - return 'ApiException $code: $message (Inner exception: $innerException)\n\n$stackTrace'; - } -} 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 deleted file mode 100644 index 506e374fc657..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_helper.dart +++ /dev/null @@ -1,109 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -class QueryParam { - const QueryParam(this.name, this.value); - - final String name; - final String? value; - - @override - String toString() => '${Uri.encodeQueryComponent(name)}=${Uri.encodeQueryComponent(value ?? 'null')}'; -} - -// Ported from the Java version. -Iterable _convertParametersForCollectionFormat( - String? collectionFormat, - String? name, - dynamic value, -) { - final params = []; - - // preconditions - if (name != null && name.isNotEmpty && value != null) { - if (value is List) { - if (collectionFormat == 'multi') { - return value.map((dynamic v) => QueryParam(name, parameterToString(v)),); - } - - // Default collection format is 'csv'. - if (collectionFormat == null || collectionFormat.isEmpty) { - // ignore: parameter_assignments - collectionFormat = 'csv'; - } - - final delimiter = _delimiters[collectionFormat] ?? ','; - - params.add(QueryParam(name, value.map(parameterToString).join(delimiter)),); - } else { - params.add(QueryParam(name, parameterToString(value),)); - } - } - - return params; -} - -/// Format the given parameter object into a [String]. -String parameterToString(dynamic value) { - if (value == null) { - return ''; - } - if (value is DateTime) { - return value.toUtc().toIso8601String(); - } - if (value is EnumClass) { - return value.toString(); - } - if (value is OuterEnum) { - return value.toString(); - } - if (value is OuterEnumDefaultValue) { - return value.toString(); - } - if (value is OuterEnumInteger) { - return value.toString(); - } - if (value is OuterEnumIntegerDefaultValue) { - return value.toString(); - } - return value.toString(); -} - -/// Returns the decoded body as UTF-8 if the given headers indicate an 'application/json' -/// content type. Otherwise, returns the decoded body as decoded by dart:http package. -Future _decodeBodyBytes(Response response) async { - final contentType = response.headers['content-type']; - return contentType != null && contentType.toLowerCase().startsWith('application/json') - ? utf8.decode(response.bodyBytes) - : response.body; -} - -/// Returns a valid [DateTime] found at the specified Map [key], null otherwise. -DateTime mapDateTime(dynamic map, String key, [String? pattern]) { - final dynamic value = map is Map ? map[key] : null; - if (value != null) { - int? millis; - if (value is int) { - millis = value; - } else if (value is String) { - if (pattern == _dateEpochMarker) { - millis = int.tryParse(value); - } else { - return DateTime.parse(value); - } - } - if (millis != null) { - return DateTime.fromMillisecondsSinceEpoch(millis, isUtc: true); - } - } - 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 deleted file mode 100644 index abd569b5fb74..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/api_key_auth.dart +++ /dev/null @@ -1,38 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -class ApiKeyAuth implements Authentication { - ApiKeyAuth(this.location, this.paramName); - - final String location; - final String paramName; - - String? apiKeyPrefix; - String? apiKey; - - @override - void applyToParams(List queryParams, Map headerParams) { - final value = apiKeyPrefix == null ? apiKey : '$apiKeyPrefix $apiKey'; - - if (location == 'query' && value != null) { - queryParams.add(QueryParam(paramName, value)); - } else if (location == 'header' && value != null) { - headerParams[paramName] = value; - } else if (location == 'cookie' && value != null) { - headerParams.update( - 'Cookie', - (existingCookie) => '$existingCookie; $paramName=$value', - ifAbsent: () => '$paramName=$value', - ); - } - } -} 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 deleted file mode 100644 index 6a5eb38902e7..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/authentication.dart +++ /dev/null @@ -1,17 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -// ignore: one_member_abstracts -abstract class Authentication { - /// Apply authentication settings to header and query params. - void applyToParams(List queryParams, Map headerParams); -} 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 deleted file mode 100644 index cb0211bd2559..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_basic_auth.dart +++ /dev/null @@ -1,22 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -class HttpBasicAuth implements Authentication { - String? username; - String? password; - - @override - void applyToParams(List queryParams, Map headerParams) { - final credentials = '${username ?? ''}:${password ?? ''}'; - headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; - } -} 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 deleted file mode 100644 index 8d2f6ddb0f89..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_bearer_auth.dart +++ /dev/null @@ -1,39 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -typedef HttpBearerAuthProvider = String Function(); - -class HttpBearerAuth implements Authentication { - HttpBearerAuth(); - - dynamic _accessToken; - - dynamic get accessToken => _accessToken; - - set accessToken(dynamic accessToken) { - if (accessToken is! String && accessToken is! HttpBearerAuthProvider) { - throw ArgumentError('Type of Bearer accessToken should be a String or a String Function().'); - } - _accessToken = accessToken; - } - - @override - void applyToParams(List queryParams, Map headerParams) { - if (_accessToken is String) { - headerParams['Authorization'] = 'Bearer $_accessToken'; - } else if (_accessToken is HttpBearerAuthProvider) { - headerParams['Authorization'] = 'Bearer ${_accessToken()}'; - } else { - throw ArgumentError('Type of Bearer accessToken should be a String or a String Function().'); - } - } -} 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 deleted file mode 100644 index 1aecb2d3e671..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/oauth.dart +++ /dev/null @@ -1,24 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -class OAuth implements Authentication { - OAuth({this.accessToken}); - - String? accessToken; - - @override - void applyToParams(List queryParams, Map headerParams) { - if (accessToken != null) { - headerParams['Authorization'] = 'Bearer $accessToken'; - } - } -} 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 deleted file mode 100644 index 0a185abc8bd8..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/additional_properties_class.dart +++ /dev/null @@ -1,58 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class AdditionalPropertiesClass { - /// Returns a new [AdditionalPropertiesClass] instance. - AdditionalPropertiesClass({ - this.mapProperty = const {}, - this.mapOfMapProperty = const {}, - }); - - - @JsonKey( - defaultValue: const {}, - name: r'map_property', - required: false, - ) - Map? mapProperty; - - @JsonKey( - defaultValue: const {}, - name: r'map_of_map_property', - required: false, - ) - Map>? mapOfMapProperty; - - @override - bool operator ==(Object other) => identical(this, other) || other is AdditionalPropertiesClass && - other.mapProperty == mapProperty && - other.mapOfMapProperty == mapOfMapProperty; - - @override - int get hashCode => - mapProperty.hashCode + - mapOfMapProperty.hashCode; - - factory AdditionalPropertiesClass.fromJson(Map json) => _$AdditionalPropertiesClassFromJson(json); - - Map toJson() => _$AdditionalPropertiesClassToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index 6064e0b57dba..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/animal.dart +++ /dev/null @@ -1,57 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class Animal { - /// Returns a new [Animal] instance. - Animal({ - required this.className, - this.color = 'red', - }); - - - @JsonKey( - name: r'className', - required: true, - ) - String className; - - @JsonKey( - defaultValue: 'red', - name: r'color', - required: false, - ) - String? color; - - @override - bool operator ==(Object other) => identical(this, other) || other is Animal && - other.className == className && - other.color == color; - - @override - int get hashCode => - className.hashCode + - color.hashCode; - - factory Animal.fromJson(Map json) => _$AnimalFromJson(json); - - Map toJson() => _$AnimalToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index 30a6b04b283b..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/api_response.dart +++ /dev/null @@ -1,65 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class ApiResponse { - /// Returns a new [ApiResponse] instance. - ApiResponse({ - this.code, - this.type, - this.message, - }); - - - @JsonKey( - name: r'code', - required: false, - ) - int? code; - - @JsonKey( - name: r'type', - required: false, - ) - String? type; - - @JsonKey( - name: r'message', - required: false, - ) - String? message; - - @override - bool operator ==(Object other) => identical(this, other) || other is ApiResponse && - other.code == code && - other.type == type && - other.message == message; - - @override - int get hashCode => - code.hashCode + - type.hashCode + - message.hashCode; - - factory ApiResponse.fromJson(Map json) => _$ApiResponseFromJson(json); - - Map toJson() => _$ApiResponseToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index f04cb123cc84..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_array_of_number_only.dart +++ /dev/null @@ -1,48 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class ArrayOfArrayOfNumberOnly { - /// Returns a new [ArrayOfArrayOfNumberOnly] instance. - ArrayOfArrayOfNumberOnly({ - this.arrayArrayNumber = const [], - }); - - - @JsonKey( - defaultValue: const [], - name: r'ArrayArrayNumber', - required: false, - ) - List>? arrayArrayNumber; - - @override - bool operator ==(Object other) => identical(this, other) || other is ArrayOfArrayOfNumberOnly && - other.arrayArrayNumber == arrayArrayNumber; - - @override - int get hashCode => - arrayArrayNumber.hashCode; - - factory ArrayOfArrayOfNumberOnly.fromJson(Map json) => _$ArrayOfArrayOfNumberOnlyFromJson(json); - - Map toJson() => _$ArrayOfArrayOfNumberOnlyToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index 82f6a83c732f..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_number_only.dart +++ /dev/null @@ -1,48 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class ArrayOfNumberOnly { - /// Returns a new [ArrayOfNumberOnly] instance. - ArrayOfNumberOnly({ - this.arrayNumber = const [], - }); - - - @JsonKey( - defaultValue: const [], - name: r'ArrayNumber', - required: false, - ) - List? arrayNumber; - - @override - bool operator ==(Object other) => identical(this, other) || other is ArrayOfNumberOnly && - other.arrayNumber == arrayNumber; - - @override - int get hashCode => - arrayNumber.hashCode; - - factory ArrayOfNumberOnly.fromJson(Map json) => _$ArrayOfNumberOnlyFromJson(json); - - Map toJson() => _$ArrayOfNumberOnlyToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index 86967509970b..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_test.dart +++ /dev/null @@ -1,68 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class ArrayTest { - /// Returns a new [ArrayTest] instance. - ArrayTest({ - this.arrayOfString = const [], - this.arrayArrayOfInteger = const [], - this.arrayArrayOfModel = const [], - }); - - - @JsonKey( - defaultValue: const [], - name: r'array_of_string', - required: false, - ) - List? arrayOfString; - - @JsonKey( - defaultValue: const [], - name: r'array_array_of_integer', - required: false, - ) - List>? arrayArrayOfInteger; - - @JsonKey( - defaultValue: const [], - name: r'array_array_of_model', - required: false, - ) - List>? arrayArrayOfModel; - - @override - bool operator ==(Object other) => identical(this, other) || other is ArrayTest && - other.arrayOfString == arrayOfString && - other.arrayArrayOfInteger == arrayArrayOfInteger && - other.arrayArrayOfModel == arrayArrayOfModel; - - @override - int get hashCode => - arrayOfString.hashCode + - arrayArrayOfInteger.hashCode + - arrayArrayOfModel.hashCode; - - factory ArrayTest.fromJson(Map json) => _$ArrayTestFromJson(json); - - Map toJson() => _$ArrayTestToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index b365bb3eba3e..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/capitalization.dart +++ /dev/null @@ -1,93 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class Capitalization { - /// Returns a new [Capitalization] instance. - Capitalization({ - this.smallCamel, - this.capitalCamel, - this.smallSnake, - this.capitalSnake, - this.sCAETHFlowPoints, - this.ATT_NAME, - }); - - - @JsonKey( - name: r'smallCamel', - required: false, - ) - String? smallCamel; - - @JsonKey( - name: r'CapitalCamel', - required: false, - ) - String? capitalCamel; - - @JsonKey( - name: r'small_Snake', - required: false, - ) - String? smallSnake; - - @JsonKey( - name: r'Capital_Snake', - required: false, - ) - String? capitalSnake; - - @JsonKey( - name: r'SCA_ETH_Flow_Points', - required: false, - ) - String? sCAETHFlowPoints; - - /// Name of the pet - @JsonKey( - name: r'ATT_NAME', - required: false, - ) - String? ATT_NAME; - - @override - bool operator ==(Object other) => identical(this, other) || other is Capitalization && - other.smallCamel == smallCamel && - other.capitalCamel == capitalCamel && - other.smallSnake == smallSnake && - other.capitalSnake == capitalSnake && - other.sCAETHFlowPoints == sCAETHFlowPoints && - other.ATT_NAME == ATT_NAME; - - @override - int get hashCode => - smallCamel.hashCode + - capitalCamel.hashCode + - smallSnake.hashCode + - capitalSnake.hashCode + - sCAETHFlowPoints.hashCode + - ATT_NAME.hashCode; - - factory Capitalization.fromJson(Map json) => _$CapitalizationFromJson(json); - - Map toJson() => _$CapitalizationToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index fa47ef94a2d8..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat.dart +++ /dev/null @@ -1,66 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class Cat { - /// Returns a new [Cat] instance. - Cat({ - required this.className, - this.color = 'red', - this.declawed, - }); - - - @JsonKey( - name: r'className', - required: true, - ) - String className; - - @JsonKey( - defaultValue: 'red', - name: r'color', - required: false, - ) - String? color; - - @JsonKey( - name: r'declawed', - required: false, - ) - bool? declawed; - - @override - bool operator ==(Object other) => identical(this, other) || other is Cat && - other.className == className && - other.color == color && - other.declawed == declawed; - - @override - int get hashCode => - className.hashCode + - color.hashCode + - declawed.hashCode; - - factory Cat.fromJson(Map json) => _$CatFromJson(json); - - Map toJson() => _$CatToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index 4a0f45a8881a..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat_all_of.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class CatAllOf { - /// Returns a new [CatAllOf] instance. - CatAllOf({ - this.declawed, - }); - - - @JsonKey( - name: r'declawed', - required: false, - ) - bool? declawed; - - @override - bool operator ==(Object other) => identical(this, other) || other is CatAllOf && - other.declawed == declawed; - - @override - int get hashCode => - declawed.hashCode; - - factory CatAllOf.fromJson(Map json) => _$CatAllOfFromJson(json); - - Map toJson() => _$CatAllOfToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index 6734da0fd4d0..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/category.dart +++ /dev/null @@ -1,57 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class Category { - /// Returns a new [Category] instance. - Category({ - this.id, - this.name = 'default-name', - }); - - - @JsonKey( - name: r'id', - required: false, - ) - int? id; - - @JsonKey( - defaultValue: 'default-name', - name: r'name', - required: true, - ) - String name; - - @override - bool operator ==(Object other) => identical(this, other) || other is Category && - other.id == id && - other.name == name; - - @override - int get hashCode => - id.hashCode + - name.hashCode; - - factory Category.fromJson(Map json) => _$CategoryFromJson(json); - - Map toJson() => _$CategoryToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index 65b632fe980f..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/class_model.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class ClassModel { - /// Returns a new [ClassModel] instance. - ClassModel({ - this.class_, - }); - - - @JsonKey( - name: r'_class', - required: false, - ) - String? class_; - - @override - bool operator ==(Object other) => identical(this, other) || other is ClassModel && - other.class_ == class_; - - @override - int get hashCode => - class_.hashCode; - - factory ClassModel.fromJson(Map json) => _$ClassModelFromJson(json); - - Map toJson() => _$ClassModelToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index defb7f3faca9..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/deprecated_object.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class DeprecatedObject { - /// Returns a new [DeprecatedObject] instance. - DeprecatedObject({ - this.name, - }); - - - @JsonKey( - name: r'name', - required: false, - ) - String? name; - - @override - bool operator ==(Object other) => identical(this, other) || other is DeprecatedObject && - other.name == name; - - @override - int get hashCode => - name.hashCode; - - factory DeprecatedObject.fromJson(Map json) => _$DeprecatedObjectFromJson(json); - - Map toJson() => _$DeprecatedObjectToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index ddce52b6d376..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog.dart +++ /dev/null @@ -1,66 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class Dog { - /// Returns a new [Dog] instance. - Dog({ - required this.className, - this.color = 'red', - this.breed, - }); - - - @JsonKey( - name: r'className', - required: true, - ) - String className; - - @JsonKey( - defaultValue: 'red', - name: r'color', - required: false, - ) - String? color; - - @JsonKey( - name: r'breed', - required: false, - ) - String? breed; - - @override - bool operator ==(Object other) => identical(this, other) || other is Dog && - other.className == className && - other.color == color && - other.breed == breed; - - @override - int get hashCode => - className.hashCode + - color.hashCode + - breed.hashCode; - - factory Dog.fromJson(Map json) => _$DogFromJson(json); - - Map toJson() => _$DogToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index c799f2231b61..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog_all_of.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class DogAllOf { - /// Returns a new [DogAllOf] instance. - DogAllOf({ - this.breed, - }); - - - @JsonKey( - name: r'breed', - required: false, - ) - String? breed; - - @override - bool operator ==(Object other) => identical(this, other) || other is DogAllOf && - other.breed == breed; - - @override - int get hashCode => - breed.hashCode; - - factory DogAllOf.fromJson(Map json) => _$DogAllOfFromJson(json); - - Map toJson() => _$DogAllOfToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index 17b6601b283c..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_arrays.dart +++ /dev/null @@ -1,69 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class EnumArrays { - /// Returns a new [EnumArrays] instance. - EnumArrays({ - this.justSymbol, - this.arrayEnum = const [], - }); - - - @JsonKey( - name: r'just_symbol', - required: false, - ) - EnumArraysJustSymbolEnum? justSymbol; - - @JsonKey( - defaultValue: const [], - name: r'array_enum', - required: false, - ) - List? arrayEnum; - - @override - bool operator ==(Object other) => identical(this, other) || other is EnumArrays && - other.justSymbol == justSymbol && - other.arrayEnum == arrayEnum; - - @override - int get hashCode => - justSymbol.hashCode + - arrayEnum.hashCode; - - factory EnumArrays.fromJson(Map json) => _$EnumArraysFromJson(json); - - Map toJson() => _$EnumArraysToJson(this); - - @override - String toString() => toJson().toString(); -} - - -enum EnumArraysJustSymbolEnum { - greaterThanEqual, - dollar, -} - - -enum EnumArraysArrayEnumEnum { - fish, - crab, -} - 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 deleted file mode 100644 index d4eea03a828d..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_class.dart +++ /dev/null @@ -1,17 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -enum EnumClass { - abc, - efg, - leftParenthesisXyzRightParenthesis, -} 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 deleted file mode 100644 index 9740cb7fd060..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_test.dart +++ /dev/null @@ -1,136 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class EnumTest { - /// Returns a new [EnumTest] instance. - EnumTest({ - this.enumString, - required this.enumStringRequired, - this.enumInteger, - this.enumNumber, - this.outerEnum, - this.outerEnumInteger, - this.outerEnumDefaultValue, - this.outerEnumIntegerDefaultValue, - }); - - - @JsonKey( - name: r'enum_string', - required: false, - ) - EnumTestEnumStringEnum? enumString; - - @JsonKey( - name: r'enum_string_required', - required: true, - ) - EnumTestEnumStringRequiredEnum enumStringRequired; - - @JsonKey( - name: r'enum_integer', - required: false, - ) - EnumTestEnumIntegerEnum? enumInteger; - - @JsonKey( - name: r'enum_number', - required: false, - ) - EnumTestEnumNumberEnum? enumNumber; - - @JsonKey( - name: r'outerEnum', - required: false, - ) - OuterEnum? outerEnum; - - @JsonKey( - name: r'outerEnumInteger', - required: false, - ) - OuterEnumInteger? outerEnumInteger; - - @JsonKey( - name: r'outerEnumDefaultValue', - required: false, - ) - OuterEnumDefaultValue? outerEnumDefaultValue; - - @JsonKey( - name: r'outerEnumIntegerDefaultValue', - required: false, - ) - OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue; - - @override - bool operator ==(Object other) => identical(this, other) || other is EnumTest && - other.enumString == enumString && - other.enumStringRequired == enumStringRequired && - other.enumInteger == enumInteger && - other.enumNumber == enumNumber && - other.outerEnum == outerEnum && - other.outerEnumInteger == outerEnumInteger && - other.outerEnumDefaultValue == outerEnumDefaultValue && - other.outerEnumIntegerDefaultValue == outerEnumIntegerDefaultValue; - - @override - int get hashCode => - enumString.hashCode + - enumStringRequired.hashCode + - enumInteger.hashCode + - enumNumber.hashCode + - outerEnum.hashCode + - outerEnumInteger.hashCode + - outerEnumDefaultValue.hashCode + - outerEnumIntegerDefaultValue.hashCode; - - factory EnumTest.fromJson(Map json) => _$EnumTestFromJson(json); - - Map toJson() => _$EnumTestToJson(this); - - @override - String toString() => toJson().toString(); -} - - -enum EnumTestEnumStringEnum { - UPPER, - lower, - empty, -} - - -enum EnumTestEnumStringRequiredEnum { - UPPER, - lower, - empty, -} - - -enum EnumTestEnumIntegerEnum { - number1, - numberNegative1, -} - - -enum EnumTestEnumNumberEnum { - number1Period1, - numberNegative1Period2, -} - 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 deleted file mode 100644 index dc67479465e1..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/file_schema_test_class.dart +++ /dev/null @@ -1,57 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class FileSchemaTestClass { - /// Returns a new [FileSchemaTestClass] instance. - FileSchemaTestClass({ - this.file, - this.files = const [], - }); - - - @JsonKey( - name: r'file', - required: false, - ) - ModelFile? file; - - @JsonKey( - defaultValue: const [], - name: r'files', - required: false, - ) - List? files; - - @override - bool operator ==(Object other) => identical(this, other) || other is FileSchemaTestClass && - other.file == file && - other.files == files; - - @override - int get hashCode => - file.hashCode + - files.hashCode; - - factory FileSchemaTestClass.fromJson(Map json) => _$FileSchemaTestClassFromJson(json); - - Map toJson() => _$FileSchemaTestClassToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index ed391aed31df..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/foo.dart +++ /dev/null @@ -1,48 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class Foo { - /// Returns a new [Foo] instance. - Foo({ - this.bar = 'bar', - }); - - - @JsonKey( - defaultValue: 'bar', - name: r'bar', - required: false, - ) - String? bar; - - @override - bool operator ==(Object other) => identical(this, other) || other is Foo && - other.bar == bar; - - @override - int get hashCode => - bar.hashCode; - - factory Foo.fromJson(Map json) => _$FooFromJson(json); - - Map toJson() => _$FooToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index 3a83f384656f..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/format_test.dart +++ /dev/null @@ -1,191 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class FormatTest { - /// Returns a new [FormatTest] instance. - FormatTest({ - this.integer, - this.int32, - this.int64, - required this.number, - this.float, - this.double_, - this.decimal, - this.string, - required this.byte, - this.binary, - required this.date, - this.dateTime, - this.uuid, - required this.password, - this.patternWithDigits, - this.patternWithDigitsAndDelimiter, - }); - - - // minimum: 10 - // maximum: 100 - @JsonKey( - name: r'integer', - required: false, - ) - int? integer; - - // minimum: 20 - // maximum: 200 - @JsonKey( - name: r'int32', - required: false, - ) - int? int32; - - @JsonKey( - name: r'int64', - required: false, - ) - int? int64; - - // minimum: 32.1 - // maximum: 543.2 - @JsonKey( - name: r'number', - required: true, - ) - num number; - - // minimum: 54.3 - // maximum: 987.6 - @JsonKey( - name: r'float', - required: false, - ) - double? float; - - // minimum: 67.8 - // maximum: 123.4 - @JsonKey( - name: r'double', - required: false, - ) - double? double_; - - @JsonKey( - name: r'decimal', - required: false, - ) - double? decimal; - - @JsonKey( - name: r'string', - required: false, - ) - String? string; - - @JsonKey( - name: r'byte', - required: true, - ) - String byte; - - @JsonKey(ignore: true) - MultipartFile? binary; - - @JsonKey( - name: r'date', - required: true, - ) - DateTime date; - - @JsonKey( - name: r'dateTime', - required: false, - ) - DateTime? dateTime; - - @JsonKey( - name: r'uuid', - required: false, - ) - String? uuid; - - @JsonKey( - name: r'password', - required: true, - ) - String password; - - /// A string that is a 10 digit number. Can have leading zeros. - @JsonKey( - name: r'pattern_with_digits', - required: false, - ) - String? patternWithDigits; - - /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. - @JsonKey( - name: r'pattern_with_digits_and_delimiter', - required: false, - ) - String? patternWithDigitsAndDelimiter; - - @override - bool operator ==(Object other) => identical(this, other) || other is FormatTest && - other.integer == integer && - other.int32 == int32 && - other.int64 == int64 && - other.number == number && - other.float == float && - other.double_ == double_ && - other.decimal == decimal && - other.string == string && - other.byte == byte && - other.binary == binary && - other.date == date && - other.dateTime == dateTime && - other.uuid == uuid && - other.password == password && - other.patternWithDigits == patternWithDigits && - other.patternWithDigitsAndDelimiter == patternWithDigitsAndDelimiter; - - @override - int get 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); - - Map toJson() => _$FormatTestToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index 7531069f2ba8..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/has_only_read_only.dart +++ /dev/null @@ -1,56 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class HasOnlyReadOnly { - /// Returns a new [HasOnlyReadOnly] instance. - HasOnlyReadOnly({ - this.bar, - this.foo, - }); - - - @JsonKey( - name: r'bar', - required: false, - ) - String? bar; - - @JsonKey( - name: r'foo', - required: false, - ) - String? foo; - - @override - bool operator ==(Object other) => identical(this, other) || other is HasOnlyReadOnly && - other.bar == bar && - other.foo == foo; - - @override - int get hashCode => - bar.hashCode + - foo.hashCode; - - factory HasOnlyReadOnly.fromJson(Map json) => _$HasOnlyReadOnlyFromJson(json); - - Map toJson() => _$HasOnlyReadOnlyToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index 38c2ee79a9d1..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/health_check_result.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class HealthCheckResult { - /// Returns a new [HealthCheckResult] instance. - HealthCheckResult({ - this.nullableMessage, - }); - - - @JsonKey( - name: r'NullableMessage', - required: false, - ) - String? nullableMessage; - - @override - bool operator ==(Object other) => identical(this, other) || other is HealthCheckResult && - other.nullableMessage == nullableMessage; - - @override - int get hashCode => - nullableMessage.hashCode; - - factory HealthCheckResult.fromJson(Map json) => _$HealthCheckResultFromJson(json); - - Map toJson() => _$HealthCheckResultToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index 4af524d63835..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/inline_response_default.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class InlineResponseDefault { - /// Returns a new [InlineResponseDefault] instance. - InlineResponseDefault({ - this.string, - }); - - - @JsonKey( - name: r'string', - required: false, - ) - Foo? string; - - @override - bool operator ==(Object other) => identical(this, other) || other is InlineResponseDefault && - other.string == string; - - @override - int get hashCode => - string.hashCode; - - factory InlineResponseDefault.fromJson(Map json) => _$InlineResponseDefaultFromJson(json); - - Map toJson() => _$InlineResponseDefaultToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index 26befc75870b..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/map_test.dart +++ /dev/null @@ -1,84 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class MapTest { - /// Returns a new [MapTest] instance. - MapTest({ - this.mapMapOfString = const {}, - this.mapOfEnumString = const {}, - this.directMap = const {}, - this.indirectMap = const {}, - }); - - - @JsonKey( - defaultValue: const {}, - name: r'map_map_of_string', - required: false, - ) - Map>? mapMapOfString; - - @JsonKey( - defaultValue: const {}, - name: r'map_of_enum_string', - required: false, - ) - Map? mapOfEnumString; - - @JsonKey( - defaultValue: const {}, - name: r'direct_map', - required: false, - ) - Map? directMap; - - @JsonKey( - defaultValue: const {}, - name: r'indirect_map', - required: false, - ) - Map? indirectMap; - - @override - bool operator ==(Object other) => identical(this, other) || other is MapTest && - other.mapMapOfString == mapMapOfString && - other.mapOfEnumString == mapOfEnumString && - other.directMap == directMap && - other.indirectMap == indirectMap; - - @override - int get hashCode => - mapMapOfString.hashCode + - mapOfEnumString.hashCode + - directMap.hashCode + - indirectMap.hashCode; - - factory MapTest.fromJson(Map json) => _$MapTestFromJson(json); - - Map toJson() => _$MapTestToJson(this); - - @override - String toString() => toJson().toString(); -} - - -enum MapTestMapOfEnumStringEnum { - UPPER, - lower, -} - 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 deleted file mode 100644 index 8905eefbaf34..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart +++ /dev/null @@ -1,66 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class MixedPropertiesAndAdditionalPropertiesClass { - /// Returns a new [MixedPropertiesAndAdditionalPropertiesClass] instance. - MixedPropertiesAndAdditionalPropertiesClass({ - this.uuid, - this.dateTime, - this.map = const {}, - }); - - - @JsonKey( - name: r'uuid', - required: false, - ) - String? uuid; - - @JsonKey( - name: r'dateTime', - required: false, - ) - DateTime? dateTime; - - @JsonKey( - defaultValue: const {}, - name: r'map', - required: false, - ) - Map? map; - - @override - bool operator ==(Object other) => identical(this, other) || other is MixedPropertiesAndAdditionalPropertiesClass && - other.uuid == uuid && - other.dateTime == dateTime && - other.map == map; - - @override - int get hashCode => - uuid.hashCode + - dateTime.hashCode + - map.hashCode; - - factory MixedPropertiesAndAdditionalPropertiesClass.fromJson(Map json) => _$MixedPropertiesAndAdditionalPropertiesClassFromJson(json); - - Map toJson() => _$MixedPropertiesAndAdditionalPropertiesClassToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index 8cc738ac4864..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model200_response.dart +++ /dev/null @@ -1,56 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class Model200Response { - /// Returns a new [Model200Response] instance. - Model200Response({ - this.name, - this.class_, - }); - - - @JsonKey( - name: r'name', - required: false, - ) - int? name; - - @JsonKey( - name: r'class', - required: false, - ) - String? class_; - - @override - bool operator ==(Object other) => identical(this, other) || other is Model200Response && - other.name == name && - other.class_ == class_; - - @override - int get hashCode => - name.hashCode + - class_.hashCode; - - factory Model200Response.fromJson(Map json) => _$Model200ResponseFromJson(json); - - Map toJson() => _$Model200ResponseToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index b076b0a866f1..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_client.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class ModelClient { - /// Returns a new [ModelClient] instance. - ModelClient({ - this.client, - }); - - - @JsonKey( - name: r'client', - required: false, - ) - String? client; - - @override - bool operator ==(Object other) => identical(this, other) || other is ModelClient && - other.client == client; - - @override - int get hashCode => - client.hashCode; - - factory ModelClient.fromJson(Map json) => _$ModelClientFromJson(json); - - Map toJson() => _$ModelClientToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index 7f59bc83353f..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_file.dart +++ /dev/null @@ -1,48 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class ModelFile { - /// Returns a new [ModelFile] instance. - ModelFile({ - this.sourceURI, - }); - - - /// Test capitalization - @JsonKey( - name: r'sourceURI', - required: false, - ) - String? sourceURI; - - @override - bool operator ==(Object other) => identical(this, other) || other is ModelFile && - other.sourceURI == sourceURI; - - @override - int get hashCode => - sourceURI.hashCode; - - factory ModelFile.fromJson(Map json) => _$ModelFileFromJson(json); - - Map toJson() => _$ModelFileToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index 27c895e4df8d..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_list.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class ModelList { - /// Returns a new [ModelList] instance. - ModelList({ - this.n123list, - }); - - - @JsonKey( - name: r'123-list', - required: false, - ) - String? n123list; - - @override - bool operator ==(Object other) => identical(this, other) || other is ModelList && - other.n123list == n123list; - - @override - int get hashCode => - n123list.hashCode; - - factory ModelList.fromJson(Map json) => _$ModelListFromJson(json); - - Map toJson() => _$ModelListToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index dfd17cd68d24..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_return.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class ModelReturn { - /// Returns a new [ModelReturn] instance. - ModelReturn({ - this.return_, - }); - - - @JsonKey( - name: r'return', - required: false, - ) - int? return_; - - @override - bool operator ==(Object other) => identical(this, other) || other is ModelReturn && - other.return_ == return_; - - @override - int get hashCode => - return_.hashCode; - - factory ModelReturn.fromJson(Map json) => _$ModelReturnFromJson(json); - - Map toJson() => _$ModelReturnToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index fdde2bcae9f2..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/name.dart +++ /dev/null @@ -1,74 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class Name { - /// Returns a new [Name] instance. - Name({ - required this.name, - this.snakeCase, - this.property, - this.n123number, - }); - - - @JsonKey( - name: r'name', - required: true, - ) - int name; - - @JsonKey( - name: r'snake_case', - required: false, - ) - int? snakeCase; - - @JsonKey( - name: r'property', - required: false, - ) - String? property; - - @JsonKey( - name: r'123Number', - required: false, - ) - int? n123number; - - @override - bool operator ==(Object other) => identical(this, other) || other is Name && - other.name == name && - other.snakeCase == snakeCase && - other.property == property && - other.n123number == n123number; - - @override - int get hashCode => - name.hashCode + - snakeCase.hashCode + - property.hashCode + - n123number.hashCode; - - factory Name.fromJson(Map json) => _$NameFromJson(json); - - Map toJson() => _$NameToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index 43d517917971..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/nullable_class.dart +++ /dev/null @@ -1,152 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class NullableClass { - /// Returns a new [NullableClass] instance. - NullableClass({ - this.integerProp, - this.numberProp, - this.booleanProp, - this.stringProp, - this.dateProp, - this.datetimeProp, - this.arrayNullableProp, - this.arrayAndItemsNullableProp, - this.arrayItemsNullable = const [], - this.objectNullableProp, - this.objectAndItemsNullableProp, - this.objectItemsNullable = const {}, - }); - - - @JsonKey( - name: r'integer_prop', - required: false, - ) - int? integerProp; - - @JsonKey( - name: r'number_prop', - required: false, - ) - num? numberProp; - - @JsonKey( - name: r'boolean_prop', - required: false, - ) - bool? booleanProp; - - @JsonKey( - name: r'string_prop', - required: false, - ) - String? stringProp; - - @JsonKey( - name: r'date_prop', - required: false, - ) - DateTime? dateProp; - - @JsonKey( - name: r'datetime_prop', - required: false, - ) - DateTime? datetimeProp; - - @JsonKey( - defaultValue: const [], - name: r'array_nullable_prop', - required: false, - ) - List>? arrayNullableProp; - - @JsonKey( - defaultValue: const [], - name: r'array_and_items_nullable_prop', - required: false, - ) - List>? arrayAndItemsNullableProp; - - @JsonKey( - defaultValue: const [], - name: r'array_items_nullable', - required: false, - ) - List>? arrayItemsNullable; - - @JsonKey( - defaultValue: const {}, - name: r'object_nullable_prop', - required: false, - ) - Map? objectNullableProp; - - @JsonKey( - defaultValue: const {}, - name: r'object_and_items_nullable_prop', - required: false, - ) - Map? objectAndItemsNullableProp; - - @JsonKey( - defaultValue: const {}, - name: r'object_items_nullable', - required: false, - ) - Map? objectItemsNullable; - - @override - bool operator ==(Object other) => identical(this, other) || other is NullableClass && - other.integerProp == integerProp && - other.numberProp == numberProp && - other.booleanProp == booleanProp && - other.stringProp == stringProp && - other.dateProp == dateProp && - other.datetimeProp == datetimeProp && - other.arrayNullableProp == arrayNullableProp && - other.arrayAndItemsNullableProp == arrayAndItemsNullableProp && - other.arrayItemsNullable == arrayItemsNullable && - other.objectNullableProp == objectNullableProp && - other.objectAndItemsNullableProp == objectAndItemsNullableProp && - other.objectItemsNullable == objectItemsNullable; - - @override - int get 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); - - Map toJson() => _$NullableClassToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index c8c391ddb290..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/number_only.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class NumberOnly { - /// Returns a new [NumberOnly] instance. - NumberOnly({ - this.justNumber, - }); - - - @JsonKey( - name: r'JustNumber', - required: false, - ) - num? justNumber; - - @override - bool operator ==(Object other) => identical(this, other) || other is NumberOnly && - other.justNumber == justNumber; - - @override - int get hashCode => - justNumber.hashCode; - - factory NumberOnly.fromJson(Map json) => _$NumberOnlyFromJson(json); - - Map toJson() => _$NumberOnlyToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index 101b0cc84d9a..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/object_with_deprecated_fields.dart +++ /dev/null @@ -1,75 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class ObjectWithDeprecatedFields { - /// Returns a new [ObjectWithDeprecatedFields] instance. - ObjectWithDeprecatedFields({ - this.uuid, - this.id, - this.deprecatedRef, - this.bars = const [], - }); - - - @JsonKey( - name: r'uuid', - required: false, - ) - String? uuid; - - @JsonKey( - name: r'id', - required: false, - ) - num? id; - - @JsonKey( - name: r'deprecatedRef', - required: false, - ) - DeprecatedObject? deprecatedRef; - - @JsonKey( - defaultValue: const [], - name: r'bars', - required: false, - ) - List? bars; - - @override - bool operator ==(Object other) => identical(this, other) || other is ObjectWithDeprecatedFields && - other.uuid == uuid && - other.id == id && - other.deprecatedRef == deprecatedRef && - other.bars == bars; - - @override - int get hashCode => - uuid.hashCode + - id.hashCode + - deprecatedRef.hashCode + - bars.hashCode; - - factory ObjectWithDeprecatedFields.fromJson(Map json) => _$ObjectWithDeprecatedFieldsFromJson(json); - - Map toJson() => _$ObjectWithDeprecatedFieldsToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index 677f533350e3..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/order.dart +++ /dev/null @@ -1,101 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class Order { - /// Returns a new [Order] instance. - Order({ - this.id, - this.petId, - this.quantity, - this.shipDate, - this.status, - this.complete = false, - }); - - - @JsonKey( - name: r'id', - required: false, - ) - int? id; - - @JsonKey( - name: r'petId', - required: false, - ) - int? petId; - - @JsonKey( - name: r'quantity', - required: false, - ) - int? quantity; - - @JsonKey( - name: r'shipDate', - required: false, - ) - DateTime? shipDate; - - /// Order Status - @JsonKey( - name: r'status', - required: false, - ) - OrderStatusEnum? status; - - @JsonKey( - defaultValue: false, - name: r'complete', - required: false, - ) - bool? complete; - - @override - bool operator ==(Object other) => identical(this, other) || other is Order && - other.id == id && - other.petId == petId && - other.quantity == quantity && - other.shipDate == shipDate && - other.status == status && - other.complete == complete; - - @override - int get hashCode => - id.hashCode + - petId.hashCode + - quantity.hashCode + - shipDate.hashCode + - status.hashCode + - complete.hashCode; - - factory Order.fromJson(Map json) => _$OrderFromJson(json); - - Map toJson() => _$OrderToJson(this); - - @override - String toString() => toJson().toString(); -} - -/// Order Status -enum OrderStatusEnum { - placed, - approved, - delivered, -} - 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 deleted file mode 100644 index c8b88c17bfac..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_composite.dart +++ /dev/null @@ -1,65 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class OuterComposite { - /// Returns a new [OuterComposite] instance. - OuterComposite({ - this.myNumber, - this.myString, - this.myBoolean, - }); - - - @JsonKey( - name: r'my_number', - required: false, - ) - num? myNumber; - - @JsonKey( - name: r'my_string', - required: false, - ) - String? myString; - - @JsonKey( - name: r'my_boolean', - required: false, - ) - bool? myBoolean; - - @override - bool operator ==(Object other) => identical(this, other) || other is OuterComposite && - other.myNumber == myNumber && - other.myString == myString && - other.myBoolean == myBoolean; - - @override - int get hashCode => - myNumber.hashCode + - myString.hashCode + - myBoolean.hashCode; - - factory OuterComposite.fromJson(Map json) => _$OuterCompositeFromJson(json); - - Map toJson() => _$OuterCompositeToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index aa95492edc0b..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum.dart +++ /dev/null @@ -1,17 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -enum OuterEnum { - placed, - approved, - delivered, -} 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 deleted file mode 100644 index c69be7155525..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_default_value.dart +++ /dev/null @@ -1,17 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -enum OuterEnumDefaultValue { - placed, - approved, - delivered, -} 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 deleted file mode 100644 index 385736265f65..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer.dart +++ /dev/null @@ -1,17 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -enum OuterEnumInteger { - number0, - number1, - number2, -} 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 deleted file mode 100644 index aef9c365c0bd..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer_default_value.dart +++ /dev/null @@ -1,17 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -enum OuterEnumIntegerDefaultValue { - number0, - number1, - number2, -} 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 deleted file mode 100644 index 9f423d94c83c..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_object_with_enum_property.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class OuterObjectWithEnumProperty { - /// Returns a new [OuterObjectWithEnumProperty] instance. - OuterObjectWithEnumProperty({ - required this.value, - }); - - - @JsonKey( - name: r'value', - required: true, - ) - OuterEnumInteger value; - - @override - bool operator ==(Object other) => identical(this, other) || other is OuterObjectWithEnumProperty && - other.value == value; - - @override - int get hashCode => - value.hashCode; - - factory OuterObjectWithEnumProperty.fromJson(Map json) => _$OuterObjectWithEnumPropertyFromJson(json); - - Map toJson() => _$OuterObjectWithEnumPropertyToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index b3ea5adb346d..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/pet.dart +++ /dev/null @@ -1,102 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class Pet { - /// Returns a new [Pet] instance. - Pet({ - this.id, - this.category, - required this.name, - this.photoUrls = const {}, - this.tags = const [], - this.status, - }); - - - @JsonKey( - name: r'id', - required: false, - ) - int? id; - - @JsonKey( - name: r'category', - required: false, - ) - Category? category; - - @JsonKey( - name: r'name', - required: true, - ) - String name; - - @JsonKey( - defaultValue: const {}, - name: r'photoUrls', - required: true, - ) - Set photoUrls; - - @JsonKey( - defaultValue: const [], - name: r'tags', - required: false, - ) - List? tags; - - /// pet status in the store - @JsonKey( - name: r'status', - required: false, - ) - PetStatusEnum? status; - - @override - bool operator ==(Object other) => identical(this, other) || other is Pet && - other.id == id && - other.category == category && - other.name == name && - other.photoUrls == photoUrls && - other.tags == tags && - other.status == status; - - @override - int get hashCode => - id.hashCode + - category.hashCode + - name.hashCode + - photoUrls.hashCode + - tags.hashCode + - status.hashCode; - - factory Pet.fromJson(Map json) => _$PetFromJson(json); - - Map toJson() => _$PetToJson(this); - - @override - String toString() => toJson().toString(); -} - -/// pet status in the store -enum PetStatusEnum { - available, - pending, - sold, -} - 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 deleted file mode 100644 index b3228e4f1674..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/read_only_first.dart +++ /dev/null @@ -1,56 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class ReadOnlyFirst { - /// Returns a new [ReadOnlyFirst] instance. - ReadOnlyFirst({ - this.bar, - this.baz, - }); - - - @JsonKey( - name: r'bar', - required: false, - ) - String? bar; - - @JsonKey( - name: r'baz', - required: false, - ) - String? baz; - - @override - bool operator ==(Object other) => identical(this, other) || other is ReadOnlyFirst && - other.bar == bar && - other.baz == baz; - - @override - int get hashCode => - bar.hashCode + - baz.hashCode; - - factory ReadOnlyFirst.fromJson(Map json) => _$ReadOnlyFirstFromJson(json); - - Map toJson() => _$ReadOnlyFirstToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index 522bd095ce97..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/special_model_name.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class SpecialModelName { - /// Returns a new [SpecialModelName] instance. - SpecialModelName({ - this.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket, - }); - - - @JsonKey( - name: r'$special[property.name]', - required: false, - ) - int? dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; - - @override - bool operator ==(Object other) => identical(this, other) || other is SpecialModelName && - other.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket == dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; - - @override - int get hashCode => - dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket.hashCode; - - factory SpecialModelName.fromJson(Map json) => _$SpecialModelNameFromJson(json); - - Map toJson() => _$SpecialModelNameToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index abb25e6749e5..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/tag.dart +++ /dev/null @@ -1,56 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class Tag { - /// Returns a new [Tag] instance. - Tag({ - this.id, - this.name, - }); - - - @JsonKey( - name: r'id', - required: false, - ) - int? id; - - @JsonKey( - name: r'name', - required: false, - ) - String? name; - - @override - bool operator ==(Object other) => identical(this, other) || other is Tag && - other.id == id && - other.name == name; - - @override - int get hashCode => - id.hashCode + - name.hashCode; - - factory Tag.fromJson(Map json) => _$TagFromJson(json); - - Map toJson() => _$TagToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index 2e482c6788fc..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/user.dart +++ /dev/null @@ -1,111 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class User { - /// Returns a new [User] instance. - User({ - this.id, - this.username, - this.firstName, - this.lastName, - this.email, - this.password, - this.phone, - this.userStatus, - }); - - - @JsonKey( - name: r'id', - required: false, - ) - int? id; - - @JsonKey( - name: r'username', - required: false, - ) - String? username; - - @JsonKey( - name: r'firstName', - required: false, - ) - String? firstName; - - @JsonKey( - name: r'lastName', - required: false, - ) - String? lastName; - - @JsonKey( - name: r'email', - required: false, - ) - String? email; - - @JsonKey( - name: r'password', - required: false, - ) - String? password; - - @JsonKey( - name: r'phone', - required: false, - ) - String? phone; - - /// User Status - @JsonKey( - name: r'userStatus', - required: false, - ) - int? userStatus; - - @override - bool operator ==(Object other) => identical(this, other) || other is User && - other.id == id && - other.username == username && - other.firstName == firstName && - other.lastName == lastName && - other.email == email && - other.password == password && - other.phone == phone && - other.userStatus == userStatus; - - @override - int get hashCode => - id.hashCode + - username.hashCode + - firstName.hashCode + - lastName.hashCode + - email.hashCode + - password.hashCode + - phone.hashCode + - userStatus.hashCode; - - factory User.fromJson(Map json) => _$UserFromJson(json); - - Map toJson() => _$UserToJson(this); - - @override - String toString() => toJson().toString(); -} - 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 deleted file mode 100644 index ab1ee387cdc2..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/pubspec.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# -# AUTO-GENERATED FILE, DO NOT MODIFY! -# - -name: 'openapi' -version: '1.0.0' -description: 'OpenAPI API client' -homepage: 'homepage' -environment: - sdk: '>=2.14.0 <3.0.0' -dependencies: - http: '>=0.13.0 <0.14.0' - intl: '^0.17.0' - json_annotation: '^4.1.0' -dev_dependencies: - build_runner: '^2.1.4' - json_serializable: '^5.0.2' From a089fc4240049a3711ba3ad322f57cd47ff4bee7 Mon Sep 17 00:00:00 2001 From: agilob Date: Tue, 19 Oct 2021 15:41:49 +0100 Subject: [PATCH 07/39] Make growable false by default --- .../src/main/resources/dart2/api_client.mustache | 16 ++++++++-------- .../petstore_client_lib/lib/api_client.dart | 16 ++++++++-------- .../petstore_client_lib_fake/lib/api_client.dart | 16 ++++++++-------- 3 files changed, 24 insertions(+), 24 deletions(-) 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 d8710438df9c..a20c242a91c7 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache @@ -144,19 +144,19 @@ class ApiClient { } {{#native_serialization}} - Future deserializeAsync(String json, String targetType, {bool? growable}) async => + Future deserializeAsync(String json, String targetType, {bool growable = false}) 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 = false}) { // Remove all spaces. Necessary for regular expressions as well. targetType = targetType.replaceAll(' ', ''); // ignore: parameter_assignments // If the expected target type is String, nothing to do... return targetType == 'String' ? json - : _deserialize(jsonDecode(json), targetType, growable: growable == true); + : _deserialize(jsonDecode(json), targetType, growable: growable); } {{/native_serialization}} @@ -183,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 = false}) { try { switch (targetType) { case 'String': @@ -215,7 +215,7 @@ class ApiClient { targetType = match![1]!; // ignore: parameter_assignments return value .map((dynamic v) => _deserialize(v, targetType, growable: growable)) - .toList(growable: growable == true); + .toList(growable: growable); } if (value is Set && (match = _regSet.firstMatch(targetType)) != null) { targetType = match![1]!; // ignore: parameter_assignments @@ -245,7 +245,7 @@ class DeserializationMessage { const DeserializationMessage({ required this.json, required this.targetType, - this.growable, + this.growable = false, }); /// The JSON value to deserialize. @@ -255,7 +255,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,7 +269,7 @@ Future deserializeAsync(DeserializationMessage message) async { : ApiClient._deserialize( jsonDecode(message.json), targetType, - growable: message.growable == true, + growable: message.growable, ); } {{/native_serialization}} 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 6957d076d7b7..8812133e3d4c 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 @@ -137,19 +137,19 @@ 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 = false}) 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 = false}) { // Remove all spaces. Necessary for regular expressions as well. targetType = targetType.replaceAll(' ', ''); // ignore: parameter_assignments // If the expected target type is String, nothing to do... return targetType == 'String' ? json - : _deserialize(jsonDecode(json), targetType, growable: growable == true); + : _deserialize(jsonDecode(json), targetType, growable: growable); } // ignore: deprecated_member_use_from_same_package @@ -174,7 +174,7 @@ class ApiClient { } } - static dynamic _deserialize(dynamic value, String targetType, {bool? growable}) { + static dynamic _deserialize(dynamic value, String targetType, {bool growable = false}) { try { switch (targetType) { case 'String': @@ -207,7 +207,7 @@ class ApiClient { targetType = match![1]!; // ignore: parameter_assignments return value .map((dynamic v) => _deserialize(v, targetType, growable: growable)) - .toList(growable: growable == true); + .toList(growable: growable); } if (value is Set && (match = _regSet.firstMatch(targetType)) != null) { targetType = match![1]!; // ignore: parameter_assignments @@ -235,7 +235,7 @@ class DeserializationMessage { const DeserializationMessage({ required this.json, required this.targetType, - this.growable, + this.growable = false, }); /// The JSON value to deserialize. @@ -245,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. @@ -259,7 +259,7 @@ Future deserializeAsync(DeserializationMessage message) async { : ApiClient._deserialize( jsonDecode(message.json), targetType, - growable: message.growable == true, + growable: message.growable, ); } 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 0dc275fb2add..501df78849bb 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 @@ -140,19 +140,19 @@ 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 = false}) 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 = false}) { // Remove all spaces. Necessary for regular expressions as well. targetType = targetType.replaceAll(' ', ''); // ignore: parameter_assignments // If the expected target type is String, nothing to do... return targetType == 'String' ? json - : _deserialize(jsonDecode(json), targetType, growable: growable == true); + : _deserialize(jsonDecode(json), targetType, growable: growable); } // ignore: deprecated_member_use_from_same_package @@ -177,7 +177,7 @@ class ApiClient { } } - static dynamic _deserialize(dynamic value, String targetType, {bool? growable}) { + static dynamic _deserialize(dynamic value, String targetType, {bool growable = false}) { try { switch (targetType) { case 'String': @@ -290,7 +290,7 @@ class ApiClient { targetType = match![1]!; // ignore: parameter_assignments return value .map((dynamic v) => _deserialize(v, targetType, growable: growable)) - .toList(growable: growable == true); + .toList(growable: growable); } if (value is Set && (match = _regSet.firstMatch(targetType)) != null) { targetType = match![1]!; // ignore: parameter_assignments @@ -318,7 +318,7 @@ class DeserializationMessage { const DeserializationMessage({ required this.json, required this.targetType, - this.growable, + this.growable = false, }); /// The JSON value to deserialize. @@ -328,7 +328,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. @@ -342,7 +342,7 @@ Future deserializeAsync(DeserializationMessage message) async { : ApiClient._deserialize( jsonDecode(message.json), targetType, - growable: message.growable == true, + growable: message.growable, ); } From 0b255fb6fea1d419fe37c5fd13b0b28072c30497 Mon Sep 17 00:00:00 2001 From: agilob Date: Tue, 19 Oct 2021 15:49:17 +0100 Subject: [PATCH 08/39] Make value not nullable --- .../src/main/resources/dart2/api_helper.mustache | 4 ++-- .../petstore/dart2/petstore_client_lib/lib/api_helper.dart | 4 ++-- .../dart2/petstore_client_lib_fake/lib/api_helper.dart | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) 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 bfce6bbdff78..ad971eff624f 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_helper.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_helper.mustache @@ -4,10 +4,10 @@ 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 ?? 'null')}'; + String toString() => '${Uri.encodeQueryComponent(name)}=${Uri.encodeQueryComponent(value)}'; } // Ported from the Java version. 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 03bc620096b7..32a5314b6292 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 @@ -14,10 +14,10 @@ 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 ?? 'null')}'; + String toString() => '${Uri.encodeQueryComponent(name)}=${Uri.encodeQueryComponent(value)}'; } // Ported from the Java version. 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 72aec21e8f1a..bebf84957a4a 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 @@ -14,10 +14,10 @@ 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 ?? 'null')}'; + String toString() => '${Uri.encodeQueryComponent(name)}=${Uri.encodeQueryComponent(value)}'; } // Ported from the Java version. From 86f8fbf6261ef5dbb148b87ec642294bb1d2c742 Mon Sep 17 00:00:00 2001 From: agilob Date: Tue, 19 Oct 2021 15:58:08 +0100 Subject: [PATCH 09/39] Remove redundant null check --- .../src/main/resources/dart2/api_client.mustache | 1 - .../petstore/dart2/petstore_client_lib/lib/api_client.dart | 1 - .../petstore/dart2/petstore_client_lib_fake/lib/api_client.dart | 1 - 3 files changed, 3 deletions(-) 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 a20c242a91c7..02c1c7614573 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache @@ -72,7 +72,6 @@ class ApiClient { headerParams.addAll(_defaultHeaderMap); final urlEncodedQueryParams = queryParams - .where((param) => param.value != null) .map((param) => '$param'); final queryString = urlEncodedQueryParams.isNotEmpty 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 8812133e3d4c..e0fbda7abeba 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 @@ -66,7 +66,6 @@ class ApiClient { headerParams.addAll(_defaultHeaderMap); final urlEncodedQueryParams = queryParams - .where((param) => param.value != null) .map((param) => '$param'); final queryString = urlEncodedQueryParams.isNotEmpty 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 501df78849bb..f822cbf1531f 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 @@ -69,7 +69,6 @@ class ApiClient { headerParams.addAll(_defaultHeaderMap); final urlEncodedQueryParams = queryParams - .where((param) => param.value != null) .map((param) => '$param'); final queryString = urlEncodedQueryParams.isNotEmpty From 54c3b48ec49fa49f694511de7434c27aa4449a20 Mon Sep 17 00:00:00 2001 From: agilob Date: Tue, 19 Oct 2021 16:05:39 +0100 Subject: [PATCH 10/39] Revert linter fix --- .../src/main/resources/dart2/api.mustache | 1 + .../petstore_client_lib/lib/api/pet_api.dart | 8 ++++++++ .../petstore_client_lib/lib/api/store_api.dart | 4 ++++ .../petstore_client_lib/lib/api/user_api.dart | 8 ++++++++ .../lib/api/another_fake_api.dart | 1 + .../lib/api/default_api.dart | 1 + .../lib/api/fake_api.dart | 17 +++++++++++++++++ .../lib/api/fake_classname_tags123_api.dart | 1 + .../lib/api/pet_api.dart | 9 +++++++++ .../lib/api/store_api.dart | 4 ++++ .../lib/api/user_api.dart | 8 ++++++++ 11 files changed, 62 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/dart2/api.mustache b/modules/openapi-generator/src/main/resources/dart2/api.mustache index 7ded27c3632f..0f90871edc13 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api.mustache @@ -188,6 +188,7 @@ class {{{classname}}} { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), '{{{returnType}}}',) as {{{returnType}}}; {{/isMap}}{{/isArray}}{{/native_serialization}} } + return Future<{{{returnType}}}>.value(); {{/returnType}} } {{/operation}} 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 6e1989ac654f..5cfd3e13f006 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 @@ -69,6 +69,7 @@ class PetApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet; } + return Future.value(); } /// Deletes a pet @@ -133,6 +134,7 @@ class PetApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// Finds Pets by status @@ -197,6 +199,7 @@ class PetApi { .toList(growable: false); } + return Future>.value(); } /// Finds Pets by tags @@ -261,6 +264,7 @@ class PetApi { .toList(growable: false); } + return Future>.value(); } /// Find pet by ID @@ -321,6 +325,7 @@ class PetApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet; } + return Future.value(); } /// Update an existing pet @@ -376,6 +381,7 @@ class PetApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet; } + return Future.value(); } /// Updates a pet in the store with form data @@ -450,6 +456,7 @@ class PetApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// uploads an image @@ -532,5 +539,6 @@ class PetApi { 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 efb38091aef0..95378ea5db24 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 @@ -74,6 +74,7 @@ class StoreApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// Returns pet inventories by status @@ -123,6 +124,7 @@ class StoreApi { return Map.from(await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map'),); } + return Future>.value(); } /// Find purchase order by ID @@ -183,6 +185,7 @@ class StoreApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order; } + return Future.value(); } /// Place an order for a pet @@ -238,5 +241,6 @@ class StoreApi { 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 44a3fd574fdd..ebd7476a1ac4 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 @@ -73,6 +73,7 @@ class UserApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// Creates list of users with given input array @@ -128,6 +129,7 @@ class UserApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// Creates list of users with given input array @@ -183,6 +185,7 @@ class UserApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// Delete user @@ -243,6 +246,7 @@ class UserApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// Get user by user name @@ -299,6 +303,7 @@ class UserApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'User',) as User; } + return Future.value(); } /// Logs user into the system @@ -363,6 +368,7 @@ class UserApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'String',) as String; } + return Future.value(); } /// Logs out current logged in user session @@ -408,6 +414,7 @@ class UserApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// Updated user @@ -474,5 +481,6 @@ class UserApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } } 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 349b54ce5ee4..7093b4183cff 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 @@ -73,5 +73,6 @@ class AnotherFakeApi { 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 24ff987cd3f3..9f58276b929a 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 @@ -56,5 +56,6 @@ class DefaultApi { 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 a9c4fa54244a..ec407b3474b4 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 @@ -59,6 +59,7 @@ class FakeApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'HealthCheckResult',) as HealthCheckResult; } + return Future.value(); } /// test http signature authentication @@ -134,6 +135,7 @@ class FakeApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// Test serialization of outer boolean types @@ -189,6 +191,7 @@ class FakeApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'bool',) as bool; } + return Future.value(); } /// Test serialization of object with outer number type @@ -244,6 +247,7 @@ class FakeApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'OuterComposite',) as OuterComposite; } + return Future.value(); } /// Test serialization of outer number types @@ -299,6 +303,7 @@ class FakeApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'num',) as num; } + return Future.value(); } /// Test serialization of outer string types @@ -354,6 +359,7 @@ class FakeApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'String',) as String; } + return Future.value(); } /// Test serialization of enum (int) properties with examples @@ -409,6 +415,7 @@ class FakeApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'OuterObjectWithEnumProperty',) as OuterObjectWithEnumProperty; } + return Future.value(); } /// For this test, the body has to be a binary file. @@ -464,6 +471,7 @@ class FakeApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// For this test, the body for this request must reference a schema named `File`. @@ -517,6 +525,7 @@ class FakeApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// Performs an HTTP 'PUT /fake/body-with-query-params' operation and returns the [Response]. @@ -571,6 +580,7 @@ class FakeApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// To test \"client\" model @@ -630,6 +640,7 @@ class FakeApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ModelClient',) as ModelClient; } + return Future.value(); } /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -806,6 +817,7 @@ class FakeApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// To test enum parameters @@ -933,6 +945,7 @@ class FakeApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// Fake endpoint to test group parameters (optional) @@ -1036,6 +1049,7 @@ class FakeApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// test inline additionalProperties @@ -1091,6 +1105,7 @@ class FakeApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// test json serialization of form data @@ -1158,6 +1173,7 @@ class FakeApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// To test the collection format in query parameters @@ -1245,5 +1261,6 @@ class FakeApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } } 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 73e8973d2ce4..6260f4e98600 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 @@ -73,5 +73,6 @@ class FakeClassnameTags123Api { 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 6d40c3d256ba..ab545fceb711 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 @@ -69,6 +69,7 @@ class PetApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// Deletes a pet @@ -133,6 +134,7 @@ class PetApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// Finds Pets by status @@ -197,6 +199,7 @@ class PetApi { .toList(growable: false); } + return Future>.value(); } /// Finds Pets by tags @@ -261,6 +264,7 @@ class PetApi { .toSet(); } + return Future>.value(); } /// Find pet by ID @@ -321,6 +325,7 @@ class PetApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet; } + return Future.value(); } /// Update an existing pet @@ -376,6 +381,7 @@ class PetApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// Updates a pet in the store with form data @@ -450,6 +456,7 @@ class PetApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// uploads an image @@ -532,6 +539,7 @@ class PetApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ApiResponse',) as ApiResponse; } + return Future.value(); } /// uploads an image (required) @@ -614,5 +622,6 @@ class PetApi { 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 a6847ca18f99..a77a9cb2a87e 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 @@ -74,6 +74,7 @@ class StoreApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// Returns pet inventories by status @@ -123,6 +124,7 @@ class StoreApi { return Map.from(await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map'),); } + return Future>.value(); } /// Find purchase order by ID @@ -183,6 +185,7 @@ class StoreApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order; } + return Future.value(); } /// Place an order for a pet @@ -238,5 +241,6 @@ class StoreApi { 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 9b9e5edd5cb0..c0434ee0c991 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 @@ -73,6 +73,7 @@ class UserApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// Creates list of users with given input array @@ -128,6 +129,7 @@ class UserApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// Creates list of users with given input array @@ -183,6 +185,7 @@ class UserApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// Delete user @@ -243,6 +246,7 @@ class UserApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// Get user by user name @@ -299,6 +303,7 @@ class UserApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'User',) as User; } + return Future.value(); } /// Logs user into the system @@ -363,6 +368,7 @@ class UserApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'String',) as String; } + return Future.value(); } /// Logs out current logged in user session @@ -408,6 +414,7 @@ class UserApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } /// Updated user @@ -474,5 +481,6 @@ class UserApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map',) as Map; } + return Future>.value(); } } From 3b375b5ecd709f349cf4f6f59df60daf4ae737e1 Mon Sep 17 00:00:00 2001 From: agilob Date: Tue, 19 Oct 2021 16:09:25 +0100 Subject: [PATCH 11/39] Provide required username and pass --- .../src/main/resources/dart2/api_client.mustache | 2 +- .../petstore/dart2/petstore_client_lib_fake/lib/api_client.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 02c1c7614573..d9384ec91fec 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache @@ -7,7 +7,7 @@ class ApiClient { {{#authMethods}} {{#isBasic}} {{#isBasicBasic}} - _authentications[r'{{{name}}}'] = HttpBasicAuth(); + _authentications[r'{{{name}}}'] = HttpBasicAuth('user', 'password'); {{/isBasicBasic}} {{#isBasicBearer}} _authentications[r'{{{name}}}'] = HttpBearerAuth(); 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 f822cbf1531f..0a9c4a5cd634 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 @@ -16,7 +16,7 @@ class ApiClient { _authentications[r'api_key'] = ApiKeyAuth('header', 'api_key'); _authentications[r'api_key_query'] = ApiKeyAuth('query', 'api_key_query'); _authentications[r'bearer_test'] = HttpBearerAuth(); - _authentications[r'http_basic_test'] = HttpBasicAuth(); + _authentications[r'http_basic_test'] = HttpBasicAuth('user', 'password'); _authentications[r'petstore_auth'] = OAuth(); } From 81d5891177fa0ef23f9cbfd632439b3768b140ee Mon Sep 17 00:00:00 2001 From: agilob Date: Tue, 19 Oct 2021 17:42:52 +0100 Subject: [PATCH 12/39] Revert initial abstractDartCodeGen changes --- .../languages/AbstractDartCodegen.java | 77 ++-- .../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 +- .../dart2/petstore_client_lib/doc/PetApi.md | 14 +- .../dart2/petstore_client_lib/doc/StoreApi.md | 7 +- .../dart2/petstore_client_lib/doc/UserApi.md | 42 +-- .../petstore_client_lib/lib/api/pet_api.dart | 20 +- .../lib/api/store_api.dart | 10 +- .../petstore_client_lib/lib/api/user_api.dart | 60 +--- .../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 +-- .../lib/api/fake_api.dart | 100 +----- .../lib/api/pet_api.dart | 40 +-- .../lib/api/store_api.dart | 10 +- .../lib/api/user_api.dart | 60 +--- .../lib/model/enum_test.dart | 8 +- .../lib/model/nullable_class.dart | 24 +- 51 files changed, 578 insertions(+), 2525 deletions(-) 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 29d764c81413..c456b0438e31 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 @@ -1,5 +1,7 @@ package org.openapitools.codegen.languages; +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.Schema; @@ -112,12 +114,13 @@ public AbstractDartCodegen() { setReservedWordsLowerCase(reservedWordsList); // These types return isPrimitive=true in templates - languageSpecificPrimitives = new HashSet<>(5); - languageSpecificPrimitives.add("String"); - languageSpecificPrimitives.add("bool"); - languageSpecificPrimitives.add("int"); - languageSpecificPrimitives.add("num"); - languageSpecificPrimitives.add("double"); + languageSpecificPrimitives = Sets.newHashSet( + "String", + "bool", + "int", + "num", + "double" + ); typeMapping = new HashMap<>(); typeMapping.put("Array", "List"); @@ -148,17 +151,18 @@ public AbstractDartCodegen() { typeMapping.put("AnyType", "Object"); // Data types of the above values which are automatically imported - defaultIncludes = new HashSet<>(); - defaultIncludes.add("String"); - defaultIncludes.add("bool"); - defaultIncludes.add("int"); - defaultIncludes.add("num"); - defaultIncludes.add("double"); - defaultIncludes.add("List"); - defaultIncludes.add("Set"); - defaultIncludes.add("Map"); - defaultIncludes.add("DateTime"); - defaultIncludes.add("Object"); + defaultIncludes = Sets.newHashSet( + "String", + "bool", + "int", + "num", + "double", + "List", + "Set", + "Map", + "DateTime", + "Object" + ); imports.put("String", "dart:core"); imports.put("bool", "dart:core"); @@ -341,7 +345,7 @@ public String toVarName(String name) { // replace all characters that have a mapping but ignore underscores // append an underscore to each replacement so that it can be camelized if (name.chars().anyMatch(character -> specialCharReplacements.containsKey("" + ((char) character)))) { - name = escape(name, specialCharReplacements, Collections.singletonList("_"), "_"); + name = escape(name, specialCharReplacements, Lists.newArrayList("_"), "_"); } // remove the rest name = sanitizeName(name); @@ -503,21 +507,6 @@ 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 @@ -543,12 +532,6 @@ 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 @@ -661,20 +644,15 @@ 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 (!needsEnumEscape(datatype) && value.matches("^-?\\d.*")) { + if (("number".equalsIgnoreCase(datatype) || + "double".equalsIgnoreCase(datatype) || + "int".equalsIgnoreCase(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("-"); @@ -685,7 +663,8 @@ public String toEnumVarName(String value, String datatype) { @Override public String toEnumValue(String value, String datatype) { - if (!needsEnumEscape(datatype)) { + if ("number".equalsIgnoreCase(datatype) || + "int".equalsIgnoreCase(datatype)) { return value; } else { return "'" + escapeText(value) + "'"; 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 8a7b517f9929..740e5ee66833 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** -> Map fakeHttpSignatureTest(pet, query1, header1) +> fakeHttpSignatureTest(pet, query1, header1) test http signature authentication @@ -83,8 +83,7 @@ final String query1 = query1_example; // String | query parameter final String header1 = header1_example; // String | header parameter try { - final response = api.fakeHttpSignatureTest(pet, query1, header1); - print(response); + api.fakeHttpSignatureTest(pet, query1, header1); } catch on DioError (e) { print('Exception when calling FakeApi->fakeHttpSignatureTest: $e\n'); } @@ -100,7 +99,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -329,7 +328,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** -> Map testBodyWithBinary(body) +> testBodyWithBinary(body) @@ -343,8 +342,7 @@ final api = Openapi().getFakeApi(); final MultipartFile body = BINARY_DATA_HERE; // MultipartFile | image to upload try { - final response = api.testBodyWithBinary(body); - print(response); + api.testBodyWithBinary(body); } catch on DioError (e) { print('Exception when calling FakeApi->testBodyWithBinary: $e\n'); } @@ -358,7 +356,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -372,7 +370,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** -> Map testBodyWithFileSchema(fileSchemaTestClass) +> testBodyWithFileSchema(fileSchemaTestClass) @@ -386,8 +384,7 @@ final api = Openapi().getFakeApi(); final FileSchemaTestClass fileSchemaTestClass = ; // FileSchemaTestClass | try { - final response = api.testBodyWithFileSchema(fileSchemaTestClass); - print(response); + api.testBodyWithFileSchema(fileSchemaTestClass); } catch on DioError (e) { print('Exception when calling FakeApi->testBodyWithFileSchema: $e\n'); } @@ -401,7 +398,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -415,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** -> Map testBodyWithQueryParams(query, user) +> testBodyWithQueryParams(query, user) @@ -428,8 +425,7 @@ final String query = query_example; // String | final User user = ; // User | try { - final response = api.testBodyWithQueryParams(query, user); - print(response); + api.testBodyWithQueryParams(query, user); } catch on DioError (e) { print('Exception when calling FakeApi->testBodyWithQueryParams: $e\n'); } @@ -444,7 +440,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -501,7 +497,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** -> Map testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) +> testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -531,8 +527,7 @@ final String password = password_example; // String | None final String callback = callback_example; // String | None try { - final response = api.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); - print(response); + api.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); } catch on DioError (e) { print('Exception when calling FakeApi->testEndpointParameters: $e\n'); } @@ -559,7 +554,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -573,7 +568,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) # **testEnumParameters** -> Map testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) +> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) To test enum parameters @@ -594,8 +589,7 @@ final BuiltList enumFormStringArray = ; // BuiltList | Form para final String enumFormString = enumFormString_example; // String | Form parameter enum test (string) try { - final response = api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); - print(response); + api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); } catch on DioError (e) { print('Exception when calling FakeApi->testEnumParameters: $e\n'); } @@ -616,7 +610,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -630,7 +624,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** -> Map testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) +> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) Fake endpoint to test group parameters (optional) @@ -652,8 +646,7 @@ final bool booleanGroup = true; // bool | Boolean in group parameters final int int64Group = 789; // int | Integer in group parameters try { - final response = api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); - print(response); + api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); } catch on DioError (e) { print('Exception when calling FakeApi->testGroupParameters: $e\n'); } @@ -672,7 +665,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -686,7 +679,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) # **testInlineAdditionalProperties** -> Map testInlineAdditionalProperties(requestBody) +> testInlineAdditionalProperties(requestBody) test inline additionalProperties @@ -698,8 +691,7 @@ final api = Openapi().getFakeApi(); final BuiltMap requestBody = ; // BuiltMap | request body try { - final response = api.testInlineAdditionalProperties(requestBody); - print(response); + api.testInlineAdditionalProperties(requestBody); } catch on DioError (e) { print('Exception when calling FakeApi->testInlineAdditionalProperties: $e\n'); } @@ -713,7 +705,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -727,7 +719,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** -> Map testJsonFormData(param, param2) +> testJsonFormData(param, param2) test json serialization of form data @@ -740,8 +732,7 @@ final String param = param_example; // String | field1 final String param2 = param2_example; // String | field2 try { - final response = api.testJsonFormData(param, param2); - print(response); + api.testJsonFormData(param, param2); } catch on DioError (e) { print('Exception when calling FakeApi->testJsonFormData: $e\n'); } @@ -756,7 +747,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -770,7 +761,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** -> Map testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) +> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) @@ -790,8 +781,7 @@ final String allowEmpty = allowEmpty_example; // String | final BuiltMap language = ; // BuiltMap | try { - final response = api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); - print(response); + api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); } catch on DioError (e) { print('Exception when calling FakeApi->testQueryParameterCollectionFormat: $e\n'); } @@ -811,7 +801,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### 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 aa5855adc7c8..6afc643ea56a 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** -> Map addPet(pet) +> addPet(pet) Add a new pet to the store @@ -35,8 +35,7 @@ final api = Openapi().getPetApi(); final Pet pet = ; // Pet | Pet object that needs to be added to the store try { - final response = api.addPet(pet); - print(response); + api.addPet(pet); } catch on DioError (e) { print('Exception when calling PetApi->addPet: $e\n'); } @@ -50,7 +49,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -64,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** -> Map deletePet(petId, apiKey) +> deletePet(petId, apiKey) Deletes a pet @@ -79,8 +78,7 @@ final int petId = 789; // int | Pet id to delete final String apiKey = apiKey_example; // String | try { - final response = api.deletePet(petId, apiKey); - print(response); + api.deletePet(petId, apiKey); } catch on DioError (e) { print('Exception when calling PetApi->deletePet: $e\n'); } @@ -95,7 +93,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -246,7 +244,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** -> Map updatePet(pet) +> updatePet(pet) Update an existing pet @@ -260,8 +258,7 @@ final api = Openapi().getPetApi(); final Pet pet = ; // Pet | Pet object that needs to be added to the store try { - final response = api.updatePet(pet); - print(response); + api.updatePet(pet); } catch on DioError (e) { print('Exception when calling PetApi->updatePet: $e\n'); } @@ -275,7 +272,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -289,7 +286,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** -> Map updatePetWithForm(petId, name, status) +> updatePetWithForm(petId, name, status) Updates a pet in the store with form data @@ -305,8 +302,7 @@ final String name = name_example; // String | Updated name of the pet final String status = status_example; // String | Updated status of the pet try { - final response = api.updatePetWithForm(petId, name, status); - print(response); + api.updatePetWithForm(petId, name, status); } catch on DioError (e) { print('Exception when calling PetApi->updatePetWithForm: $e\n'); } @@ -322,7 +318,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### 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 35cd9192f754..5c8a683579e2 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** -> Map deleteOrder(orderId) +> deleteOrder(orderId) Delete purchase order by ID @@ -30,8 +30,7 @@ final api = Openapi().getStoreApi(); final String orderId = orderId_example; // String | ID of the order that needs to be deleted try { - final response = api.deleteOrder(orderId); - print(response); + api.deleteOrder(orderId); } catch on DioError (e) { print('Exception when calling StoreApi->deleteOrder: $e\n'); } @@ -45,7 +44,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### 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 63d49fb5f285..e3af05ffb087 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** -> Map createUser(user) +> createUser(user) Create user @@ -34,8 +34,7 @@ final api = Openapi().getUserApi(); final User user = ; // User | Created user object try { - final response = api.createUser(user); - print(response); + api.createUser(user); } catch on DioError (e) { print('Exception when calling UserApi->createUser: $e\n'); } @@ -49,7 +48,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -63,7 +62,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** -> Map createUsersWithArrayInput(user) +> createUsersWithArrayInput(user) Creates list of users with given input array @@ -75,8 +74,7 @@ final api = Openapi().getUserApi(); final BuiltList user = ; // BuiltList | List of user object try { - final response = api.createUsersWithArrayInput(user); - print(response); + api.createUsersWithArrayInput(user); } catch on DioError (e) { print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); } @@ -90,7 +88,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -104,7 +102,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** -> Map createUsersWithListInput(user) +> createUsersWithListInput(user) Creates list of users with given input array @@ -116,8 +114,7 @@ final api = Openapi().getUserApi(); final BuiltList user = ; // BuiltList | List of user object try { - final response = api.createUsersWithListInput(user); - print(response); + api.createUsersWithListInput(user); } catch on DioError (e) { print('Exception when calling UserApi->createUsersWithListInput: $e\n'); } @@ -131,7 +128,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -145,7 +142,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** -> Map deleteUser(username) +> deleteUser(username) Delete user @@ -159,8 +156,7 @@ final api = Openapi().getUserApi(); final String username = username_example; // String | The name that needs to be deleted try { - final response = api.deleteUser(username); - print(response); + api.deleteUser(username); } catch on DioError (e) { print('Exception when calling UserApi->deleteUser: $e\n'); } @@ -174,7 +170,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -272,7 +268,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** -> Map logoutUser() +> logoutUser() Logs out current logged in user session @@ -283,8 +279,7 @@ import 'package:openapi/api.dart'; final api = Openapi().getUserApi(); try { - final response = api.logoutUser(); - print(response); + api.logoutUser(); } catch on DioError (e) { print('Exception when calling UserApi->logoutUser: $e\n'); } @@ -295,7 +290,7 @@ This endpoint does not need any parameter. ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -309,7 +304,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** -> Map updateUser(username, user) +> updateUser(username, user) Updated user @@ -324,8 +319,7 @@ final String username = username_example; // String | name that need to be delet final User user = ; // User | Updated user object try { - final response = api.updateUser(username, user); - print(response); + api.updateUser(username, user); } catch on DioError (e) { print('Exception when calling UserApi->updateUser: $e\n'); } @@ -340,7 +334,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### 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 bcaf84800bd1..d8640836000a 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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> fakeHttpSignatureTest({ + Future> fakeHttpSignatureTest({ required Pet pet, String? query1, String? header1, @@ -179,34 +179,7 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// fakeOuterBooleanSerialize @@ -671,9 +644,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> testBodyWithBinary({ + Future> testBodyWithBinary({ MultipartFile? body, CancelToken? cancelToken, Map? headers, @@ -721,34 +694,7 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// testBodyWithFileSchema @@ -763,9 +709,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> testBodyWithFileSchema({ + Future> testBodyWithFileSchema({ required FileSchemaTestClass fileSchemaTestClass, CancelToken? cancelToken, Map? headers, @@ -814,34 +760,7 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// testBodyWithQueryParams @@ -857,9 +776,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> testBodyWithQueryParams({ + Future> testBodyWithQueryParams({ required String query, required User user, CancelToken? cancelToken, @@ -915,34 +834,7 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// To test \"client\" model @@ -1063,9 +955,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> testEndpointParameters({ + Future> testEndpointParameters({ required num number, required double double_, required String patternWithoutDelimiter, @@ -1147,34 +1039,7 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// To test enum parameters @@ -1196,9 +1061,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> testEnumParameters({ + Future> testEnumParameters({ BuiltList? enumHeaderStringArray, String? enumHeaderString = '-efg', BuiltList? enumQueryStringArray, @@ -1267,34 +1132,7 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// Fake endpoint to test group parameters (optional) @@ -1314,9 +1152,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> testGroupParameters({ + Future> testGroupParameters({ required int requiredStringGroup, required bool requiredBooleanGroup, required int requiredInt64Group, @@ -1367,34 +1205,7 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// test inline additionalProperties @@ -1409,9 +1220,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> testInlineAdditionalProperties({ + Future> testInlineAdditionalProperties({ required BuiltMap requestBody, CancelToken? cancelToken, Map? headers, @@ -1460,34 +1271,7 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// test json serialization of form data @@ -1503,9 +1287,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> testJsonFormData({ + Future> testJsonFormData({ required String param, required String param2, CancelToken? cancelToken, @@ -1557,34 +1341,7 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// testQueryParameterCollectionFormat @@ -1605,9 +1362,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> testQueryParameterCollectionFormat({ + Future> testQueryParameterCollectionFormat({ required BuiltList pipe, required BuiltList ioutil, required BuiltList http, @@ -1654,34 +1411,7 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } } 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 9b381b4b2793..a1d8a0fc2d7a 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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> addPet({ + Future> addPet({ required Pet pet, CancelToken? cancelToken, Map? headers, @@ -88,34 +88,7 @@ class PetApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// Deletes a pet @@ -131,9 +104,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> deletePet({ + Future> deletePet({ required int petId, String? apiKey, CancelToken? cancelToken, @@ -170,34 +143,7 @@ class PetApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// Finds Pets by status @@ -462,9 +408,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> updatePet({ + Future> updatePet({ required Pet pet, CancelToken? cancelToken, Map? headers, @@ -518,34 +464,7 @@ class PetApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// Updates a pet in the store with form data @@ -562,9 +481,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> updatePetWithForm({ + Future> updatePetWithForm({ required int petId, String? name, String? status, @@ -622,34 +541,7 @@ class PetApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// 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 c3ba931fc8d4..bb10a12cbe55 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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> deleteOrder({ + Future> deleteOrder({ required String orderId, CancelToken? cancelToken, Map? headers, @@ -62,34 +62,7 @@ class StoreApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// 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 bfabfdf86bfc..e628b862c029 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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> createUser({ + Future> createUser({ required User user, CancelToken? cancelToken, Map? headers, @@ -82,34 +82,7 @@ class UserApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// Creates list of users with given input array @@ -124,9 +97,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> createUsersWithArrayInput({ + Future> createUsersWithArrayInput({ required BuiltList user, CancelToken? cancelToken, Map? headers, @@ -175,34 +148,7 @@ class UserApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// Creates list of users with given input array @@ -217,9 +163,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> createUsersWithListInput({ + Future> createUsersWithListInput({ required BuiltList user, CancelToken? cancelToken, Map? headers, @@ -268,34 +214,7 @@ class UserApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// Delete user @@ -310,9 +229,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> deleteUser({ + Future> deleteUser({ required String username, CancelToken? cancelToken, Map? headers, @@ -342,34 +261,7 @@ class UserApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// Get user by user name @@ -535,9 +427,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> logoutUser({ + Future> logoutUser({ CancelToken? cancelToken, Map? headers, Map? extra, @@ -566,34 +458,7 @@ class UserApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// Updated user @@ -609,9 +474,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> updateUser({ + Future> updateUser({ required String username, required User user, CancelToken? cancelToken, @@ -661,34 +526,7 @@ class UserApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } } 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 9fbe49730914..7ca76d22fe0f 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: r1.1) + @BuiltValueEnumConst(wireName: r'1.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 8a7b517f9929..740e5ee66833 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** -> Map fakeHttpSignatureTest(pet, query1, header1) +> fakeHttpSignatureTest(pet, query1, header1) test http signature authentication @@ -83,8 +83,7 @@ final String query1 = query1_example; // String | query parameter final String header1 = header1_example; // String | header parameter try { - final response = api.fakeHttpSignatureTest(pet, query1, header1); - print(response); + api.fakeHttpSignatureTest(pet, query1, header1); } catch on DioError (e) { print('Exception when calling FakeApi->fakeHttpSignatureTest: $e\n'); } @@ -100,7 +99,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -329,7 +328,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** -> Map testBodyWithBinary(body) +> testBodyWithBinary(body) @@ -343,8 +342,7 @@ final api = Openapi().getFakeApi(); final MultipartFile body = BINARY_DATA_HERE; // MultipartFile | image to upload try { - final response = api.testBodyWithBinary(body); - print(response); + api.testBodyWithBinary(body); } catch on DioError (e) { print('Exception when calling FakeApi->testBodyWithBinary: $e\n'); } @@ -358,7 +356,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -372,7 +370,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** -> Map testBodyWithFileSchema(fileSchemaTestClass) +> testBodyWithFileSchema(fileSchemaTestClass) @@ -386,8 +384,7 @@ final api = Openapi().getFakeApi(); final FileSchemaTestClass fileSchemaTestClass = ; // FileSchemaTestClass | try { - final response = api.testBodyWithFileSchema(fileSchemaTestClass); - print(response); + api.testBodyWithFileSchema(fileSchemaTestClass); } catch on DioError (e) { print('Exception when calling FakeApi->testBodyWithFileSchema: $e\n'); } @@ -401,7 +398,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -415,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** -> Map testBodyWithQueryParams(query, user) +> testBodyWithQueryParams(query, user) @@ -428,8 +425,7 @@ final String query = query_example; // String | final User user = ; // User | try { - final response = api.testBodyWithQueryParams(query, user); - print(response); + api.testBodyWithQueryParams(query, user); } catch on DioError (e) { print('Exception when calling FakeApi->testBodyWithQueryParams: $e\n'); } @@ -444,7 +440,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -501,7 +497,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** -> Map testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) +> testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -531,8 +527,7 @@ final String password = password_example; // String | None final String callback = callback_example; // String | None try { - final response = api.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); - print(response); + api.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); } catch on DioError (e) { print('Exception when calling FakeApi->testEndpointParameters: $e\n'); } @@ -559,7 +554,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -573,7 +568,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) # **testEnumParameters** -> Map testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) +> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) To test enum parameters @@ -594,8 +589,7 @@ final BuiltList enumFormStringArray = ; // BuiltList | Form para final String enumFormString = enumFormString_example; // String | Form parameter enum test (string) try { - final response = api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); - print(response); + api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); } catch on DioError (e) { print('Exception when calling FakeApi->testEnumParameters: $e\n'); } @@ -616,7 +610,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -630,7 +624,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** -> Map testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) +> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) Fake endpoint to test group parameters (optional) @@ -652,8 +646,7 @@ final bool booleanGroup = true; // bool | Boolean in group parameters final int int64Group = 789; // int | Integer in group parameters try { - final response = api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); - print(response); + api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); } catch on DioError (e) { print('Exception when calling FakeApi->testGroupParameters: $e\n'); } @@ -672,7 +665,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -686,7 +679,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) # **testInlineAdditionalProperties** -> Map testInlineAdditionalProperties(requestBody) +> testInlineAdditionalProperties(requestBody) test inline additionalProperties @@ -698,8 +691,7 @@ final api = Openapi().getFakeApi(); final BuiltMap requestBody = ; // BuiltMap | request body try { - final response = api.testInlineAdditionalProperties(requestBody); - print(response); + api.testInlineAdditionalProperties(requestBody); } catch on DioError (e) { print('Exception when calling FakeApi->testInlineAdditionalProperties: $e\n'); } @@ -713,7 +705,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -727,7 +719,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** -> Map testJsonFormData(param, param2) +> testJsonFormData(param, param2) test json serialization of form data @@ -740,8 +732,7 @@ final String param = param_example; // String | field1 final String param2 = param2_example; // String | field2 try { - final response = api.testJsonFormData(param, param2); - print(response); + api.testJsonFormData(param, param2); } catch on DioError (e) { print('Exception when calling FakeApi->testJsonFormData: $e\n'); } @@ -756,7 +747,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -770,7 +761,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** -> Map testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) +> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) @@ -790,8 +781,7 @@ final String allowEmpty = allowEmpty_example; // String | final BuiltMap language = ; // BuiltMap | try { - final response = api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); - print(response); + api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); } catch on DioError (e) { print('Exception when calling FakeApi->testQueryParameterCollectionFormat: $e\n'); } @@ -811,7 +801,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### 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 aa5855adc7c8..6afc643ea56a 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** -> Map addPet(pet) +> addPet(pet) Add a new pet to the store @@ -35,8 +35,7 @@ final api = Openapi().getPetApi(); final Pet pet = ; // Pet | Pet object that needs to be added to the store try { - final response = api.addPet(pet); - print(response); + api.addPet(pet); } catch on DioError (e) { print('Exception when calling PetApi->addPet: $e\n'); } @@ -50,7 +49,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -64,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** -> Map deletePet(petId, apiKey) +> deletePet(petId, apiKey) Deletes a pet @@ -79,8 +78,7 @@ final int petId = 789; // int | Pet id to delete final String apiKey = apiKey_example; // String | try { - final response = api.deletePet(petId, apiKey); - print(response); + api.deletePet(petId, apiKey); } catch on DioError (e) { print('Exception when calling PetApi->deletePet: $e\n'); } @@ -95,7 +93,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -246,7 +244,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** -> Map updatePet(pet) +> updatePet(pet) Update an existing pet @@ -260,8 +258,7 @@ final api = Openapi().getPetApi(); final Pet pet = ; // Pet | Pet object that needs to be added to the store try { - final response = api.updatePet(pet); - print(response); + api.updatePet(pet); } catch on DioError (e) { print('Exception when calling PetApi->updatePet: $e\n'); } @@ -275,7 +272,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -289,7 +286,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** -> Map updatePetWithForm(petId, name, status) +> updatePetWithForm(petId, name, status) Updates a pet in the store with form data @@ -305,8 +302,7 @@ final String name = name_example; // String | Updated name of the pet final String status = status_example; // String | Updated status of the pet try { - final response = api.updatePetWithForm(petId, name, status); - print(response); + api.updatePetWithForm(petId, name, status); } catch on DioError (e) { print('Exception when calling PetApi->updatePetWithForm: $e\n'); } @@ -322,7 +318,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### 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 35cd9192f754..5c8a683579e2 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** -> Map deleteOrder(orderId) +> deleteOrder(orderId) Delete purchase order by ID @@ -30,8 +30,7 @@ final api = Openapi().getStoreApi(); final String orderId = orderId_example; // String | ID of the order that needs to be deleted try { - final response = api.deleteOrder(orderId); - print(response); + api.deleteOrder(orderId); } catch on DioError (e) { print('Exception when calling StoreApi->deleteOrder: $e\n'); } @@ -45,7 +44,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### 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 63d49fb5f285..e3af05ffb087 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** -> Map createUser(user) +> createUser(user) Create user @@ -34,8 +34,7 @@ final api = Openapi().getUserApi(); final User user = ; // User | Created user object try { - final response = api.createUser(user); - print(response); + api.createUser(user); } catch on DioError (e) { print('Exception when calling UserApi->createUser: $e\n'); } @@ -49,7 +48,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -63,7 +62,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** -> Map createUsersWithArrayInput(user) +> createUsersWithArrayInput(user) Creates list of users with given input array @@ -75,8 +74,7 @@ final api = Openapi().getUserApi(); final BuiltList user = ; // BuiltList | List of user object try { - final response = api.createUsersWithArrayInput(user); - print(response); + api.createUsersWithArrayInput(user); } catch on DioError (e) { print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); } @@ -90,7 +88,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -104,7 +102,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** -> Map createUsersWithListInput(user) +> createUsersWithListInput(user) Creates list of users with given input array @@ -116,8 +114,7 @@ final api = Openapi().getUserApi(); final BuiltList user = ; // BuiltList | List of user object try { - final response = api.createUsersWithListInput(user); - print(response); + api.createUsersWithListInput(user); } catch on DioError (e) { print('Exception when calling UserApi->createUsersWithListInput: $e\n'); } @@ -131,7 +128,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -145,7 +142,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** -> Map deleteUser(username) +> deleteUser(username) Delete user @@ -159,8 +156,7 @@ final api = Openapi().getUserApi(); final String username = username_example; // String | The name that needs to be deleted try { - final response = api.deleteUser(username); - print(response); + api.deleteUser(username); } catch on DioError (e) { print('Exception when calling UserApi->deleteUser: $e\n'); } @@ -174,7 +170,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -272,7 +268,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** -> Map logoutUser() +> logoutUser() Logs out current logged in user session @@ -283,8 +279,7 @@ import 'package:openapi/api.dart'; final api = Openapi().getUserApi(); try { - final response = api.logoutUser(); - print(response); + api.logoutUser(); } catch on DioError (e) { print('Exception when calling UserApi->logoutUser: $e\n'); } @@ -295,7 +290,7 @@ This endpoint does not need any parameter. ### Return type -**Map<String, dynamic>** +void (empty response body) ### Authorization @@ -309,7 +304,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** -> Map updateUser(username, user) +> updateUser(username, user) Updated user @@ -324,8 +319,7 @@ final String username = username_example; // String | name that need to be delet final User user = ; // User | Updated user object try { - final response = api.updateUser(username, user); - print(response); + api.updateUser(username, user); } catch on DioError (e) { print('Exception when calling UserApi->updateUser: $e\n'); } @@ -340,7 +334,7 @@ Name | Type | Description | Notes ### Return type -**Map<String, dynamic>** +void (empty response body) ### 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 e7c372919982..d600aba3181f 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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> fakeHttpSignatureTest({ + Future> fakeHttpSignatureTest({ required Pet pet, String? query1, String? header1, @@ -179,34 +179,7 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// fakeOuterBooleanSerialize @@ -671,9 +644,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> testBodyWithBinary({ + Future> testBodyWithBinary({ MultipartFile? body, CancelToken? cancelToken, Map? headers, @@ -721,34 +694,7 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// testBodyWithFileSchema @@ -763,9 +709,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> testBodyWithFileSchema({ + Future> testBodyWithFileSchema({ required FileSchemaTestClass fileSchemaTestClass, CancelToken? cancelToken, Map? headers, @@ -814,34 +760,7 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// testBodyWithQueryParams @@ -857,9 +776,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> testBodyWithQueryParams({ + Future> testBodyWithQueryParams({ required String query, required User user, CancelToken? cancelToken, @@ -915,34 +834,7 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// To test \"client\" model @@ -1063,9 +955,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> testEndpointParameters({ + Future> testEndpointParameters({ required num number, required double double_, required String patternWithoutDelimiter, @@ -1147,34 +1039,7 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// To test enum parameters @@ -1196,9 +1061,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> testEnumParameters({ + Future> testEnumParameters({ BuiltList? enumHeaderStringArray, String? enumHeaderString = '-efg', BuiltList? enumQueryStringArray, @@ -1267,34 +1132,7 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// Fake endpoint to test group parameters (optional) @@ -1314,9 +1152,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> testGroupParameters({ + Future> testGroupParameters({ required int requiredStringGroup, required bool requiredBooleanGroup, required int requiredInt64Group, @@ -1367,34 +1205,7 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// test inline additionalProperties @@ -1409,9 +1220,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> testInlineAdditionalProperties({ + Future> testInlineAdditionalProperties({ required BuiltMap requestBody, CancelToken? cancelToken, Map? headers, @@ -1460,34 +1271,7 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// test json serialization of form data @@ -1503,9 +1287,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> testJsonFormData({ + Future> testJsonFormData({ required String param, required String param2, CancelToken? cancelToken, @@ -1557,34 +1341,7 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// testQueryParameterCollectionFormat @@ -1605,9 +1362,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> testQueryParameterCollectionFormat({ + Future> testQueryParameterCollectionFormat({ required BuiltList pipe, required BuiltList ioutil, required BuiltList http, @@ -1654,34 +1411,7 @@ class FakeApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } } 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 e3081c5669b1..50ab6268859d 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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> addPet({ + Future> addPet({ required Pet pet, CancelToken? cancelToken, Map? headers, @@ -88,34 +88,7 @@ class PetApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// Deletes a pet @@ -131,9 +104,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> deletePet({ + Future> deletePet({ required int petId, String? apiKey, CancelToken? cancelToken, @@ -170,34 +143,7 @@ class PetApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// Finds Pets by status @@ -462,9 +408,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> updatePet({ + Future> updatePet({ required Pet pet, CancelToken? cancelToken, Map? headers, @@ -518,34 +464,7 @@ class PetApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// Updates a pet in the store with form data @@ -562,9 +481,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> updatePetWithForm({ + Future> updatePetWithForm({ required int petId, String? name, String? status, @@ -622,34 +541,7 @@ class PetApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// 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 ce26498abe7d..93d5ccbe97cc 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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> deleteOrder({ + Future> deleteOrder({ required String orderId, CancelToken? cancelToken, Map? headers, @@ -62,34 +62,7 @@ class StoreApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// 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 89d60062b970..6faaed6336d1 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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> createUser({ + Future> createUser({ required User user, CancelToken? cancelToken, Map? headers, @@ -82,34 +82,7 @@ class UserApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// Creates list of users with given input array @@ -124,9 +97,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> createUsersWithArrayInput({ + Future> createUsersWithArrayInput({ required BuiltList user, CancelToken? cancelToken, Map? headers, @@ -175,34 +148,7 @@ class UserApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// Creates list of users with given input array @@ -217,9 +163,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> createUsersWithListInput({ + Future> createUsersWithListInput({ required BuiltList user, CancelToken? cancelToken, Map? headers, @@ -268,34 +214,7 @@ class UserApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// Delete user @@ -310,9 +229,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> deleteUser({ + Future> deleteUser({ required String username, CancelToken? cancelToken, Map? headers, @@ -342,34 +261,7 @@ class UserApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// Get user by user name @@ -535,9 +427,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> logoutUser({ + Future> logoutUser({ CancelToken? cancelToken, Map? headers, Map? extra, @@ -566,34 +458,7 @@ class UserApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } /// Updated user @@ -609,9 +474,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] containing a [Response] with a [Map] as data + /// Returns a [Future] /// Throws [DioError] if API call or serialization fails - Future>> updateUser({ + Future> updateUser({ required String username, required User user, CancelToken? cancelToken, @@ -661,34 +526,7 @@ class UserApi { onReceiveProgress: onReceiveProgress, ); - 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, - ); + return _response; } } 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 9fbe49730914..7ca76d22fe0f 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: r1.1) + @BuiltValueEnumConst(wireName: r'1.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 31204f0cef97..a93f8fe393b3 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** -> Map deletePet(petId, apiKey) +> deletePet(petId, apiKey) Deletes a pet @@ -78,8 +78,7 @@ var petId = 789; // int | Pet id to delete var apiKey = apiKey_example; // String | try { - var result = api_instance.deletePet(petId, apiKey); - print(result); + api_instance.deletePet(petId, apiKey); } catch (e) { print('Exception when calling PetApi->deletePet: $e\n'); } @@ -94,7 +93,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -288,7 +287,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** -> Map updatePetWithForm(petId, name, status) +> updatePetWithForm(petId, name, status) Updates a pet in the store with form data @@ -304,8 +303,7 @@ var name = name_example; // String | Updated name of the pet var status = status_example; // String | Updated status of the pet try { - var result = api_instance.updatePetWithForm(petId, name, status); - print(result); + api_instance.updatePetWithForm(petId, name, status); } catch (e) { print('Exception when calling PetApi->updatePetWithForm: $e\n'); } @@ -321,7 +319,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### 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 d6277aa80376..fb3dddd9fb3c 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** -> Map deleteOrder(orderId) +> deleteOrder(orderId) Delete purchase order by ID @@ -30,8 +30,7 @@ var api_instance = new StoreApi(); var orderId = orderId_example; // String | ID of the order that needs to be deleted try { - var result = api_instance.deleteOrder(orderId); - print(result); + api_instance.deleteOrder(orderId); } catch (e) { print('Exception when calling StoreApi->deleteOrder: $e\n'); } @@ -45,7 +44,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### 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 f17d8685caa1..efb3cf578df7 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** -> Map createUser(user) +> createUser(user) Create user @@ -38,8 +38,7 @@ var api_instance = new UserApi(); var user = new User(); // User | Created user object try { - var result = api_instance.createUser(user); - print(result); + api_instance.createUser(user); } catch (e) { print('Exception when calling UserApi->createUser: $e\n'); } @@ -53,7 +52,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -67,7 +66,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) # **createUsersWithArrayInput** -> Map createUsersWithArrayInput(user) +> createUsersWithArrayInput(user) Creates list of users with given input array @@ -83,8 +82,7 @@ var api_instance = new UserApi(); var user = [new BuiltList()]; // BuiltList | List of user object try { - var result = api_instance.createUsersWithArrayInput(user); - print(result); + api_instance.createUsersWithArrayInput(user); } catch (e) { print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); } @@ -98,7 +96,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -112,7 +110,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) # **createUsersWithListInput** -> Map createUsersWithListInput(user) +> createUsersWithListInput(user) Creates list of users with given input array @@ -128,8 +126,7 @@ var api_instance = new UserApi(); var user = [new BuiltList()]; // BuiltList | List of user object try { - var result = api_instance.createUsersWithListInput(user); - print(result); + api_instance.createUsersWithListInput(user); } catch (e) { print('Exception when calling UserApi->createUsersWithListInput: $e\n'); } @@ -143,7 +140,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -157,7 +154,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) # **deleteUser** -> Map deleteUser(username) +> deleteUser(username) Delete user @@ -175,8 +172,7 @@ var api_instance = new UserApi(); var username = username_example; // String | The name that needs to be deleted try { - var result = api_instance.deleteUser(username); - print(result); + api_instance.deleteUser(username); } catch (e) { print('Exception when calling UserApi->deleteUser: $e\n'); } @@ -190,7 +186,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -288,7 +284,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** -> Map logoutUser() +> logoutUser() Logs out current logged in user session @@ -303,8 +299,7 @@ import 'package:openapi/api.dart'; var api_instance = new UserApi(); try { - var result = api_instance.logoutUser(); - print(result); + api_instance.logoutUser(); } catch (e) { print('Exception when calling UserApi->logoutUser: $e\n'); } @@ -315,7 +310,7 @@ This endpoint does not need any parameter. ### Return type -**Map** +void (empty response body) ### Authorization @@ -329,7 +324,7 @@ This endpoint does not need any parameter. [[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** -> Map updateUser(username, user) +> updateUser(username, user) Updated user @@ -348,8 +343,7 @@ var username = username_example; // String | name that need to be deleted var user = new User(); // User | Updated user object try { - var result = api_instance.updateUser(username, user); - print(result); + api_instance.updateUser(username, user); } catch (e) { print('Exception when calling UserApi->updateUser: $e\n'); } @@ -364,7 +358,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### 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 88ffb8ff8b9e..70fc2b2dbe66 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,22 +130,7 @@ class PetApi { options: _request, ); - 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, - ); + return _response; } /// Finds Pets by status @@ -402,7 +387,7 @@ class PetApi { /// Updates a pet in the store with form data /// /// - Future>> updatePetWithForm( + Future> updatePetWithForm( int petId, { String name, String status, @@ -448,22 +433,7 @@ class PetApi { options: _request, ); - 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, - ); + return _response; } /// 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 d8a6fecc416d..80b074645c82 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,22 +57,7 @@ class StoreApi { options: _request, ); - 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, - ); + return _response; } /// 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 7c4d0f2845f6..fef22be0b977 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,28 +67,13 @@ class UserApi { options: _request, ); - 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, - ); + return _response; } /// Creates list of users with given input array /// /// - Future>> createUsersWithArrayInput( + Future> createUsersWithArrayInput( BuiltList user, { CancelToken cancelToken, Map headers, @@ -132,28 +117,13 @@ class UserApi { options: _request, ); - 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, - ); + return _response; } /// Creates list of users with given input array /// /// - Future>> createUsersWithListInput( + Future> createUsersWithListInput( BuiltList user, { CancelToken cancelToken, Map headers, @@ -197,28 +167,13 @@ class UserApi { options: _request, ); - 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, - ); + return _response; } /// Delete user /// /// This can only be done by the logged in user. - Future>> deleteUser( + Future> deleteUser( String username, { CancelToken cancelToken, Map headers, @@ -259,22 +214,7 @@ class UserApi { options: _request, ); - 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, - ); + return _response; } /// Get user by user name @@ -391,7 +331,7 @@ class UserApi { /// Logs out current logged in user session /// /// - Future>> logoutUser({ + Future> logoutUser({ CancelToken cancelToken, Map headers, Map extra, @@ -431,28 +371,13 @@ class UserApi { options: _request, ); - 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, - ); + return _response; } /// Updated user /// /// This can only be done by the logged in user. - Future>> updateUser( + Future> updateUser( String username, User user, { CancelToken cancelToken, @@ -497,22 +422,7 @@ class UserApi { options: _request, ); - 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, - ); + return _response; } } 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 316de9339f1b..46b337cdc187 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** -> Map fakeHttpSignatureTest(pet, query1, header1) +> fakeHttpSignatureTest(pet, query1, header1) test http signature authentication @@ -83,8 +83,7 @@ var query1 = query1_example; // String | query parameter var header1 = header1_example; // String | header parameter try { - var result = api_instance.fakeHttpSignatureTest(pet, query1, header1); - print(result); + api_instance.fakeHttpSignatureTest(pet, query1, header1); } catch (e) { print('Exception when calling FakeApi->fakeHttpSignatureTest: $e\n'); } @@ -100,7 +99,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -329,7 +328,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** -> Map testBodyWithBinary(body) +> testBodyWithBinary(body) @@ -343,8 +342,7 @@ var api_instance = new FakeApi(); var body = new Uint8List(); // Uint8List | image to upload try { - var result = api_instance.testBodyWithBinary(body); - print(result); + api_instance.testBodyWithBinary(body); } catch (e) { print('Exception when calling FakeApi->testBodyWithBinary: $e\n'); } @@ -358,7 +356,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -372,7 +370,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** -> Map testBodyWithFileSchema(fileSchemaTestClass) +> testBodyWithFileSchema(fileSchemaTestClass) @@ -386,8 +384,7 @@ var api_instance = new FakeApi(); var fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | try { - var result = api_instance.testBodyWithFileSchema(fileSchemaTestClass); - print(result); + api_instance.testBodyWithFileSchema(fileSchemaTestClass); } catch (e) { print('Exception when calling FakeApi->testBodyWithFileSchema: $e\n'); } @@ -401,7 +398,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -415,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** -> Map testBodyWithQueryParams(query, user) +> testBodyWithQueryParams(query, user) @@ -428,8 +425,7 @@ var query = query_example; // String | var user = new User(); // User | try { - var result = api_instance.testBodyWithQueryParams(query, user); - print(result); + api_instance.testBodyWithQueryParams(query, user); } catch (e) { print('Exception when calling FakeApi->testBodyWithQueryParams: $e\n'); } @@ -444,7 +440,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -501,7 +497,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** -> Map testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) +> testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -531,8 +527,7 @@ var password = password_example; // String | None var callback = callback_example; // String | None try { - var result = api_instance.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); - print(result); + api_instance.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); } catch (e) { print('Exception when calling FakeApi->testEndpointParameters: $e\n'); } @@ -559,7 +554,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -573,7 +568,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) # **testEnumParameters** -> Map testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) +> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) To test enum parameters @@ -594,8 +589,7 @@ var enumFormStringArray = []; // BuiltList | Form parameter enum test (s var enumFormString = enumFormString_example; // String | Form parameter enum test (string) try { - var result = api_instance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); - print(result); + api_instance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); } catch (e) { print('Exception when calling FakeApi->testEnumParameters: $e\n'); } @@ -616,7 +610,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -630,7 +624,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** -> Map testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) +> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) Fake endpoint to test group parameters (optional) @@ -652,8 +646,7 @@ var booleanGroup = true; // bool | Boolean in group parameters var int64Group = 789; // int | Integer in group parameters try { - var result = api_instance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); - print(result); + api_instance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); } catch (e) { print('Exception when calling FakeApi->testGroupParameters: $e\n'); } @@ -672,7 +665,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -686,7 +679,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) # **testInlineAdditionalProperties** -> Map testInlineAdditionalProperties(requestBody) +> testInlineAdditionalProperties(requestBody) test inline additionalProperties @@ -698,8 +691,7 @@ var api_instance = new FakeApi(); var requestBody = new BuiltMap(); // BuiltMap | request body try { - var result = api_instance.testInlineAdditionalProperties(requestBody); - print(result); + api_instance.testInlineAdditionalProperties(requestBody); } catch (e) { print('Exception when calling FakeApi->testInlineAdditionalProperties: $e\n'); } @@ -713,7 +705,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -727,7 +719,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** -> Map testJsonFormData(param, param2) +> testJsonFormData(param, param2) test json serialization of form data @@ -740,8 +732,7 @@ var param = param_example; // String | field1 var param2 = param2_example; // String | field2 try { - var result = api_instance.testJsonFormData(param, param2); - print(result); + api_instance.testJsonFormData(param, param2); } catch (e) { print('Exception when calling FakeApi->testJsonFormData: $e\n'); } @@ -756,7 +747,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -770,7 +761,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** -> Map testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) +> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) @@ -790,8 +781,7 @@ var allowEmpty = allowEmpty_example; // String | var language = ; // BuiltMap | try { - var result = api_instance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); - print(result); + api_instance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); } catch (e) { print('Exception when calling FakeApi->testQueryParameterCollectionFormat: $e\n'); } @@ -811,7 +801,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### 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 cd3043dbc128..1a13704db188 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** -> Map addPet(pet) +> addPet(pet) Add a new pet to the store @@ -35,8 +35,7 @@ var api_instance = new PetApi(); var pet = new Pet(); // Pet | Pet object that needs to be added to the store try { - var result = api_instance.addPet(pet); - print(result); + api_instance.addPet(pet); } catch (e) { print('Exception when calling PetApi->addPet: $e\n'); } @@ -50,7 +49,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -64,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** -> Map deletePet(petId, apiKey) +> deletePet(petId, apiKey) Deletes a pet @@ -79,8 +78,7 @@ var petId = 789; // int | Pet id to delete var apiKey = apiKey_example; // String | try { - var result = api_instance.deletePet(petId, apiKey); - print(result); + api_instance.deletePet(petId, apiKey); } catch (e) { print('Exception when calling PetApi->deletePet: $e\n'); } @@ -95,7 +93,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -246,7 +244,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** -> Map updatePet(pet) +> updatePet(pet) Update an existing pet @@ -260,8 +258,7 @@ var api_instance = new PetApi(); var pet = new Pet(); // Pet | Pet object that needs to be added to the store try { - var result = api_instance.updatePet(pet); - print(result); + api_instance.updatePet(pet); } catch (e) { print('Exception when calling PetApi->updatePet: $e\n'); } @@ -275,7 +272,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -289,7 +286,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** -> Map updatePetWithForm(petId, name, status) +> updatePetWithForm(petId, name, status) Updates a pet in the store with form data @@ -305,8 +302,7 @@ var name = name_example; // String | Updated name of the pet var status = status_example; // String | Updated status of the pet try { - var result = api_instance.updatePetWithForm(petId, name, status); - print(result); + api_instance.updatePetWithForm(petId, name, status); } catch (e) { print('Exception when calling PetApi->updatePetWithForm: $e\n'); } @@ -322,7 +318,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### 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 989484c2341d..d1cc77910a9e 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** -> Map deleteOrder(orderId) +> deleteOrder(orderId) Delete purchase order by ID @@ -30,8 +30,7 @@ var api_instance = new StoreApi(); var orderId = orderId_example; // String | ID of the order that needs to be deleted try { - var result = api_instance.deleteOrder(orderId); - print(result); + api_instance.deleteOrder(orderId); } catch (e) { print('Exception when calling StoreApi->deleteOrder: $e\n'); } @@ -45,7 +44,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### 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 9789b2d941ae..0ef486c0809f 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** -> Map createUser(user) +> createUser(user) Create user @@ -34,8 +34,7 @@ var api_instance = new UserApi(); var user = new User(); // User | Created user object try { - var result = api_instance.createUser(user); - print(result); + api_instance.createUser(user); } catch (e) { print('Exception when calling UserApi->createUser: $e\n'); } @@ -49,7 +48,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -63,7 +62,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** -> Map createUsersWithArrayInput(user) +> createUsersWithArrayInput(user) Creates list of users with given input array @@ -75,8 +74,7 @@ var api_instance = new UserApi(); var user = [new BuiltList()]; // BuiltList | List of user object try { - var result = api_instance.createUsersWithArrayInput(user); - print(result); + api_instance.createUsersWithArrayInput(user); } catch (e) { print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); } @@ -90,7 +88,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -104,7 +102,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** -> Map createUsersWithListInput(user) +> createUsersWithListInput(user) Creates list of users with given input array @@ -116,8 +114,7 @@ var api_instance = new UserApi(); var user = [new BuiltList()]; // BuiltList | List of user object try { - var result = api_instance.createUsersWithListInput(user); - print(result); + api_instance.createUsersWithListInput(user); } catch (e) { print('Exception when calling UserApi->createUsersWithListInput: $e\n'); } @@ -131,7 +128,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -145,7 +142,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** -> Map deleteUser(username) +> deleteUser(username) Delete user @@ -159,8 +156,7 @@ var api_instance = new UserApi(); var username = username_example; // String | The name that needs to be deleted try { - var result = api_instance.deleteUser(username); - print(result); + api_instance.deleteUser(username); } catch (e) { print('Exception when calling UserApi->deleteUser: $e\n'); } @@ -174,7 +170,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -272,7 +268,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** -> Map logoutUser() +> logoutUser() Logs out current logged in user session @@ -283,8 +279,7 @@ import 'package:openapi/api.dart'; var api_instance = new UserApi(); try { - var result = api_instance.logoutUser(); - print(result); + api_instance.logoutUser(); } catch (e) { print('Exception when calling UserApi->logoutUser: $e\n'); } @@ -295,7 +290,7 @@ This endpoint does not need any parameter. ### Return type -**Map** +void (empty response body) ### Authorization @@ -309,7 +304,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** -> Map updateUser(username, user) +> updateUser(username, user) Updated user @@ -324,8 +319,7 @@ var username = username_example; // String | name that need to be deleted var user = new User(); // User | Updated user object try { - var result = api_instance.updateUser(username, user); - print(result); + api_instance.updateUser(username, user); } catch (e) { print('Exception when calling UserApi->updateUser: $e\n'); } @@ -340,7 +334,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### 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 64a0a740847b..6df5299a4779 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,22 +133,7 @@ class FakeApi { options: _request, ); - 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, - ); + return _response; } /// @@ -429,7 +414,7 @@ class FakeApi { /// /// /// For this test, the body has to be a binary file. - Future>> testBodyWithBinary( + Future> testBodyWithBinary( Uint8List body, { CancelToken cancelToken, Map headers, @@ -465,28 +450,13 @@ class FakeApi { options: _request, ); - 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, - ); + return _response; } /// /// /// For this test, the body for this request must reference a schema named `File`. - Future>> testBodyWithFileSchema( + Future> testBodyWithFileSchema( FileSchemaTestClass fileSchemaTestClass, { CancelToken cancelToken, Map headers, @@ -523,28 +493,13 @@ class FakeApi { options: _request, ); - 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, - ); + return _response; } /// /// /// - Future>> testBodyWithQueryParams( + Future> testBodyWithQueryParams( String query, User user, { CancelToken cancelToken, @@ -585,22 +540,7 @@ class FakeApi { options: _request, ); - 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, - ); + return _response; } /// To test \"client\" model @@ -664,7 +604,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, @@ -733,28 +673,13 @@ class FakeApi { options: _request, ); - 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, - ); + return _response; } /// To test enum parameters /// /// To test enum parameters - Future>> testEnumParameters({ + Future> testEnumParameters({ BuiltList enumHeaderStringArray, String enumHeaderString, BuiltList enumQueryStringArray, @@ -808,28 +733,13 @@ class FakeApi { options: _request, ); - 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, - ); + return _response; } /// Fake endpoint to test group parameters (optional) /// /// Fake endpoint to test group parameters (optional) - Future>> testGroupParameters( + Future> testGroupParameters( int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { @@ -881,28 +791,13 @@ class FakeApi { options: _request, ); - 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, - ); + return _response; } /// test inline additionalProperties /// /// - Future>> testInlineAdditionalProperties( + Future> testInlineAdditionalProperties( BuiltMap requestBody, { CancelToken cancelToken, Map headers, @@ -939,28 +834,13 @@ class FakeApi { options: _request, ); - 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, - ); + return _response; } /// test json serialization of form data /// /// - Future>> testJsonFormData( + Future> testJsonFormData( String param, String param2, { CancelToken cancelToken, @@ -1000,28 +880,13 @@ class FakeApi { options: _request, ); - 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, - ); + return _response; } /// /// /// To test the collection format in query parameters - Future>> testQueryParameterCollectionFormat( + Future> testQueryParameterCollectionFormat( BuiltList pipe, BuiltList ioutil, BuiltList http, @@ -1070,22 +935,7 @@ class FakeApi { options: _request, ); - 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, - ); + return _response; } } 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 671204510726..9cc7beeb57ed 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,28 +68,13 @@ class PetApi { options: _request, ); - 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, - ); + return _response; } /// Deletes a pet /// /// - Future>> deletePet( + Future> deletePet( int petId, { String apiKey, CancelToken cancelToken, @@ -130,22 +115,7 @@ class PetApi { options: _request, ); - 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, - ); + return _response; } /// Finds Pets by status @@ -339,7 +309,7 @@ class PetApi { /// Update an existing pet /// /// - Future>> updatePet( + Future> updatePet( Pet pet, { CancelToken cancelToken, Map headers, @@ -381,28 +351,13 @@ class PetApi { options: _request, ); - 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, - ); + return _response; } /// Updates a pet in the store with form data /// /// - Future>> updatePetWithForm( + Future> updatePetWithForm( int petId, { String name, String status, @@ -448,22 +403,7 @@ class PetApi { options: _request, ); - 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, - ); + return _response; } /// 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 f205b5b5b38d..14fa8b601219 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,22 +57,7 @@ class StoreApi { options: _request, ); - 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, - ); + return _response; } /// 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 67ae75723b01..86032dba94ae 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,28 +60,13 @@ class UserApi { options: _request, ); - 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, - ); + return _response; } /// Creates list of users with given input array /// /// - Future>> createUsersWithArrayInput( + Future> createUsersWithArrayInput( BuiltList user, { CancelToken cancelToken, Map headers, @@ -118,28 +103,13 @@ class UserApi { options: _request, ); - 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, - ); + return _response; } /// Creates list of users with given input array /// /// - Future>> createUsersWithListInput( + Future> createUsersWithListInput( BuiltList user, { CancelToken cancelToken, Map headers, @@ -176,28 +146,13 @@ class UserApi { options: _request, ); - 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, - ); + return _response; } /// Delete user /// /// This can only be done by the logged in user. - Future>> deleteUser( + Future> deleteUser( String username, { CancelToken cancelToken, Map headers, @@ -231,22 +186,7 @@ class UserApi { options: _request, ); - 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, - ); + return _response; } /// Get user by user name @@ -363,7 +303,7 @@ class UserApi { /// Logs out current logged in user session /// /// - Future>> logoutUser({ + Future> logoutUser({ CancelToken cancelToken, Map headers, Map extra, @@ -396,28 +336,13 @@ class UserApi { options: _request, ); - 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, - ); + return _response; } /// Updated user /// /// This can only be done by the logged in user. - Future>> updateUser( + Future> updateUser( String username, User user, { CancelToken cancelToken, @@ -455,22 +380,7 @@ class UserApi { options: _request, ); - 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, - ); + return _response; } } 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 d57b1ae14633..4df59b2cc374 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: r1.1) + @BuiltValueEnumConst(wireName: r'1.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_client_lib/doc/PetApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/PetApi.md index 14a6916be1ed..3100f670bc78 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** -> Map deletePet(petId, apiKey) +> deletePet(petId, apiKey) Deletes a pet @@ -78,8 +78,7 @@ final petId = 789; // int | Pet id to delete final apiKey = apiKey_example; // String | try { - final result = api_instance.deletePet(petId, apiKey); - print(result); + api_instance.deletePet(petId, apiKey); } catch (e) { print('Exception when calling PetApi->deletePet: $e\n'); } @@ -94,7 +93,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -288,7 +287,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** -> Map updatePetWithForm(petId, name, status) +> updatePetWithForm(petId, name, status) Updates a pet in the store with form data @@ -304,8 +303,7 @@ final name = name_example; // String | Updated name of the pet final status = status_example; // String | Updated status of the pet try { - final result = api_instance.updatePetWithForm(petId, name, status); - print(result); + api_instance.updatePetWithForm(petId, name, status); } catch (e) { print('Exception when calling PetApi->updatePetWithForm: $e\n'); } @@ -321,7 +319,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### 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 a84349e6188f..1f0790985794 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** -> Map deleteOrder(orderId) +> deleteOrder(orderId) Delete purchase order by ID @@ -30,8 +30,7 @@ final api_instance = StoreApi(); final orderId = orderId_example; // String | ID of the order that needs to be deleted try { - final result = api_instance.deleteOrder(orderId); - print(result); + api_instance.deleteOrder(orderId); } catch (e) { print('Exception when calling StoreApi->deleteOrder: $e\n'); } @@ -45,7 +44,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### 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 895ae2783d9a..7907143ecaa6 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** -> Map createUser(user) +> createUser(user) Create user @@ -38,8 +38,7 @@ final api_instance = UserApi(); final user = User(); // User | Created user object try { - final result = api_instance.createUser(user); - print(result); + api_instance.createUser(user); } catch (e) { print('Exception when calling UserApi->createUser: $e\n'); } @@ -53,7 +52,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -67,7 +66,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) # **createUsersWithArrayInput** -> Map createUsersWithArrayInput(user) +> createUsersWithArrayInput(user) Creates list of users with given input array @@ -83,8 +82,7 @@ final api_instance = UserApi(); final user = [List()]; // List | List of user object try { - final result = api_instance.createUsersWithArrayInput(user); - print(result); + api_instance.createUsersWithArrayInput(user); } catch (e) { print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); } @@ -98,7 +96,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -112,7 +110,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) # **createUsersWithListInput** -> Map createUsersWithListInput(user) +> createUsersWithListInput(user) Creates list of users with given input array @@ -128,8 +126,7 @@ final api_instance = UserApi(); final user = [List()]; // List | List of user object try { - final result = api_instance.createUsersWithListInput(user); - print(result); + api_instance.createUsersWithListInput(user); } catch (e) { print('Exception when calling UserApi->createUsersWithListInput: $e\n'); } @@ -143,7 +140,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -157,7 +154,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) # **deleteUser** -> Map deleteUser(username) +> deleteUser(username) Delete user @@ -175,8 +172,7 @@ final api_instance = UserApi(); final username = username_example; // String | The name that needs to be deleted try { - final result = api_instance.deleteUser(username); - print(result); + api_instance.deleteUser(username); } catch (e) { print('Exception when calling UserApi->deleteUser: $e\n'); } @@ -190,7 +186,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -288,7 +284,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** -> Map logoutUser() +> logoutUser() Logs out current logged in user session @@ -303,8 +299,7 @@ import 'package:openapi/api.dart'; final api_instance = UserApi(); try { - final result = api_instance.logoutUser(); - print(result); + api_instance.logoutUser(); } catch (e) { print('Exception when calling UserApi->logoutUser: $e\n'); } @@ -315,7 +310,7 @@ This endpoint does not need any parameter. ### Return type -**Map** +void (empty response body) ### Authorization @@ -329,7 +324,7 @@ This endpoint does not need any parameter. [[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** -> Map updateUser(username, user) +> updateUser(username, user) Updated user @@ -348,8 +343,7 @@ final username = username_example; // String | name that need to be deleted final user = User(); // User | Updated user object try { - final result = api_instance.updateUser(username, user); - print(result); + api_instance.updateUser(username, user); } catch (e) { print('Exception when calling UserApi->updateUser: $e\n'); } @@ -364,7 +358,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization 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 5cfd3e13f006..609b81ddcd92 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 @@ -122,19 +122,11 @@ 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; - - } - return Future>.value(); } /// Finds Pets by status @@ -444,19 +436,11 @@ 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; - - } - return Future>.value(); } /// uploads an image 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 95378ea5db24..a119a01ae5ef 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 @@ -62,19 +62,11 @@ 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; - - } - return Future>.value(); } /// Returns pet inventories by status 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 ebd7476a1ac4..b1f6a8208860 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 @@ -61,19 +61,11 @@ 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; - - } - return Future>.value(); } /// Creates list of users with given input array @@ -117,19 +109,11 @@ 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; - - } - return Future>.value(); } /// Creates list of users with given input array @@ -173,19 +157,11 @@ 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; - - } - return Future>.value(); } /// Delete user @@ -234,19 +210,11 @@ 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; - - } - return Future>.value(); } /// Get user by user name @@ -402,19 +370,11 @@ 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; - - } - return Future>.value(); } /// Updated user @@ -469,18 +429,10 @@ 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; - - } - return Future>.value(); } } 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 b22ee07386ec..869c513b1f26 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** -> Map fakeHttpSignatureTest(pet, query1, header1) +> fakeHttpSignatureTest(pet, query1, header1) test http signature authentication @@ -80,8 +80,7 @@ final query1 = query1_example; // String | query parameter final header1 = header1_example; // String | header parameter try { - final result = api_instance.fakeHttpSignatureTest(pet, query1, header1); - print(result); + api_instance.fakeHttpSignatureTest(pet, query1, header1); } catch (e) { print('Exception when calling FakeApi->fakeHttpSignatureTest: $e\n'); } @@ -97,7 +96,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -326,7 +325,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** -> Map testBodyWithBinary(body) +> testBodyWithBinary(body) @@ -340,8 +339,7 @@ final api_instance = FakeApi(); final body = MultipartFile(); // MultipartFile | image to upload try { - final result = api_instance.testBodyWithBinary(body); - print(result); + api_instance.testBodyWithBinary(body); } catch (e) { print('Exception when calling FakeApi->testBodyWithBinary: $e\n'); } @@ -355,7 +353,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -369,7 +367,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** -> Map testBodyWithFileSchema(fileSchemaTestClass) +> testBodyWithFileSchema(fileSchemaTestClass) @@ -383,8 +381,7 @@ final api_instance = FakeApi(); final fileSchemaTestClass = FileSchemaTestClass(); // FileSchemaTestClass | try { - final result = api_instance.testBodyWithFileSchema(fileSchemaTestClass); - print(result); + api_instance.testBodyWithFileSchema(fileSchemaTestClass); } catch (e) { print('Exception when calling FakeApi->testBodyWithFileSchema: $e\n'); } @@ -398,7 +395,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -412,7 +409,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** -> Map testBodyWithQueryParams(query, user) +> testBodyWithQueryParams(query, user) @@ -425,8 +422,7 @@ final query = query_example; // String | final user = User(); // User | try { - final result = api_instance.testBodyWithQueryParams(query, user); - print(result); + api_instance.testBodyWithQueryParams(query, user); } catch (e) { print('Exception when calling FakeApi->testBodyWithQueryParams: $e\n'); } @@ -441,7 +437,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -498,7 +494,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** -> Map testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) +> testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -528,8 +524,7 @@ final password = password_example; // String | None final callback = callback_example; // String | None try { - final result = api_instance.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); - print(result); + api_instance.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); } catch (e) { print('Exception when calling FakeApi->testEndpointParameters: $e\n'); } @@ -556,7 +551,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -570,7 +565,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) # **testEnumParameters** -> Map testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) +> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) To test enum parameters @@ -591,8 +586,7 @@ final enumFormStringArray = []; // List | Form parameter enum test (stri final enumFormString = enumFormString_example; // String | Form parameter enum test (string) try { - final result = api_instance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); - print(result); + api_instance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); } catch (e) { print('Exception when calling FakeApi->testEnumParameters: $e\n'); } @@ -613,7 +607,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -627,7 +621,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** -> Map testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) +> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) Fake endpoint to test group parameters (optional) @@ -652,8 +646,7 @@ final booleanGroup = true; // bool | Boolean in group parameters final int64Group = 789; // int | Integer in group parameters try { - final result = api_instance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); - print(result); + api_instance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); } catch (e) { print('Exception when calling FakeApi->testGroupParameters: $e\n'); } @@ -672,7 +665,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -686,7 +679,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) # **testInlineAdditionalProperties** -> Map testInlineAdditionalProperties(requestBody) +> testInlineAdditionalProperties(requestBody) test inline additionalProperties @@ -698,8 +691,7 @@ final api_instance = FakeApi(); final requestBody = Map(); // Map | request body try { - final result = api_instance.testInlineAdditionalProperties(requestBody); - print(result); + api_instance.testInlineAdditionalProperties(requestBody); } catch (e) { print('Exception when calling FakeApi->testInlineAdditionalProperties: $e\n'); } @@ -713,7 +705,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -727,7 +719,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** -> Map testJsonFormData(param, param2) +> testJsonFormData(param, param2) test json serialization of form data @@ -740,8 +732,7 @@ final param = param_example; // String | field1 final param2 = param2_example; // String | field2 try { - final result = api_instance.testJsonFormData(param, param2); - print(result); + api_instance.testJsonFormData(param, param2); } catch (e) { print('Exception when calling FakeApi->testJsonFormData: $e\n'); } @@ -756,7 +747,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -770,7 +761,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** -> Map testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) +> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) @@ -790,8 +781,7 @@ final allowEmpty = allowEmpty_example; // String | final language = ; // Map | try { - final result = api_instance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); - print(result); + api_instance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); } catch (e) { print('Exception when calling FakeApi->testQueryParameterCollectionFormat: $e\n'); } @@ -811,7 +801,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### 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 a3fff4ca709c..9b2e46df0a09 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>** | | [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 {}] +**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 {}] [[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 f6452b7bfc9a..387717e3f917 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** -> Map addPet(pet) +> addPet(pet) Add a new pet to the store @@ -35,8 +35,7 @@ final api_instance = PetApi(); final pet = Pet(); // Pet | Pet object that needs to be added to the store try { - final result = api_instance.addPet(pet); - print(result); + api_instance.addPet(pet); } catch (e) { print('Exception when calling PetApi->addPet: $e\n'); } @@ -50,7 +49,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -64,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** -> Map deletePet(petId, apiKey) +> deletePet(petId, apiKey) Deletes a pet @@ -79,8 +78,7 @@ final petId = 789; // int | Pet id to delete final apiKey = apiKey_example; // String | try { - final result = api_instance.deletePet(petId, apiKey); - print(result); + api_instance.deletePet(petId, apiKey); } catch (e) { print('Exception when calling PetApi->deletePet: $e\n'); } @@ -95,7 +93,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -246,7 +244,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** -> Map updatePet(pet) +> updatePet(pet) Update an existing pet @@ -260,8 +258,7 @@ final api_instance = PetApi(); final pet = Pet(); // Pet | Pet object that needs to be added to the store try { - final result = api_instance.updatePet(pet); - print(result); + api_instance.updatePet(pet); } catch (e) { print('Exception when calling PetApi->updatePet: $e\n'); } @@ -275,7 +272,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -289,7 +286,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** -> Map updatePetWithForm(petId, name, status) +> updatePetWithForm(petId, name, status) Updates a pet in the store with form data @@ -305,8 +302,7 @@ final name = name_example; // String | Updated name of the pet final status = status_example; // String | Updated status of the pet try { - final result = api_instance.updatePetWithForm(petId, name, status); - print(result); + api_instance.updatePetWithForm(petId, name, status); } catch (e) { print('Exception when calling PetApi->updatePetWithForm: $e\n'); } @@ -322,7 +318,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### 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 b573d982109a..f43230375e7b 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** -> Map deleteOrder(orderId) +> deleteOrder(orderId) Delete purchase order by ID @@ -30,8 +30,7 @@ final api_instance = StoreApi(); final orderId = orderId_example; // String | ID of the order that needs to be deleted try { - final result = api_instance.deleteOrder(orderId); - print(result); + api_instance.deleteOrder(orderId); } catch (e) { print('Exception when calling StoreApi->deleteOrder: $e\n'); } @@ -45,7 +44,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### 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 909b184c1a0c..f318f92ccefd 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** -> Map createUser(user) +> createUser(user) Create user @@ -34,8 +34,7 @@ final api_instance = UserApi(); final user = User(); // User | Created user object try { - final result = api_instance.createUser(user); - print(result); + api_instance.createUser(user); } catch (e) { print('Exception when calling UserApi->createUser: $e\n'); } @@ -49,7 +48,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -63,7 +62,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** -> Map createUsersWithArrayInput(user) +> createUsersWithArrayInput(user) Creates list of users with given input array @@ -75,8 +74,7 @@ final api_instance = UserApi(); final user = [List()]; // List | List of user object try { - final result = api_instance.createUsersWithArrayInput(user); - print(result); + api_instance.createUsersWithArrayInput(user); } catch (e) { print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); } @@ -90,7 +88,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -104,7 +102,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** -> Map createUsersWithListInput(user) +> createUsersWithListInput(user) Creates list of users with given input array @@ -116,8 +114,7 @@ final api_instance = UserApi(); final user = [List()]; // List | List of user object try { - final result = api_instance.createUsersWithListInput(user); - print(result); + api_instance.createUsersWithListInput(user); } catch (e) { print('Exception when calling UserApi->createUsersWithListInput: $e\n'); } @@ -131,7 +128,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -145,7 +142,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** -> Map deleteUser(username) +> deleteUser(username) Delete user @@ -159,8 +156,7 @@ final api_instance = UserApi(); final username = username_example; // String | The name that needs to be deleted try { - final result = api_instance.deleteUser(username); - print(result); + api_instance.deleteUser(username); } catch (e) { print('Exception when calling UserApi->deleteUser: $e\n'); } @@ -174,7 +170,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization @@ -272,7 +268,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** -> Map logoutUser() +> logoutUser() Logs out current logged in user session @@ -283,8 +279,7 @@ import 'package:openapi/api.dart'; final api_instance = UserApi(); try { - final result = api_instance.logoutUser(); - print(result); + api_instance.logoutUser(); } catch (e) { print('Exception when calling UserApi->logoutUser: $e\n'); } @@ -295,7 +290,7 @@ This endpoint does not need any parameter. ### Return type -**Map** +void (empty response body) ### Authorization @@ -309,7 +304,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** -> Map updateUser(username, user) +> updateUser(username, user) Updated user @@ -324,8 +319,7 @@ final username = username_example; // String | name that need to be deleted final user = User(); // User | Updated user object try { - final result = api_instance.updateUser(username, user); - print(result); + api_instance.updateUser(username, user); } catch (e) { print('Exception when calling UserApi->updateUser: $e\n'); } @@ -340,7 +334,7 @@ Name | Type | Description | Notes ### Return type -**Map** +void (empty response body) ### Authorization 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 ec407b3474b4..3e82765387ce 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 @@ -123,19 +123,11 @@ 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; - - } - return Future>.value(); } /// Test serialization of outer boolean types @@ -459,19 +451,11 @@ 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; - - } - return Future>.value(); } /// For this test, the body for this request must reference a schema named `File`. @@ -513,19 +497,11 @@ 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; - - } - return Future>.value(); } /// Performs an HTTP 'PUT /fake/body-with-query-params' operation and returns the [Response]. @@ -568,19 +544,11 @@ 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; - - } - return Future>.value(); } /// To test \"client\" model @@ -805,19 +773,11 @@ 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; - - } - return Future>.value(); } /// To test enum parameters @@ -933,19 +893,11 @@ 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; - - } - return Future>.value(); } /// Fake endpoint to test group parameters (optional) @@ -1037,19 +989,11 @@ 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; - - } - return Future>.value(); } /// test inline additionalProperties @@ -1093,19 +1037,11 @@ 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; - - } - return Future>.value(); } /// test json serialization of form data @@ -1161,19 +1097,11 @@ 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; - - } - return Future>.value(); } /// To test the collection format in query parameters @@ -1249,18 +1177,10 @@ 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; - - } - 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 ab545fceb711..89ec16507fb7 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 @@ -57,19 +57,11 @@ 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; - - } - return Future>.value(); } /// Deletes a pet @@ -122,19 +114,11 @@ 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; - - } - return Future>.value(); } /// Finds Pets by status @@ -369,19 +353,11 @@ 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; - - } - return Future>.value(); } /// Updates a pet in the store with form data @@ -444,19 +420,11 @@ 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; - - } - return Future>.value(); } /// uploads an image 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 a77a9cb2a87e..e6bee9add534 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 @@ -62,19 +62,11 @@ 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; - - } - return Future>.value(); } /// Returns pet inventories by status 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 c0434ee0c991..5e4c63631100 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 @@ -61,19 +61,11 @@ 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; - - } - return Future>.value(); } /// Creates list of users with given input array @@ -117,19 +109,11 @@ 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; - - } - return Future>.value(); } /// Creates list of users with given input array @@ -173,19 +157,11 @@ 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; - - } - return Future>.value(); } /// Delete user @@ -234,19 +210,11 @@ 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; - - } - return Future>.value(); } /// Get user by user name @@ -402,19 +370,11 @@ 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; - - } - return Future>.value(); } /// Updated user @@ -469,18 +429,10 @@ 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; - - } - return Future>.value(); } } 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 8e2cf3ca4a15..d5583315294a 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 @@ -335,8 +335,8 @@ class EnumTestEnumNumberEnum { 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 = [ @@ -366,10 +366,10 @@ class EnumTestEnumNumberEnumTypeTransformer { /// /// If the [dynamic value][data] cannot be decoded successfully, then an [UnimplementedError] is thrown. EnumTestEnumNumberEnum decode(dynamic data) { - if (data == 1.1) { + if (data == '1.1') { return EnumTestEnumNumberEnum.number1Period1; } - if (data == -1.2) { + if (data == '-1.2') { return EnumTestEnumNumberEnum.numberNegative1Period2; } throw ArgumentError('Unknown enum value to decode: $data'); 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 38d389ff96ef..a18a1debf5e8 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 @@ -40,17 +40,17 @@ class NullableClass { DateTime? datetimeProp; - List>? arrayNullableProp; + List? arrayNullableProp; - List>? arrayAndItemsNullableProp; + List? arrayAndItemsNullableProp; - List>? arrayItemsNullable; + List? arrayItemsNullable; - Map? objectNullableProp; + Map? objectNullableProp; - Map? objectAndItemsNullableProp; + Map? objectAndItemsNullableProp; - Map? objectItemsNullable; + Map? objectItemsNullable; @override bool operator ==(Object other) => identical(this, other) || other is NullableClass && @@ -136,12 +136,12 @@ class NullableClass { stringProp: json[r'string_prop'] as String, dateProp: mapDateTime(json, r'date_prop', ''), datetimeProp: mapDateTime(json, r'datetime_prop', ''), - 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, + 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: 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,}) => From 28a9ac29abe77b2e9ad639d7429600a863619ded Mon Sep 17 00:00:00 2001 From: agilob Date: Tue, 19 Oct 2021 17:50:36 +0100 Subject: [PATCH 13/39] Revert removing dart pom module --- .../dart2/petstore_client_lib/pom.xml | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/pom.xml diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/pom.xml b/samples/openapi3/client/petstore/dart2/petstore_client_lib/pom.xml new file mode 100644 index 000000000000..2ff67a1fcef8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/pom.xml @@ -0,0 +1,73 @@ + + 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 + + + + + + + + From 746085ce0961766200d6b8007ba7c52369a09759 Mon Sep 17 00:00:00 2001 From: agilob Date: Tue, 19 Oct 2021 17:53:03 +0100 Subject: [PATCH 14/39] Revert removing dart pom module --- .../client/petstore/dart2/petstore/pom.xml | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 samples/openapi3/client/petstore/dart2/petstore/pom.xml diff --git a/samples/openapi3/client/petstore/dart2/petstore/pom.xml b/samples/openapi3/client/petstore/dart2/petstore/pom.xml new file mode 100644 index 000000000000..c4ce7b4d68e7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore/pom.xml @@ -0,0 +1,73 @@ + + 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 + + + + + + + + From c97483b4ec228a9d5b7ebaadcaa9ef0280bf31ab Mon Sep 17 00:00:00 2001 From: agilob Date: Tue, 19 Oct 2021 18:01:56 +0100 Subject: [PATCH 15/39] Lower minimum dart version to 2.12 --- .../openapi-generator/src/main/resources/dart2/pubspec.mustache | 2 +- .../client/petstore/dart2/petstore_client_lib/pubspec.yaml | 2 +- .../client/petstore/dart2/petstore_client_lib_fake/pubspec.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/dart2/pubspec.mustache b/modules/openapi-generator/src/main/resources/dart2/pubspec.mustache index 133bd7fb792e..186986237424 100644 --- a/modules/openapi-generator/src/main/resources/dart2/pubspec.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/pubspec.mustache @@ -7,7 +7,7 @@ version: '{{{pubVersion}}}' description: '{{{pubDescription}}}' homepage: '{{{pubHomepage}}}' environment: - sdk: '>=2.14.0 <3.0.0' + sdk: '>=2.12.0 <3.0.0' dependencies: http: '>=0.13.0 <0.14.0' intl: '^0.17.0' 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 ee196b267a79..00043ba660cd 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/pubspec.yaml +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/pubspec.yaml @@ -7,7 +7,7 @@ version: '1.0.0' description: 'OpenAPI API client' homepage: 'homepage' environment: - sdk: '>=2.14.0 <3.0.0' + sdk: '>=2.12.0 <3.0.0' dependencies: http: '>=0.13.0 <0.14.0' intl: '^0.17.0' 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 ee196b267a79..00043ba660cd 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,7 +7,7 @@ version: '1.0.0' description: 'OpenAPI API client' homepage: 'homepage' environment: - sdk: '>=2.14.0 <3.0.0' + sdk: '>=2.12.0 <3.0.0' dependencies: http: '>=0.13.0 <0.14.0' intl: '^0.17.0' From b0d96efd2d3b599a6680942bd46fc53471156af3 Mon Sep 17 00:00:00 2001 From: agilob Date: Wed, 27 Oct 2021 13:30:06 +0100 Subject: [PATCH 16/39] Disable dart2 tests generation --- .../codegen/languages/DartClientCodegen.java | 5 + .../main/resources/dart2/api_test.mustache | 1 + .../main/resources/dart2/model_test.mustache | 1 + .../test/api_response_test.dart | 37 ----- .../test/category_test.dart | 32 ---- .../petstore_client_lib/test/order_test.dart | 53 ------- .../test/pet_api_test.dart | 83 ---------- .../petstore_client_lib/test/pet_test.dart | 53 ------- .../test/store_api_test.dart | 55 ------- .../petstore_client_lib/test/tag_test.dart | 32 ---- .../test/user_api_test.dart | 83 ---------- .../petstore_client_lib/test/user_test.dart | 63 -------- .../additional_properties_class_test.dart | 32 ---- .../test/animal_test.dart | 32 ---- .../test/another_fake_api_test.dart | 30 ---- .../test/api_response_test.dart | 37 ----- .../array_of_array_of_number_only_test.dart | 27 ---- .../test/array_of_number_only_test.dart | 27 ---- .../test/array_test_test.dart | 37 ----- .../test/capitalization_test.dart | 53 ------- .../test/cat_all_of_test.dart | 27 ---- .../test/cat_test.dart | 37 ----- .../test/category_test.dart | 32 ---- .../test/class_model_test.dart | 27 ---- .../test/default_api_test.dart | 26 ---- .../test/deprecated_object_test.dart | 27 ---- .../test/dog_all_of_test.dart | 27 ---- .../test/dog_test.dart | 37 ----- .../test/enum_arrays_test.dart | 32 ---- .../test/enum_class_test.dart | 21 --- .../test/enum_test_test.dart | 62 -------- .../test/fake_api_test.dart | 146 ------------------ .../test/fake_classname_tags123_api_test.dart | 30 ---- .../test/file_schema_test_class_test.dart | 32 ---- .../test/foo_test.dart | 27 ---- .../test/format_test_test.dart | 104 ------------- .../test/has_only_read_only_test.dart | 32 ---- .../test/health_check_result_test.dart | 27 ---- .../test/inline_response_default_test.dart | 27 ---- .../test/map_test_test.dart | 42 ----- ..._and_additional_properties_class_test.dart | 37 ----- .../test/model200_response_test.dart | 32 ---- .../test/model_client_test.dart | 27 ---- .../test/model_file_test.dart | 28 ---- .../test/model_list_test.dart | 27 ---- .../test/model_return_test.dart | 27 ---- .../test/name_test.dart | 42 ----- .../test/nullable_class_test.dart | 82 ---------- .../test/number_only_test.dart | 27 ---- .../object_with_deprecated_fields_test.dart | 42 ----- .../test/order_test.dart | 53 ------- .../test/outer_composite_test.dart | 37 ----- .../test/outer_enum_default_value_test.dart | 21 --- ...outer_enum_integer_default_value_test.dart | 21 --- .../test/outer_enum_integer_test.dart | 21 --- .../test/outer_enum_test.dart | 21 --- .../outer_object_with_enum_property_test.dart | 27 ---- .../test/pet_api_test.dart | 90 ----------- .../test/pet_test.dart | 53 ------- .../test/read_only_first_test.dart | 32 ---- .../test/special_model_name_test.dart | 27 ---- .../test/store_api_test.dart | 55 ------- .../test/tag_test.dart | 32 ---- .../test/user_api_test.dart | 83 ---------- .../test/user_test.dart | 63 -------- 65 files changed, 7 insertions(+), 2595 deletions(-) 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/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 diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java index 25853e0b2541..a8fb9eb1b697 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java @@ -36,6 +36,11 @@ public class DartClientCodegen extends AbstractDartCodegen { public DartClientCodegen() { super(); + + // temporary disable dart tests as they're not NNBD compatible + modelTestTemplateFiles.remove("model_test.mustache"); + apiTestTemplateFiles.remove("api_test.mustache"); + final CliOption serializationLibrary = CliOption.newString(CodegenConstants.SERIALIZATION_LIBRARY, "Specify serialization library"); serializationLibrary.setDefault(SERIALIZATION_LIBRARY_NATIVE); diff --git a/modules/openapi-generator/src/main/resources/dart2/api_test.mustache b/modules/openapi-generator/src/main/resources/dart2/api_test.mustache index 319945b2c3b5..e66c708d885b 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_test.mustache @@ -4,6 +4,7 @@ import 'package:test/test.dart'; {{#operations}} +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 /// tests for {{{classname}}} void main() { final instance = {{{classname}}}(); diff --git a/modules/openapi-generator/src/main/resources/dart2/model_test.mustache b/modules/openapi-generator/src/main/resources/dart2/model_test.mustache index 5d4f1c161c52..3c8adc2afc36 100644 --- a/modules/openapi-generator/src/main/resources/dart2/model_test.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/model_test.mustache @@ -4,6 +4,7 @@ import 'package:{{{pubName}}}/api.dart'; import 'package:test/test.dart'; +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 // tests for {{{classname}}} void main() { {{^isEnum}} 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 f430af15d42f..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/api_response_test.dart +++ /dev/null @@ -1,37 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 5444937d5429..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/category_test.dart +++ /dev/null @@ -1,32 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 daaa4a238417..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/order_test.dart +++ /dev/null @@ -1,53 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 b49f5e99547e..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_api_test.dart +++ /dev/null @@ -1,83 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 3a30b8afed22..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_test.dart +++ /dev/null @@ -1,53 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 ed229fde3e49..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/store_api_test.dart +++ /dev/null @@ -1,55 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 3cac49435577..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/tag_test.dart +++ /dev/null @@ -1,32 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 4da72ffbda2e..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_api_test.dart +++ /dev/null @@ -1,83 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 7e6eb1ba9d3a..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_test.dart +++ /dev/null @@ -1,63 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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/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 0afc687f94d7..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/additional_properties_class_test.dart +++ /dev/null @@ -1,32 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 b41d7362f8ea..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/animal_test.dart +++ /dev/null @@ -1,32 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 a00ad691a81c..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/another_fake_api_test.dart +++ /dev/null @@ -1,30 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 f430af15d42f..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/api_response_test.dart +++ /dev/null @@ -1,37 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 c2648dde7a02..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_array_of_number_only_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 27e7f2295fb2..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_number_only_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 75520cf53dd3..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_test_test.dart +++ /dev/null @@ -1,37 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 834412a48922..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/capitalization_test.dart +++ /dev/null @@ -1,53 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 e427d6d110d8..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_all_of_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 3b11870cd2fe..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_test.dart +++ /dev/null @@ -1,37 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 21dd7202b112..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/category_test.dart +++ /dev/null @@ -1,32 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 5372bad38c57..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/class_model_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 176860d62237..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/default_api_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 17b55967b044..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/deprecated_object_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 4f6aa6a11081..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_all_of_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 5816888169ce..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_test.dart +++ /dev/null @@ -1,37 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 db1f5fcf1e41..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_arrays_test.dart +++ /dev/null @@ -1,32 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 048f4f4223c9..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_class_test.dart +++ /dev/null @@ -1,21 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 519f578023ff..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_test_test.dart +++ /dev/null @@ -1,62 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 ba7aedca186a..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_api_test.dart +++ /dev/null @@ -1,146 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 has to be a binary file. - // - //Future> testBodyWithBinary(MultipartFile body) async - test('test testBodyWithBinary', () async { - // TODO - }); - - // For this test, the body for this request must 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, String allowEmpty, { Map language }) 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 6d8586e981c2..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_classname_tags123_api_test.dart +++ /dev/null @@ -1,30 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 de19f413d9cd..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/file_schema_test_class_test.dart +++ /dev/null @@ -1,32 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 41358813749d..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/foo_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 5ac1b8d9c20f..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/format_test_test.dart +++ /dev/null @@ -1,104 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 9d9750b53f60..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/has_only_read_only_test.dart +++ /dev/null @@ -1,32 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 475a03293389..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/health_check_result_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 ebaa2938c9d6..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_response_default_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 5d0b72a56aa2..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/map_test_test.dart +++ /dev/null @@ -1,42 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 580337da3570..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart +++ /dev/null @@ -1,37 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 926416dcce3b..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model200_response_test.dart +++ /dev/null @@ -1,32 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 5fa410574c73..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_client_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 b1ea27738c30..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_file_test.dart +++ /dev/null @@ -1,28 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 f99d009f8d42..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_list_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 49c9097abc35..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_return_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 5b7e111f045d..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/name_test.dart +++ /dev/null @@ -1,42 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 51262ef6d50d..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/nullable_class_test.dart +++ /dev/null @@ -1,82 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 f5d660cc0de8..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/number_only_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 4bfd78eb06b7..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/object_with_deprecated_fields_test.dart +++ /dev/null @@ -1,42 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 daaa4a238417..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/order_test.dart +++ /dev/null @@ -1,53 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 9bfe086e93a7..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_composite_test.dart +++ /dev/null @@ -1,37 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 4a7ba6be2338..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_default_value_test.dart +++ /dev/null @@ -1,21 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 a1b56f1bcf81..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_default_value_test.dart +++ /dev/null @@ -1,21 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 428b76464f1a..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_test.dart +++ /dev/null @@ -1,21 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 a0dfb5d3fe2a..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_test.dart +++ /dev/null @@ -1,21 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 9facb11ef5f3..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_object_with_enum_property_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 9cd13f6a31af..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_api_test.dart +++ /dev/null @@ -1,90 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 9e4ced6f823e..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_test.dart +++ /dev/null @@ -1,53 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 213e1032b7e3..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/read_only_first_test.dart +++ /dev/null @@ -1,32 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 995a92ce3cc7..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/special_model_name_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 ed229fde3e49..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/store_api_test.dart +++ /dev/null @@ -1,55 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 3cac49435577..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/tag_test.dart +++ /dev/null @@ -1,32 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 4da72ffbda2e..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_api_test.dart +++ /dev/null @@ -1,83 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 7e6eb1ba9d3a..000000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_test.dart +++ /dev/null @@ -1,63 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.14 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// 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 - }); - - - }); - -} From 9fccea2feb9717b492f219ad81d8654dbb485ec9 Mon Sep 17 00:00:00 2001 From: agilob Date: Wed, 27 Oct 2021 13:54:28 +0100 Subject: [PATCH 17/39] Disable petstore_client_lib --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 35974a9fdf09..4869fe9301e5 100644 --- a/pom.xml +++ b/pom.xml @@ -1399,7 +1399,7 @@ - samples/openapi3/client/petstore/dart2/petstore_client_lib + samples/openapi3/client/petstore/dart2/petstore samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake From c2f341cbcfa68ad76ecf61a5bdb98eb74d924f25 Mon Sep 17 00:00:00 2001 From: agilob Date: Wed, 27 Oct 2021 14:02:59 +0100 Subject: [PATCH 18/39] Disable samples/openapi3/client/petstore/dart2/petstore --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4869fe9301e5..1a26a8688fb9 100644 --- a/pom.xml +++ b/pom.xml @@ -1400,7 +1400,7 @@ - samples/openapi3/client/petstore/dart2/petstore + samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake From 981157cd861797610bd39f6288e8445f85306e59 Mon Sep 17 00:00:00 2001 From: agilob Date: Wed, 27 Oct 2021 14:18:33 +0100 Subject: [PATCH 19/39] Re-add dart2 tests --- .../org/openapitools/codegen/languages/DartClientCodegen.java | 4 ---- .../src/main/resources/dart2/api_test.mustache | 3 +-- .../src/main/resources/dart2/model_test.mustache | 3 +-- pom.xml | 4 ++-- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java index a8fb9eb1b697..5693d19265c9 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java @@ -37,10 +37,6 @@ public class DartClientCodegen extends AbstractDartCodegen { public DartClientCodegen() { super(); - // temporary disable dart tests as they're not NNBD compatible - modelTestTemplateFiles.remove("model_test.mustache"); - apiTestTemplateFiles.remove("api_test.mustache"); - final CliOption serializationLibrary = CliOption.newString(CodegenConstants.SERIALIZATION_LIBRARY, "Specify serialization library"); serializationLibrary.setDefault(SERIALIZATION_LIBRARY_NATIVE); diff --git a/modules/openapi-generator/src/main/resources/dart2/api_test.mustache b/modules/openapi-generator/src/main/resources/dart2/api_test.mustache index e66c708d885b..6873ba0f9d4d 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_test.mustache @@ -4,10 +4,9 @@ import 'package:test/test.dart'; {{#operations}} -// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 /// tests for {{{classname}}} void main() { - final instance = {{{classname}}}(); + // final instance = {{{classname}}}(); group('tests for {{{classname}}}', () { {{#operation}} diff --git a/modules/openapi-generator/src/main/resources/dart2/model_test.mustache b/modules/openapi-generator/src/main/resources/dart2/model_test.mustache index 3c8adc2afc36..1a074d47b71d 100644 --- a/modules/openapi-generator/src/main/resources/dart2/model_test.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/model_test.mustache @@ -4,11 +4,10 @@ import 'package:{{{pubName}}}/api.dart'; import 'package:test/test.dart'; -// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 // tests for {{{classname}}} void main() { {{^isEnum}} - final instance = {{{classname}}}(); + // final instance = {{{classname}}}(); {{/isEnum}} group('test {{{classname}}}', () { diff --git a/pom.xml b/pom.xml index 1a26a8688fb9..35974a9fdf09 100644 --- a/pom.xml +++ b/pom.xml @@ -1399,8 +1399,8 @@ - - + samples/openapi3/client/petstore/dart2/petstore_client_lib + samples/openapi3/client/petstore/dart2/petstore samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake From 251faea95bc0ef97b63d601808e9a5848f346b73 Mon Sep 17 00:00:00 2001 From: agilob Date: Wed, 27 Oct 2021 14:28:35 +0100 Subject: [PATCH 20/39] Add new tests --- .../test/api_response_test.dart | 38 +++++ .../test/category_test.dart | 33 ++++ .../petstore_client_lib/test/order_test.dart | 54 +++++++ .../test/pet_api_test.dart | 84 ++++++++++ .../petstore_client_lib/test/pet_test.dart | 54 +++++++ .../test/store_api_test.dart | 56 +++++++ .../petstore_client_lib/test/tag_test.dart | 33 ++++ .../test/user_api_test.dart | 84 ++++++++++ .../petstore_client_lib/test/user_test.dart | 64 ++++++++ .../additional_properties_class_test.dart | 33 ++++ .../test/animal_test.dart | 33 ++++ .../test/another_fake_api_test.dart | 31 ++++ .../test/api_response_test.dart | 38 +++++ .../array_of_array_of_number_only_test.dart | 28 ++++ .../test/array_of_number_only_test.dart | 28 ++++ .../test/array_test_test.dart | 38 +++++ .../test/capitalization_test.dart | 54 +++++++ .../test/cat_all_of_test.dart | 28 ++++ .../test/cat_test.dart | 38 +++++ .../test/category_test.dart | 33 ++++ .../test/class_model_test.dart | 28 ++++ .../test/default_api_test.dart | 27 ++++ .../test/deprecated_object_test.dart | 28 ++++ .../test/dog_all_of_test.dart | 28 ++++ .../test/dog_test.dart | 38 +++++ .../test/enum_arrays_test.dart | 33 ++++ .../test/enum_class_test.dart | 22 +++ .../test/enum_test_test.dart | 63 ++++++++ .../test/fake_api_test.dart | 147 ++++++++++++++++++ .../test/fake_classname_tags123_api_test.dart | 31 ++++ .../test/file_schema_test_class_test.dart | 33 ++++ .../test/foo_test.dart | 28 ++++ .../test/format_test_test.dart | 105 +++++++++++++ .../test/has_only_read_only_test.dart | 33 ++++ .../test/health_check_result_test.dart | 28 ++++ .../test/inline_response_default_test.dart | 28 ++++ .../test/map_test_test.dart | 43 +++++ ..._and_additional_properties_class_test.dart | 38 +++++ .../test/model200_response_test.dart | 33 ++++ .../test/model_client_test.dart | 28 ++++ .../test/model_file_test.dart | 29 ++++ .../test/model_list_test.dart | 28 ++++ .../test/model_return_test.dart | 28 ++++ .../test/name_test.dart | 43 +++++ .../test/nullable_class_test.dart | 83 ++++++++++ .../test/number_only_test.dart | 28 ++++ .../object_with_deprecated_fields_test.dart | 43 +++++ .../test/order_test.dart | 54 +++++++ .../test/outer_composite_test.dart | 38 +++++ .../test/outer_enum_default_value_test.dart | 22 +++ ...outer_enum_integer_default_value_test.dart | 22 +++ .../test/outer_enum_integer_test.dart | 22 +++ .../test/outer_enum_test.dart | 22 +++ .../outer_object_with_enum_property_test.dart | 28 ++++ .../test/pet_api_test.dart | 91 +++++++++++ .../test/pet_test.dart | 54 +++++++ .../test/read_only_first_test.dart | 33 ++++ .../test/special_model_name_test.dart | 28 ++++ .../test/store_api_test.dart | 56 +++++++ .../test/tag_test.dart | 33 ++++ .../test/user_api_test.dart | 84 ++++++++++ .../test/user_test.dart | 64 ++++++++ 62 files changed, 2657 insertions(+) create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/api_response_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/category_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/order_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/store_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/tag_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/additional_properties_class_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/animal_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/another_fake_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/api_response_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_array_of_number_only_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_number_only_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_test_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/capitalization_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_all_of_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/category_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/class_model_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/default_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/deprecated_object_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_all_of_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_arrays_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_class_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_test_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_classname_tags123_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/file_schema_test_class_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/foo_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/format_test_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/has_only_read_only_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/health_check_result_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_response_default_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/map_test_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model200_response_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_client_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_file_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_list_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_return_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/name_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/nullable_class_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/number_only_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/object_with_deprecated_fields_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/order_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_composite_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_default_value_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_default_value_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_object_with_enum_property_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/read_only_first_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/special_model_name_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/store_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/tag_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_test.dart 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 new file mode 100644 index 000000000000..e9743c1ddded --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/api_response_test.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..3e0e90fc90db --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/category_test.dart @@ -0,0 +1,33 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..b625abdaf9fc --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/order_test.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..bdb430ea1a80 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_api_test.dart @@ -0,0 +1,84 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +/// 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 new file mode 100644 index 000000000000..ddb8f6a569e3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_test.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..351ef2682801 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/store_api_test.dart @@ -0,0 +1,56 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +/// 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 new file mode 100644 index 000000000000..78d5880e6d4c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/tag_test.dart @@ -0,0 +1,33 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..4f82364bd172 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_api_test.dart @@ -0,0 +1,84 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +/// 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 new file mode 100644 index 000000000000..d86551e10b64 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_test.dart @@ -0,0 +1,64 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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/test/additional_properties_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/additional_properties_class_test.dart new file mode 100644 index 000000000000..ba464213ba93 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/additional_properties_class_test.dart @@ -0,0 +1,33 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..b4d1e331abee --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/animal_test.dart @@ -0,0 +1,33 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..34367effd5a9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/another_fake_api_test.dart @@ -0,0 +1,31 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +/// 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 new file mode 100644 index 000000000000..e9743c1ddded --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/api_response_test.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..16ba1e3e45c3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_array_of_number_only_test.dart @@ -0,0 +1,28 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..5a83508f431e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_number_only_test.dart @@ -0,0 +1,28 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..7ed043205d9d --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_test_test.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..ec2cf7e54803 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/capitalization_test.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..018a5e89ce17 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_all_of_test.dart @@ -0,0 +1,28 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..cb2a70551331 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_test.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..8e45f5de2e51 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/category_test.dart @@ -0,0 +1,33 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..0fa269691c11 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/class_model_test.dart @@ -0,0 +1,28 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..530a221d7766 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/default_api_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +/// 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 new file mode 100644 index 000000000000..cee2bb6a5be3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/deprecated_object_test.dart @@ -0,0 +1,28 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..85b1bbc460ad --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_all_of_test.dart @@ -0,0 +1,28 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..7704643bc25c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_test.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..07318b4510fe --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_arrays_test.dart @@ -0,0 +1,33 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..c93a03b32ffa --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_class_test.dart @@ -0,0 +1,22 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..a5330759e27a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_test_test.dart @@ -0,0 +1,63 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..0b0c6bcb8ac0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_api_test.dart @@ -0,0 +1,147 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +/// 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 has to be a binary file. + // + //Future testBodyWithBinary(MultipartFile body) async + test('test testBodyWithBinary', () async { + // TODO + }); + + // For this test, the body for this request must 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, String allowEmpty, { Map language }) 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 new file mode 100644 index 000000000000..2570d74f567c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_classname_tags123_api_test.dart @@ -0,0 +1,31 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +/// 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 new file mode 100644 index 000000000000..b69c027e926a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/file_schema_test_class_test.dart @@ -0,0 +1,33 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..82ac0359b8a6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/foo_test.dart @@ -0,0 +1,28 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..5f382b03b5bf --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/format_test_test.dart @@ -0,0 +1,105 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..b41796d19d62 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/has_only_read_only_test.dart @@ -0,0 +1,33 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..5f09d312d74d --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/health_check_result_test.dart @@ -0,0 +1,28 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..e344b8a6fd00 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_response_default_test.dart @@ -0,0 +1,28 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..f7da040f3265 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/map_test_test.dart @@ -0,0 +1,43 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..f23f59f58c72 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..46ccb12c5586 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model200_response_test.dart @@ -0,0 +1,33 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..e730318e0679 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_client_test.dart @@ -0,0 +1,28 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..663e0a76fb75 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_file_test.dart @@ -0,0 +1,29 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..1300f29e4947 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_list_test.dart @@ -0,0 +1,28 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..525c88715ac4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_return_test.dart @@ -0,0 +1,28 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..0d92245332bf --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/name_test.dart @@ -0,0 +1,43 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..269e281027ba --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/nullable_class_test.dart @@ -0,0 +1,83 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..04381ff2c543 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/number_only_test.dart @@ -0,0 +1,28 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..46275670a17a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/object_with_deprecated_fields_test.dart @@ -0,0 +1,43 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..b625abdaf9fc --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/order_test.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..33fe3a7ef1a6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_composite_test.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..fa0e93aaf7b0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_default_value_test.dart @@ -0,0 +1,22 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..6d88d2c3d159 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_default_value_test.dart @@ -0,0 +1,22 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..41715de4de58 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_test.dart @@ -0,0 +1,22 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..100df39ba80e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_test.dart @@ -0,0 +1,22 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..ffb9f4019c9a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_object_with_enum_property_test.dart @@ -0,0 +1,28 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..939365f0f382 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_api_test.dart @@ -0,0 +1,91 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +/// 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 new file mode 100644 index 000000000000..8db1ddea4ec6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_test.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..16d3a5662597 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/read_only_first_test.dart @@ -0,0 +1,33 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..4b00f426a86c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/special_model_name_test.dart @@ -0,0 +1,28 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..351ef2682801 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/store_api_test.dart @@ -0,0 +1,56 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +/// 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 new file mode 100644 index 000000000000..78d5880e6d4c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/tag_test.dart @@ -0,0 +1,33 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 new file mode 100644 index 000000000000..4f82364bd172 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_api_test.dart @@ -0,0 +1,84 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +/// 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 new file mode 100644 index 000000000000..d86551e10b64 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_test.dart @@ -0,0 +1,64 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 +// 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 + }); + + + }); + +} From 90a937a4fdc5aa19284eefa78f87dac85726b27f Mon Sep 17 00:00:00 2001 From: agilob Date: Wed, 27 Oct 2021 14:40:47 +0100 Subject: [PATCH 21/39] Delete empty directory --- pom.xml | 1 - .../client/petstore/dart2/petstore/pom.xml | 73 --- .../petstore/dart2/petstore/pubspec.lock | 418 ------------------ 3 files changed, 492 deletions(-) delete mode 100644 samples/openapi3/client/petstore/dart2/petstore/pom.xml delete mode 100644 samples/openapi3/client/petstore/dart2/petstore/pubspec.lock diff --git a/pom.xml b/pom.xml index 35974a9fdf09..eb249c2b1824 100644 --- a/pom.xml +++ b/pom.xml @@ -1400,7 +1400,6 @@ samples/openapi3/client/petstore/dart2/petstore_client_lib - samples/openapi3/client/petstore/dart2/petstore samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake 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 dd5bbc89254b..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.dartlang.org" - source: hosted - version: "14.0.0" - analyzer: - dependency: transitive - description: - name: analyzer - url: "https://pub.dartlang.org" - source: hosted - version: "0.41.2" - args: - dependency: transitive - description: - name: args - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.1" - async: - dependency: transitive - description: - name: async - url: "https://pub.dartlang.org" - source: hosted - version: "2.7.0" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" - build: - dependency: transitive - description: - name: build - url: "https://pub.dartlang.org" - source: hosted - version: "1.6.2" - built_collection: - dependency: transitive - description: - name: built_collection - url: "https://pub.dartlang.org" - source: hosted - version: "5.1.0" - built_value: - dependency: transitive - description: - name: built_value - url: "https://pub.dartlang.org" - source: hosted - version: "8.1.1" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" - cli_util: - dependency: transitive - description: - name: cli_util - url: "https://pub.dartlang.org" - source: hosted - version: "0.3.3" - clock: - dependency: transitive - description: - name: clock - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - code_builder: - dependency: transitive - description: - name: code_builder - url: "https://pub.dartlang.org" - source: hosted - version: "3.7.0" - collection: - dependency: "direct dev" - description: - name: collection - url: "https://pub.dartlang.org" - source: hosted - version: "1.15.0" - convert: - dependency: transitive - description: - name: convert - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.1" - coverage: - dependency: transitive - description: - name: coverage - url: "https://pub.dartlang.org" - source: hosted - version: "0.15.2" - crypto: - dependency: transitive - description: - name: crypto - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.1" - dart_style: - dependency: transitive - description: - name: dart_style - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.12" - file: - dependency: transitive - description: - name: file - url: "https://pub.dartlang.org" - source: hosted - version: "6.1.2" - fixnum: - dependency: transitive - description: - name: fixnum - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.0" - glob: - dependency: transitive - description: - name: glob - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.1" - http: - dependency: "direct dev" - description: - name: http - url: "https://pub.dartlang.org" - source: hosted - version: "0.13.3" - http_multi_server: - dependency: transitive - description: - name: http_multi_server - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.1" - http_parser: - dependency: transitive - description: - name: http_parser - url: "https://pub.dartlang.org" - source: hosted - version: "4.0.0" - intl: - dependency: transitive - description: - name: intl - url: "https://pub.dartlang.org" - source: hosted - version: "0.17.0" - io: - dependency: transitive - description: - name: io - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.3" - js: - dependency: transitive - description: - name: js - url: "https://pub.dartlang.org" - source: hosted - version: "0.6.3" - logging: - dependency: transitive - description: - name: logging - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.1" - matcher: - dependency: transitive - description: - name: matcher - url: "https://pub.dartlang.org" - source: hosted - version: "0.12.10" - meta: - dependency: "direct dev" - description: - name: meta - url: "https://pub.dartlang.org" - source: hosted - version: "1.6.0" - mime: - dependency: transitive - description: - name: mime - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.0" - mockito: - dependency: "direct dev" - description: - name: mockito - url: "https://pub.dartlang.org" - source: hosted - version: "4.1.4" - node_preamble: - dependency: transitive - description: - name: node_preamble - url: "https://pub.dartlang.org" - 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.dartlang.org" - source: hosted - version: "1.9.3" - path: - dependency: transitive - description: - name: path - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.11.1" - pool: - dependency: transitive - description: - name: pool - url: "https://pub.dartlang.org" - source: hosted - version: "1.5.0" - pub_semver: - dependency: transitive - description: - name: pub_semver - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" - shelf: - dependency: transitive - description: - name: shelf - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - shelf_packages_handler: - dependency: transitive - description: - name: shelf_packages_handler - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.0" - shelf_static: - dependency: transitive - description: - name: shelf_static - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - shelf_web_socket: - dependency: transitive - description: - name: shelf_web_socket - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.1" - source_gen: - dependency: transitive - description: - name: source_gen - url: "https://pub.dartlang.org" - source: hosted - version: "0.9.10+3" - source_map_stack_trace: - dependency: transitive - description: - name: source_map_stack_trace - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" - source_maps: - dependency: transitive - description: - name: source_maps - url: "https://pub.dartlang.org" - source: hosted - version: "0.10.10" - source_span: - dependency: transitive - description: - name: source_span - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.1" - stack_trace: - dependency: transitive - description: - name: stack_trace - url: "https://pub.dartlang.org" - source: hosted - version: "1.10.0" - stream_channel: - dependency: transitive - description: - name: stream_channel - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" - string_scanner: - dependency: transitive - description: - name: string_scanner - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - test: - dependency: "direct dev" - description: - name: test - url: "https://pub.dartlang.org" - source: hosted - version: "1.16.5" - test_api: - dependency: transitive - description: - name: test_api - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.19" - test_core: - dependency: transitive - description: - name: test_core - url: "https://pub.dartlang.org" - source: hosted - version: "0.3.15" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" - vm_service: - dependency: transitive - description: - name: vm_service - url: "https://pub.dartlang.org" - source: hosted - version: "6.2.0" - watcher: - dependency: transitive - description: - name: watcher - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.0" - web_socket_channel: - dependency: transitive - description: - name: web_socket_channel - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" - webkit_inspection_protocol: - dependency: transitive - description: - name: webkit_inspection_protocol - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.0" - yaml: - dependency: transitive - description: - name: yaml - url: "https://pub.dartlang.org" - source: hosted - version: "3.1.0" -sdks: - dart: ">=2.12.0 <3.0.0" From 77d25bbbfbf9795dd5d873151cdfbb3362aba431 Mon Sep 17 00:00:00 2001 From: devjakobsen <94956607+devjakobsen@users.noreply.github.com> Date: Wed, 24 Nov 2021 15:54:40 +0100 Subject: [PATCH 22/39] api_client.mustacheUpdate added optional HttpBearerAuth so you can add the token directly on the ApiClient --- .../src/main/resources/dart2/api_client.mustache | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 d9384ec91fec..60004b85838c 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache @@ -1,7 +1,7 @@ {{>header}} {{>part_of}} class ApiClient { - ApiClient({this.basePath = '{{{basePath}}}'}) { + ApiClient({this.basePath = '{{{basePath}}}', HttpBearerAuth? httpBearerAuth}) { {{#hasAuthMethods}} // Setup authentications (key: authentication name, value: authentication). {{#authMethods}} @@ -10,7 +10,7 @@ class ApiClient { _authentications[r'{{{name}}}'] = HttpBasicAuth('user', 'password'); {{/isBasicBasic}} {{#isBasicBearer}} - _authentications[r'{{{name}}}'] = HttpBearerAuth(); + _authentications[r'{{{name}}}'] = httpBearerAuth ?? HttpBearerAuth(); {{/isBasicBearer}} {{/isBasic}} {{#isApiKey}} From df67b74446eedb9568bd96fcd4af90038e765856 Mon Sep 17 00:00:00 2001 From: devjakobsen <94956607+devjakobsen@users.noreply.github.com> Date: Fri, 26 Nov 2021 09:17:19 +0100 Subject: [PATCH 23/39] Update api_client.dart auto generated files for build --- .../petstore/dart2/petstore_client_lib/lib/api_client.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e0fbda7abeba..ec3634535ba7 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 @@ -11,7 +11,7 @@ part of openapi.api; class ApiClient { - ApiClient({this.basePath = 'http://petstore.swagger.io/v2'}) { + ApiClient({this.basePath = 'http://petstore.swagger.io/v2', HttpBearerAuth? httpBearerAuth}) { // Setup authentications (key: authentication name, value: authentication). _authentications[r'api_key'] = ApiKeyAuth('header', 'api_key'); _authentications[r'petstore_auth'] = OAuth(); From c59fdb5401cd9b8bd5c9346ab60b6521b485807e Mon Sep 17 00:00:00 2001 From: devjakobsen <94956607+devjakobsen@users.noreply.github.com> Date: Fri, 26 Nov 2021 09:18:30 +0100 Subject: [PATCH 24/39] Update api_client.dart Autogenerated files for buiild --- .../dart2/petstore_client_lib_fake/lib/api_client.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 0a9c4a5cd634..8971cd0f7835 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 @@ -11,11 +11,11 @@ part of openapi.api; class ApiClient { - ApiClient({this.basePath = 'http://petstore.swagger.io:80/v2'}) { + ApiClient({this.basePath = 'http://petstore.swagger.io:80/v2', HttpBearerAuth? httpBearerAuth}) { // Setup authentications (key: authentication name, value: authentication). _authentications[r'api_key'] = ApiKeyAuth('header', 'api_key'); _authentications[r'api_key_query'] = ApiKeyAuth('query', 'api_key_query'); - _authentications[r'bearer_test'] = HttpBearerAuth(); + _authentications[r'bearer_test'] = httpBearerAuth ?? HttpBearerAuth(); _authentications[r'http_basic_test'] = HttpBasicAuth('user', 'password'); _authentications[r'petstore_auth'] = OAuth(); } From 9518ee721c6a8b1164c482e45f0d3b473292cf0a Mon Sep 17 00:00:00 2001 From: agilob Date: Thu, 9 Dec 2021 18:14:32 +0000 Subject: [PATCH 25/39] Make mapDateTime nullable and add ! after json mapping --- .../src/main/resources/dart2/api_helper.mustache | 4 ++-- .../dart2/serialization/native/native_class.mustache | 4 ++-- .../petstore/dart2/petstore_client_lib/lib/api_helper.dart | 4 ++-- .../petstore/dart2/petstore_client_lib/lib/model/order.dart | 2 +- .../dart2/petstore_client_lib_fake/lib/api_helper.dart | 4 ++-- .../dart2/petstore_client_lib_fake/lib/model/format_test.dart | 4 ++-- .../mixed_properties_and_additional_properties_class.dart | 2 +- .../dart2/petstore_client_lib_fake/lib/model/order.dart | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) 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 ad971eff624f..d39ce145df4b 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_helper.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_helper.mustache @@ -72,7 +72,7 @@ Future _decodeBodyBytes(Response response) async { } /// 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; @@ -89,5 +89,5 @@ DateTime mapDateTime(dynamic map, String key, [String? pattern]) { return DateTime.fromMillisecondsSinceEpoch(millis, isUtc: true); } } - return DateTime(1970); + return null; } 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 7bbf7c9d1681..fb5181b38355 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 @@ -75,10 +75,10 @@ class {{{classname}}} { static {{{classname}}} fromJson(Map json) => {{{classname}}}( {{#vars}} {{#isDateTime}} - {{{name}}}: mapDateTime(json, r'{{{baseName}}}', '{{{pattern}}}'), + {{{name}}}: mapDateTime(json, r'{{{baseName}}}', '{{{pattern}}}'){{^isNullable}}!{{/isNullable}}, {{/isDateTime}} {{#isDate}} - {{{name}}}: mapDateTime(json, r'{{{baseName}}}', '{{{pattern}}}'), + {{{name}}}: mapDateTime(json, r'{{{baseName}}}', '{{{pattern}}}'){{^isNullable}}!{{/isNullable}}, {{/isDate}} {{^isDateTime}} {{^isDate}} 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 32a5314b6292..4ffd040eb866 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 @@ -73,7 +73,7 @@ Future _decodeBodyBytes(Response response) async { } /// 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; @@ -90,5 +90,5 @@ DateTime mapDateTime(dynamic map, String key, [String? pattern]) { return DateTime.fromMillisecondsSinceEpoch(millis, isUtc: true); } } - return DateTime(1970); + return null; } 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 6879d1868e10..e50090588764 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 @@ -86,7 +86,7 @@ class Order { id: json[r'id'] as int, petId: json[r'petId'] as int, quantity: json[r'quantity'] as int, - shipDate: mapDateTime(json, r'shipDate', ''), + shipDate: mapDateTime(json, r'shipDate', '')!, status: OrderStatusEnum.fromJson(json[r'status']), complete: json[r'complete'] as bool, ); 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 bebf84957a4a..ff718ceadf09 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 @@ -88,7 +88,7 @@ Future _decodeBodyBytes(Response response) async { } /// 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; @@ -105,5 +105,5 @@ DateTime mapDateTime(dynamic map, String key, [String? pattern]) { return DateTime.fromMillisecondsSinceEpoch(millis, isUtc: true); } } - return DateTime(1970); + return null; } 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 b1fb7517ebc4..cae3f0f39fcd 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 @@ -176,8 +176,8 @@ class FormatTest { 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', ''), + date: mapDateTime(json, r'date', '')!, + dateTime: mapDateTime(json, r'dateTime', '')!, uuid: json[r'uuid'] as String, password: json[r'password'] as String, patternWithDigits: json[r'pattern_with_digits'] as String, 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 238164f5806b..d487bd73cdda 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 @@ -59,7 +59,7 @@ class MixedPropertiesAndAdditionalPropertiesClass { // ignore: prefer_constructors_over_static_methods static MixedPropertiesAndAdditionalPropertiesClass fromJson(Map json) => MixedPropertiesAndAdditionalPropertiesClass( uuid: json[r'uuid'] as String, - dateTime: mapDateTime(json, r'dateTime', ''), + dateTime: mapDateTime(json, r'dateTime', '')!, map: json[r'map'] as Map, ); 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 6879d1868e10..e50090588764 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 @@ -86,7 +86,7 @@ class Order { id: json[r'id'] as int, petId: json[r'petId'] as int, quantity: json[r'quantity'] as int, - shipDate: mapDateTime(json, r'shipDate', ''), + shipDate: mapDateTime(json, r'shipDate', '')!, status: OrderStatusEnum.fromJson(json[r'status']), complete: json[r'complete'] as bool, ); From fdd1442d8b6ca4e76717a73f83bde71e7aaab72c Mon Sep 17 00:00:00 2001 From: agilob Date: Thu, 9 Dec 2021 20:47:35 +0000 Subject: [PATCH 26/39] Fix warning on Future --- modules/openapi-generator/src/main/resources/dart2/api.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/dart2/api.mustache b/modules/openapi-generator/src/main/resources/dart2/api.mustache index 0f90871edc13..b9af70e6bfc7 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api.mustache @@ -188,7 +188,7 @@ class {{{classname}}} { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), '{{{returnType}}}',) as {{{returnType}}}; {{/isMap}}{{/isArray}}{{/native_serialization}} } - return Future<{{{returnType}}}>.value(); + return Future<{{{returnType}}}?>.value(); {{/returnType}} } {{/operation}} From 1863a04c0ce2f776c9a8a066231b2629d049a385 Mon Sep 17 00:00:00 2001 From: agilob Date: Thu, 9 Dec 2021 20:52:16 +0000 Subject: [PATCH 27/39] Fix warning on Future --- .../dart2/petstore_client_lib/lib/api/pet_api.dart | 12 ++++++------ .../petstore_client_lib/lib/api/store_api.dart | 6 +++--- .../petstore_client_lib/lib/api/user_api.dart | 4 ++-- .../lib/api/another_fake_api.dart | 2 +- .../lib/api/default_api.dart | 2 +- .../petstore_client_lib_fake/lib/api/fake_api.dart | 14 +++++++------- .../lib/api/fake_classname_tags123_api.dart | 2 +- .../petstore_client_lib_fake/lib/api/pet_api.dart | 10 +++++----- .../lib/api/store_api.dart | 6 +++--- .../petstore_client_lib_fake/lib/api/user_api.dart | 4 ++-- 10 files changed, 31 insertions(+), 31 deletions(-) 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 609b81ddcd92..ab2b4ede9442 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 @@ -69,7 +69,7 @@ class PetApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet; } - return Future.value(); + return Future.value(); } /// Deletes a pet @@ -191,7 +191,7 @@ class PetApi { .toList(growable: false); } - return Future>.value(); + return Future?>.value(); } /// Finds Pets by tags @@ -256,7 +256,7 @@ class PetApi { .toList(growable: false); } - return Future>.value(); + return Future?>.value(); } /// Find pet by ID @@ -317,7 +317,7 @@ class PetApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet; } - return Future.value(); + return Future.value(); } /// Update an existing pet @@ -373,7 +373,7 @@ class PetApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet; } - return Future.value(); + return Future.value(); } /// Updates a pet in the store with form data @@ -523,6 +523,6 @@ class PetApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ApiResponse',) as ApiResponse; } - return Future.value(); + 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 a119a01ae5ef..01464791d991 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 @@ -116,7 +116,7 @@ class StoreApi { return Map.from(await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map'),); } - return Future>.value(); + return Future?>.value(); } /// Find purchase order by ID @@ -177,7 +177,7 @@ class StoreApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order; } - return Future.value(); + return Future.value(); } /// Place an order for a pet @@ -233,6 +233,6 @@ class StoreApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order; } - return Future.value(); + 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 b1f6a8208860..f41934ab910a 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 @@ -271,7 +271,7 @@ class UserApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'User',) as User; } - return Future.value(); + return Future.value(); } /// Logs user into the system @@ -336,7 +336,7 @@ class UserApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'String',) as String; } - return Future.value(); + return Future.value(); } /// Logs out current logged in user session 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 7093b4183cff..696a992c9740 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 @@ -73,6 +73,6 @@ class AnotherFakeApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ModelClient',) as ModelClient; } - return Future.value(); + 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 9f58276b929a..a2f1704f6dc8 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 @@ -56,6 +56,6 @@ class DefaultApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'InlineResponseDefault',) as InlineResponseDefault; } - return Future.value(); + 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 3e82765387ce..a4e0bc4dcf5d 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 @@ -59,7 +59,7 @@ class FakeApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'HealthCheckResult',) as HealthCheckResult; } - return Future.value(); + return Future.value(); } /// test http signature authentication @@ -183,7 +183,7 @@ class FakeApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'bool',) as bool; } - return Future.value(); + return Future.value(); } /// Test serialization of object with outer number type @@ -239,7 +239,7 @@ class FakeApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'OuterComposite',) as OuterComposite; } - return Future.value(); + return Future.value(); } /// Test serialization of outer number types @@ -295,7 +295,7 @@ class FakeApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'num',) as num; } - return Future.value(); + return Future.value(); } /// Test serialization of outer string types @@ -351,7 +351,7 @@ class FakeApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'String',) as String; } - return Future.value(); + return Future.value(); } /// Test serialization of enum (int) properties with examples @@ -407,7 +407,7 @@ class FakeApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'OuterObjectWithEnumProperty',) as OuterObjectWithEnumProperty; } - return Future.value(); + return Future.value(); } /// For this test, the body has to be a binary file. @@ -608,7 +608,7 @@ class FakeApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ModelClient',) as ModelClient; } - return Future.value(); + return Future.value(); } /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 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 6260f4e98600..1aea15751582 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 @@ -73,6 +73,6 @@ class FakeClassnameTags123Api { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ModelClient',) as ModelClient; } - return Future.value(); + 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 89ec16507fb7..c843f5483148 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 @@ -183,7 +183,7 @@ class PetApi { .toList(growable: false); } - return Future>.value(); + return Future?>.value(); } /// Finds Pets by tags @@ -248,7 +248,7 @@ class PetApi { .toSet(); } - return Future>.value(); + return Future?>.value(); } /// Find pet by ID @@ -309,7 +309,7 @@ class PetApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet; } - return Future.value(); + return Future.value(); } /// Update an existing pet @@ -507,7 +507,7 @@ class PetApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ApiResponse',) as ApiResponse; } - return Future.value(); + return Future.value(); } /// uploads an image (required) @@ -590,6 +590,6 @@ class PetApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ApiResponse',) as ApiResponse; } - return Future.value(); + 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 e6bee9add534..04538db15516 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 @@ -116,7 +116,7 @@ class StoreApi { return Map.from(await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map'),); } - return Future>.value(); + return Future?>.value(); } /// Find purchase order by ID @@ -177,7 +177,7 @@ class StoreApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order; } - return Future.value(); + return Future.value(); } /// Place an order for a pet @@ -233,6 +233,6 @@ class StoreApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order; } - return Future.value(); + 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 5e4c63631100..a3570017a603 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 @@ -271,7 +271,7 @@ class UserApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'User',) as User; } - return Future.value(); + return Future.value(); } /// Logs user into the system @@ -336,7 +336,7 @@ class UserApi { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'String',) as String; } - return Future.value(); + return Future.value(); } /// Logs out current logged in user session From 30508691cab0fa2066d0f9fd1c24c909aec4882a Mon Sep 17 00:00:00 2001 From: agilob Date: Thu, 9 Dec 2021 20:53:57 +0000 Subject: [PATCH 28/39] Dont insert unused param to constructor --- .../src/main/resources/dart2/api_client.mustache | 2 +- .../petstore/dart2/petstore_client_lib/lib/api_client.dart | 2 +- .../petstore/dart2/petstore_client_lib_fake/lib/api_client.dart | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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 60004b85838c..ab7cef97726f 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache @@ -1,7 +1,7 @@ {{>header}} {{>part_of}} class ApiClient { - ApiClient({this.basePath = '{{{basePath}}}', HttpBearerAuth? httpBearerAuth}) { +ApiClient({this.basePath = '{{{basePath}}}'{{#isBasicBearer}}, HttpBearerAuth? httpBearerAuth{{/isBasicBearer}}}) { {{#hasAuthMethods}} // Setup authentications (key: authentication name, value: authentication). {{#authMethods}} 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 ec3634535ba7..04d2905bd531 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 @@ -11,7 +11,7 @@ part of openapi.api; class ApiClient { - ApiClient({this.basePath = 'http://petstore.swagger.io/v2', HttpBearerAuth? httpBearerAuth}) { +ApiClient({this.basePath = 'http://petstore.swagger.io/v2'}) { // Setup authentications (key: authentication name, value: authentication). _authentications[r'api_key'] = ApiKeyAuth('header', 'api_key'); _authentications[r'petstore_auth'] = OAuth(); 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 8971cd0f7835..cfcd2ab8bf8c 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 @@ -11,7 +11,7 @@ part of openapi.api; class ApiClient { - ApiClient({this.basePath = 'http://petstore.swagger.io:80/v2', HttpBearerAuth? httpBearerAuth}) { +ApiClient({this.basePath = 'http://petstore.swagger.io:80/v2'}) { // Setup authentications (key: authentication name, value: authentication). _authentications[r'api_key'] = ApiKeyAuth('header', 'api_key'); _authentications[r'api_key_query'] = ApiKeyAuth('query', 'api_key_query'); From c7258e3ac0bea9576ebb3d94314d394afed361ed Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Sat, 18 Dec 2021 21:26:14 +0100 Subject: [PATCH 29/39] Modified Dart2 Mustache template. --- .../src/main/resources/dart2/api.mustache | 12 +- .../main/resources/dart2/api_client.mustache | 101 +++++---- .../main/resources/dart2/api_helper.mustache | 53 +++-- .../main/resources/dart2/api_test.mustache | 2 +- .../main/resources/dart2/auth/header.mustache | 1 - .../dart2/auth/http_basic_auth.mustache | 9 +- .../resources/dart2/dart_constructor.mustache | 4 +- .../src/main/resources/dart2/header.mustache | 1 - .../main/resources/dart2/model_test.mustache | 2 +- .../native/native_class.mustache | 202 ++++++++++++------ .../serialization/native/native_enum.mustache | 57 +++-- .../native/native_enum_inline.mustache | 56 +++-- 12 files changed, 315 insertions(+), 185 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/dart2/api.mustache b/modules/openapi-generator/src/main/resources/dart2/api.mustache index b9af70e6bfc7..0b2a05ce9690 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api.mustache @@ -55,7 +55,7 @@ class {{{classname}}} { .replaceAll({{=<% %>=}}'{<% baseName %>}'<%={{ }}=%>, {{{paramName}}}{{^isString}}.toString(){{/isString}}){{/pathParams}}; // ignore: prefer_final_locals - Object? postBody{{#bodyParam}} = {{{paramName}}}{{/bodyParam}}; + Object{{^bodyParam}}?{{/bodyParam}} postBody{{#bodyParam}} = {{{paramName}}}{{/bodyParam}}; final queryParams = []; final headerParams = {}; @@ -66,7 +66,7 @@ class {{{classname}}} { {{^required}} if ({{{paramName}}} != null) { {{/required}} - queryParams.addAll(_convertParametersForCollectionFormat('{{{collectionFormat}}}', '{{{baseName}}}', {{{paramName}}})); + queryParams.addAll(_queryParams('{{{collectionFormat}}}', '{{{baseName}}}', {{{paramName}}})); {{^required}} } {{/required}} @@ -128,7 +128,7 @@ class {{{classname}}} { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -172,13 +172,13 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { {{#native_serialization}} {{#isArray}} final responseBody = await _decodeBodyBytes(response); return (await apiClient.deserializeAsync(responseBody, '{{{returnType}}}') as List) .cast<{{{returnBaseType}}}>() - .{{#uniqueItems}}toSet(){{/uniqueItems}}{{^uniqueItems}}toList(growable: false){{/uniqueItems}}; + .{{#uniqueItems}}toSet(){{/uniqueItems}}{{^uniqueItems}}toList(){{/uniqueItems}}; {{/isArray}} {{^isArray}} {{#isMap}} @@ -188,7 +188,7 @@ class {{{classname}}} { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), '{{{returnType}}}',) as {{{returnType}}}; {{/isMap}}{{/isArray}}{{/native_serialization}} } - return Future<{{{returnType}}}?>.value(); + return null; {{/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 ab7cef97726f..92846fc4b910 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache @@ -1,16 +1,16 @@ {{>header}} {{>part_of}} class ApiClient { -ApiClient({this.basePath = '{{{basePath}}}'{{#isBasicBearer}}, HttpBearerAuth? httpBearerAuth{{/isBasicBearer}}}) { + ApiClient({this.basePath = '{{{basePath}}}'}) { {{#hasAuthMethods}} // Setup authentications (key: authentication name, value: authentication). {{#authMethods}} {{#isBasic}} {{#isBasicBasic}} - _authentications[r'{{{name}}}'] = HttpBasicAuth('user', 'password'); + _authentications[r'{{{name}}}'] = HttpBasicAuth(); {{/isBasicBasic}} {{#isBasicBearer}} - _authentications[r'{{{name}}}'] = httpBearerAuth ?? HttpBearerAuth(); + _authentications[r'{{{name}}}'] = HttpBearerAuth(); {{/isBasicBearer}} {{/isBasic}} {{#isApiKey}} @@ -64,31 +64,25 @@ ApiClient({this.basePath = '{{{basePath}}}'{{#isBasicBearer}}, HttpBearerAuth? h Object? body, Map headerParams, Map formParams, - String? nullableContentType, + String? contentType, List authNames, ) async { _updateParamsForAuth(authNames, queryParams, headerParams); headerParams.addAll(_defaultHeaderMap); + if (contentType != null) { + headerParams['Content-Type'] = contentType; + } - final urlEncodedQueryParams = queryParams - .map((param) => '$param'); - - final queryString = urlEncodedQueryParams.isNotEmpty - ? '?${urlEncodedQueryParams.join('&')}' - : ''; - + final urlEncodedQueryParams = queryParams.map((param) => '$param'); + final queryString = urlEncodedQueryParams.isNotEmpty ? '?${urlEncodedQueryParams.join('&')}' : ''; final uri = Uri.parse('$basePath$path$queryString'); - if (nullableContentType != null) { - headerParams['Content-Type'] = nullableContentType; - } - try { // Special case for uploading a single file which isn't a 'multipart/form-data'. if ( - body is MultipartFile && (nullableContentType == null || - !nullableContentType.toLowerCase().startsWith('multipart/form-data')) + body is MultipartFile && (contentType == null || + !contentType.toLowerCase().startsWith('multipart/form-data')) ) { final request = StreamedRequest(method, uri); request.headers.addAll(headerParams); @@ -114,7 +108,7 @@ ApiClient({this.basePath = '{{{basePath}}}'{{#isBasicBearer}}, HttpBearerAuth? h return Response.fromStream(response); } - final msgBody = nullableContentType == 'application/x-www-form-urlencoded' + final msgBody = contentType == 'application/x-www-form-urlencoded' ? formParams : await serializeAsync(body); final nullableHeaderParams = headerParams.isEmpty ? null : headerParams; @@ -127,28 +121,56 @@ ApiClient({this.basePath = '{{{basePath}}}'{{#isBasicBearer}}, HttpBearerAuth? h case 'HEAD': return await _client.head(uri, headers: nullableHeaderParams,); case 'GET': return await _client.get(uri, headers: nullableHeaderParams,); } - } on SocketException catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'Socket operation failed: $method $path', e, trace,); - } on TlsException catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'TLS/SSL communication failed: $method $path', e, trace,); - } on IOException catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'I/O operation failed: $method $path', e, trace,); - } on ClientException catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'HTTP connection failed: $method $path', e, trace,); - } on Exception catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'Exception occurred: $method $path', e, trace,); + } on SocketException catch (error, trace) { + throw ApiException.withInner( + HttpStatus.badRequest, + 'Socket operation failed: $method $path', + error, + trace, + ); + } on TlsException catch (error, trace) { + throw ApiException.withInner( + HttpStatus.badRequest, + 'TLS/SSL communication failed: $method $path', + error, + trace, + ); + } on IOException catch (error, trace) { + throw ApiException.withInner( + HttpStatus.badRequest, + 'I/O operation failed: $method $path', + error, + trace, + ); + } on ClientException catch (error, trace) { + throw ApiException.withInner( + HttpStatus.badRequest, + 'HTTP connection failed: $method $path', + error, + trace, + ); + } on Exception catch (error, trace) { + throw ApiException.withInner( + HttpStatus.badRequest, + 'Exception occurred: $method $path', + error, + trace, + ); } - throw ApiException(HttpStatus.badRequest, 'Invalid HTTP operation: $method $path',); + throw ApiException( + HttpStatus.badRequest, + 'Invalid HTTP operation: $method $path', + ); } {{#native_serialization}} - Future deserializeAsync(String json, String targetType, {bool growable = false}) async => + Future deserializeAsync(String json, String targetType, {bool growable = false,}) 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 = false}) { + dynamic deserialize(String json, String targetType, {bool growable = false,}) { // Remove all spaces. Necessary for regular expressions as well. targetType = targetType.replaceAll(' ', ''); // ignore: parameter_assignments @@ -209,24 +231,21 @@ ApiClient({this.basePath = '{{{basePath}}}'{{#isBasicBearer}}, HttpBearerAuth? h {{/model}} {{/models}} default: - Match? match; - if (value is List && (match = _regList.firstMatch(targetType)) != null) { - targetType = match![1]!; // ignore: parameter_assignments + dynamic match; + if (value is List && (match = _regList.firstMatch(targetType)?.group(1)) != null) { return value - .map((dynamic v) => _deserialize(v, targetType, growable: growable)) + .map((dynamic v) => _deserialize(v, match, growable: growable,)) .toList(growable: growable); } - if (value is Set && (match = _regSet.firstMatch(targetType)) != null) { - targetType = match![1]!; // ignore: parameter_assignments + if (value is Set && (match = _regSet.firstMatch(targetType)?.group(1)) != null) { return value - .map((dynamic v) => _deserialize(v, targetType, growable: growable)) + .map((dynamic v) => _deserialize(v, match, growable: growable,)) .toSet(); } - if (value is Map && (match = _regMap.firstMatch(targetType)) != null) { - targetType = match![1]!; // ignore: parameter_assignments + if (value is Map && (match = _regMap.firstMatch(targetType)?.group(1)) != null) { return Map.fromIterables( value.keys.cast(), - value.values.map((dynamic v) => _deserialize(v, targetType, growable: growable)), + value.values.map((dynamic v) => _deserialize(v, match, growable: growable,)), ); } } 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 d39ce145df4b..ec98b7d1d741 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_helper.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_helper.mustache @@ -11,32 +11,27 @@ class QueryParam { } // Ported from the Java version. -Iterable _convertParametersForCollectionFormat( - String? collectionFormat, - String? name, - dynamic value, -) { +Iterable _queryParams(String collectionFormat, String name, dynamic value,) { + // Assertions to run in debug mode only. + assert(name.isNotEmpty, 'Parameter cannot be an empty string.'); + final params = []; - // preconditions - if (name != null && name.isNotEmpty && value != null) { - if (value is List) { - if (collectionFormat == 'multi') { - return value.map((dynamic v) => QueryParam(name, parameterToString(v)),); - } + if (value is List) { + if (collectionFormat == 'multi') { + return value.map((dynamic v) => QueryParam(name, parameterToString(v)),); + } - // Default collection format is 'csv'. - if (collectionFormat == null || collectionFormat.isEmpty) { - // ignore: parameter_assignments - collectionFormat = 'csv'; - } + // Default collection format is 'csv'. + if (collectionFormat.isEmpty) { + collectionFormat = 'csv'; // ignore: parameter_assignments + } - final delimiter = _delimiters[collectionFormat] ?? ','; + final delimiter = _delimiters[collectionFormat] ?? ','; - params.add(QueryParam(name, value.map(parameterToString).join(delimiter)),); - } else { - params.add(QueryParam(name, parameterToString(value),)); - } + params.add(QueryParam(name, value.map(parameterToString).join(delimiter),)); + } else if (value != null) { + params.add(QueryParam(name, parameterToString(value))); } return params; @@ -67,10 +62,22 @@ String parameterToString(dynamic value) { Future _decodeBodyBytes(Response response) async { final contentType = response.headers['content-type']; return contentType != null && contentType.toLowerCase().startsWith('application/json') - ? utf8.decode(response.bodyBytes) + ? response.bodyBytes.isEmpty ? '' : 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]) { final dynamic value = map is Map ? map[key] : null; @@ -82,7 +89,7 @@ DateTime? mapDateTime(dynamic map, String key, [String? pattern]) { if (pattern == _dateEpochMarker) { millis = int.tryParse(value); } else { - return DateTime.parse(value); + return DateTime.tryParse(value); } } if (millis != null) { diff --git a/modules/openapi-generator/src/main/resources/dart2/api_test.mustache b/modules/openapi-generator/src/main/resources/dart2/api_test.mustache index 6873ba0f9d4d..319945b2c3b5 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_test.mustache @@ -6,7 +6,7 @@ import 'package:test/test.dart'; /// tests for {{{classname}}} void main() { - // final instance = {{{classname}}}(); + final instance = {{{classname}}}(); group('tests for {{{classname}}}', () { {{#operation}} 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 3799d9d04658..8dc8b6d982fe 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // 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 8bbf21af1c9a..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,15 +1,12 @@ {{>header}} {{>part_of}} class HttpBasicAuth implements Authentication { - - HttpBasicAuth(this.username, this.password); - - String username; - String password; + String? username; + String? password; @override void applyToParams(List queryParams, Map headerParams) { - final credentials = '${username}:${password}'; + final credentials = '${username ?? ''}:${password ?? ''}'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; } } 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 5255b3f8ed27..dc5dfec5f2a7 100644 --- a/modules/openapi-generator/src/main/resources/dart2/dart_constructor.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/dart_constructor.mustache @@ -3,8 +3,8 @@ {{#vars}} {{! A field is required in Dart when it is - required && !nullable && !defaultValue in OAS + required && !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}}{{^defaultValue}}required {{/defaultValue}}{{/required}}this.{{{name}}}{{#defaultValue}} = {{#isEnum}}{{^isContainer}}const {{{enumName}}}._({{/isContainer}}{{/isEnum}}{{{.}}}{{#isEnum}}{{^isContainer}}){{/isContainer}}{{/isEnum}}{{/defaultValue}}, {{/vars}} }); diff --git a/modules/openapi-generator/src/main/resources/dart2/header.mustache b/modules/openapi-generator/src/main/resources/dart2/header.mustache index 3799d9d04658..8dc8b6d982fe 100644 --- a/modules/openapi-generator/src/main/resources/dart2/header.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/header.mustache @@ -1,7 +1,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // 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 index 1a074d47b71d..5d4f1c161c52 100644 --- a/modules/openapi-generator/src/main/resources/dart2/model_test.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/model_test.mustache @@ -7,7 +7,7 @@ import 'package:test/test.dart'; // tests for {{{classname}}} void main() { {{^isEnum}} - // final instance = {{{classname}}}(); + final instance = {{{classname}}}(); {{/isEnum}} group('test {{{classname}}}', () { 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 fb5181b38355..28417765b150 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 @@ -1,21 +1,40 @@ class {{{classname}}} { {{>dart_constructor}} - - {{#vars}} +{{#vars}} {{#description}} /// {{{.}}} {{/description}} {{^isEnum}} {{#minimum}} - // minimum: {{{.}}} + {{#description}} + /// + {{/description}} + /// Minimum value: {{{.}}} {{/minimum}} {{#maximum}} - // maximum: {{{.}}} + {{#description}} + {{^minimum}} + /// + {{/minimum}} + {{/description}} + /// Maximum value: {{{.}}} {{/maximum}} + {{^isNullable}} + {{^required}} + {{^defaultValue}} + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + {{/defaultValue}} + {{/required}} + {{/isNullable}} {{/isEnum}} - {{{datatypeWithEnum}}}{{^required}}?{{/required}} {{{name}}}; + {{{datatypeWithEnum}}}{{#isNullable}}?{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}?{{/defaultValue}}{{/required}}{{/isNullable}} {{{name}}}; - {{/vars}} +{{/vars}} @override bool operator ==(Object other) => identical(this, other) || other is {{{classname}}} && {{#vars}} @@ -24,8 +43,9 @@ class {{{classname}}} { @override int get hashCode => + // ignore: unnecessary_parenthesis {{#vars}} - {{{name}}}.hashCode{{^-last}} +{{/-last}}{{#-last}};{{/-last}} + ({{#isNullable}}{{{name}}} == null ? 0 : {{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}{{{name}}} == null ? 0 : {{/defaultValue}}{{/required}}{{/isNullable}}{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.hashCode){{^-last}} +{{/-last}}{{#-last}};{{/-last}} {{/vars}} @override @@ -34,37 +54,51 @@ class {{{classname}}} { Map toJson() { final json = {}; {{#vars}} - {{^required}} + {{#isNullable}} if ({{{name}}} != null) { - {{/required}} + {{/isNullable}} + {{^isNullable}} + {{^required}} + {{^defaultValue}} + if ({{{name}}} != null) { + {{/defaultValue}} + {{/required}} + {{/isNullable}} {{#isDateTime}} {{#pattern}} - json[r'{{{baseName}}}'] = {{#required}}{{#isNullable}}{{{name}}} == null ? null : {{/isNullable}}{{/required}}_dateEpochMarker == '{{{pattern}}}' - ? {{{name}}}.millisecondsSinceEpoch - : {{{name}}}.toUtc().toIso8601String(); + json[r'{{{baseName}}}'] = _dateEpochMarker == '{{{pattern}}}' + ? {{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.millisecondsSinceEpoch + : {{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc().toIso8601String(); {{/pattern}} {{^pattern}} - json[r'{{{baseName}}}'] = {{{name}}}{{^required}}!{{/required}}.toUtc().toIso8601String(); + json[r'{{{baseName}}}'] = {{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc().toIso8601String(); {{/pattern}} {{/isDateTime}} {{#isDate}} {{#pattern}} - json[r'{{{baseName}}}'] = {{#required}}{{#isNullable}}{{{name}}} == null ? null : {{/isNullable}}{{/required}}_dateEpochMarker == '{{{pattern}}}' - ? {{{name}}}.millisecondsSinceEpoch - : _dateFormatter.format({{{name}}}{{^required}}!{{/required}}.toUtc()); + json[r'{{{baseName}}}'] = _dateEpochMarker == '{{{pattern}}}' + ? {{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.millisecondsSinceEpoch + : _dateFormatter.format({{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc()); {{/pattern}} {{^pattern}} - json[r'{{{baseName}}}'] = {{#required}}{{#isNullable}}{{{name}}} == null ? null : {{/isNullable}}{{/required}}_dateFormatter.format({{{name}}}{{^required}}!{{/required}}.toUtc()); + json[r'{{{baseName}}}'] = _dateFormatter.format({{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc()); {{/pattern}} {{/isDate}} {{^isDateTime}} {{^isDate}} - json[r'{{{baseName}}}'] = {{#required}}{{#isNullable}}{{{name}}} == null ? null : {{/isNullable}}{{/required}}{{{name}}}; + json[r'{{{baseName}}}'] = {{{name}}}; {{/isDate}} {{/isDateTime}} - {{^required}} + {{#isNullable}} + } + {{/isNullable}} + {{^isNullable}} + {{^required}} + {{^defaultValue}} } - {{/required}} + {{/defaultValue}} + {{/required}} + {{/isNullable}} {{/vars}} return json; } @@ -72,13 +106,28 @@ 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(Map json) => {{{classname}}}( + static {{{classname}}}? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "{{{classname}}}[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "{{{classname}}}[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return {{{classname}}}( {{#vars}} {{#isDateTime}} - {{{name}}}: mapDateTime(json, r'{{{baseName}}}', '{{{pattern}}}'){{^isNullable}}!{{/isNullable}}, + {{{name}}}: mapDateTime(json, r'{{{baseName}}}', '{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, {{/isDateTime}} {{#isDate}} - {{{name}}}: mapDateTime(json, r'{{{baseName}}}', '{{{pattern}}}'){{^isNullable}}!{{/isNullable}}, + {{{name}}}: mapDateTime(json, r'{{{baseName}}}', '{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, {{/isDate}} {{^isDateTime}} {{^isDate}} @@ -86,48 +135,43 @@ class {{{classname}}} { {{#isArray}} {{#items.isArray}} {{{name}}}: json[r'{{{baseName}}}'] is List - ? (json[r'{{{baseName}}}'] as List).map{{#items.complexType}}>{{/items.complexType}}( + ? (json[r'{{{baseName}}}'] as List).map( {{#items.complexType}} - (final j) => {{items.complexType}}.listFromJson(j) + {{items.complexType}}.listFromJson(json[r'{{{baseName}}}']) {{/items.complexType}} {{^items.complexType}} - (e) => e == null ? <{{items.items.dataType}}>[] : (e as List).cast<{{items.items.dataType}}>() + (e) => e == null ? null : (e as List).cast<{{items.items.dataType}}>() {{/items.complexType}} - ).toList(growable: false) - : [], + ).toList() + : null, {{/items.isArray}} {{^items.isArray}} - {{#isPrimitiveType}} - {{{name}}}: (json[r'{{{baseName}}}'] as List).cast<{{{complexType}}}>(), - {{/isPrimitiveType}} - {{^isPrimitiveType}} - {{{name}}}: {{{complexType}}}.listFromJson(json[r'{{{baseName}}}']), - {{/isPrimitiveType}} + {{{name}}}: {{{complexType}}}.listFromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, {{/items.isArray}} {{/isArray}} {{^isArray}} {{#isMap}} {{#items.isArray}} {{{name}}}: json[r'{{{baseName}}}'] == null - ? null + ? {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}} {{#items.complexType}} - : {{items.complexType}}.mapListFromJson(json[r'{{{baseName}}}']), + : {{items.complexType}}.mapListFromJson(json[r'{{{baseName}}}']), {{/items.complexType}} {{^items.complexType}} - : json[r'{{{baseName}}}'] as Map, + : mapCastOfType(json, r'{{{baseName}}}'), {{/items.complexType}} {{/items.isArray}} {{^items.isArray}} {{#items.isMap}} {{#items.complexType}} - {{{name}}}: {{items.complexType}}.mapFromJson(json[r'{{{baseName}}}']), + {{{name}}}: {{items.complexType}}.mapFromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, {{/items.complexType}} {{^items.complexType}} - {{{name}}}: json[r'{{{baseName}}}'] as Map, + {{{name}}}: mapCastOfType(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, {{/items.complexType}} {{/items.isMap}} {{^items.isMap}} - {{{name}}}: json[r'{{{baseName}}}'] as {{{datatypeWithEnum}}}, + {{{name}}}: mapValueOfType<{{{datatypeWithEnum}}}>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, {{/items.isMap}} {{/items.isArray}} {{/isMap}} @@ -136,7 +180,7 @@ class {{{classname}}} { {{{name}}}: null, // No support for decoding binary content from JSON {{/isBinary}} {{^isBinary}} - {{{name}}}: {{{complexType}}}.fromJson(json[r'{{{baseName}}}']), + {{{name}}}: {{{complexType}}}.fromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, {{/isBinary}} {{/isMap}} {{/isArray}} @@ -144,63 +188,93 @@ class {{{classname}}} { {{^complexType}} {{#isArray}} {{#isEnum}} - {{{name}}}: {{{items.datatypeWithEnum}}}.listFromJson(json[r'{{{baseName}}}']), + {{{name}}}: {{{items.datatypeWithEnum}}}.listFromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, {{/isEnum}} {{^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}}}>() - : {{#uniqueItems}}{}{{/uniqueItems}}{{^uniqueItems}}[]{{/uniqueItems}}, + ? (json[r'{{{baseName}}}'] as {{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}).cast<{{{items.datatype}}}>() + : {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}, {{/isEnum}} {{/isArray}} {{^isArray}} {{#isMap}} - {{{name}}}: json[r'{{{baseName}}}'] as Map, + {{{name}}}: mapCastOfType(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, {{/isMap}} {{^isMap}} + {{#isNumber}} + {{{name}}}: json[r'{{{baseName}}}'] == null + ? {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}} + : {{{datatypeWithEnum}}}.parse(json[r'{{{baseName}}}'].toString()), + {{/isNumber}} + {{^isNumber}} {{^isEnum}} - {{{name}}}: json[r'{{{baseName}}}'] as {{{datatypeWithEnum}}}, + {{{name}}}: mapValueOfType<{{{datatypeWithEnum}}}>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, {{/isEnum}} {{#isEnum}} - {{{name}}}: {{{enumName}}}.fromJson(json[r'{{{baseName}}}']), + {{{name}}}: {{{enumName}}}.fromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, {{/isEnum}} + {{/isNumber}} {{/isMap}} {{/isArray}} {{/complexType}} {{/isDate}} {{/isDateTime}} {{/vars}} - ); + ); + } + return null; + } - 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 List<{{{classname}}}>? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = <{{{classname}}}>[]; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = {{{classname}}}.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = {{{classname}}}.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = {{{classname}}}.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of {{{classname}}}-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = {{{classname}}}.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = {{{classname}}}.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { +{{#vars}} + {{#required}} + '{{{baseName}}}', + {{/required}} +{{/vars}} + }; } {{#vars}} {{#isEnum}} 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 9766ed3c5a90..4c4300334d47 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}}; + String toString() => {{#isString}}value{{/isString}}{{^isString}}value.toString(){{/isString}}; - {{{dataType}}}? toJson() => value; + {{{dataType}}} toJson() => value; {{#allowableValues}} {{#enumVars}} @@ -26,13 +26,20 @@ class {{{classname}}} { {{/allowableValues}} ]; - static {{{classname}}} fromJson(dynamic value) => - {{{classname}}}TypeTransformer().decode(value); + static {{{classname}}}? fromJson(dynamic value) => {{{classname}}}TypeTransformer().decode(value); - 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 List<{{{classname}}}>? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = <{{{classname}}}>[]; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = {{{classname}}}.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } } /// Transformation class that can [encode] an instance of [{{{classname}}}] to {{{dataType}}}, @@ -42,21 +49,31 @@ 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 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}}}; + /// 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 = true}) { + if (data != null) { + switch (data.toString()) { + {{#allowableValues}} + {{#enumVars}} + case {{#isString}}r{{/isString}}{{{value}}}: return {{{classname}}}.{{{name}}}; + {{/enumVars}} + {{/allowableValues}} + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } } - {{/enumVars}} - {{/allowableValues}} - throw ArgumentError('Unknown enum value to decode: $data'); - + return null; } /// Singleton [{{{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 fac964639e8c..3eedbee1bc57 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}}; + String toString() => {{#isString}}value{{/isString}}{{^isString}}value.toString(){{/isString}}; - {{{dataType}}}? toJson() => value; + {{{dataType}}} toJson() => value; {{#allowableValues}} {{#enumVars}} @@ -26,13 +26,20 @@ class {{{enumName}}} { {{/allowableValues}} ]; - static {{{enumName}}} fromJson(dynamic value) => - {{{enumName}}}TypeTransformer().decode(value); + static {{{enumName}}}? fromJson(dynamic value) => {{{enumName}}}TypeTransformer().decode(value); - static List<{{{enumName}}}> listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map<{{{enumName}}}>((i) => {{{enumName}}}.fromJson(i as Map)).toList(growable: true == growable) - : <{{{enumName}}}>[]; + static List<{{{enumName}}}>? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = <{{{enumName}}}>[]; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = {{{enumName}}}.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } } /// Transformation class that can [encode] an instance of [{{{enumName}}}] to {{{dataType}}}, @@ -42,20 +49,31 @@ 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 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}}}; + /// 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 = true}) { + if (data != null) { + switch (data.toString()) { + {{#allowableValues}} + {{#enumVars}} + case {{#isString}}r{{/isString}}{{{value}}}: return {{{enumName}}}.{{{name}}}; + {{/enumVars}} + {{/allowableValues}} + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } } - {{/enumVars}} - {{/allowableValues}} - throw ArgumentError('Unknown enum value to decode: $data'); + return null; } /// Singleton [{{{enumName}}}TypeTransformer] instance. From 17b6c76cea06a0cbc1b43f65804748f2e19acff0 Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Sat, 18 Dec 2021 21:29:38 +0100 Subject: [PATCH 30/39] Regenerated Petstore source code. --- .../dart2/petstore_client_lib/lib/api.dart | 1 - .../petstore_client_lib/lib/api/pet_api.dart | 53 ++- .../lib/api/store_api.dart | 23 +- .../petstore_client_lib/lib/api/user_api.dart | 37 +- .../petstore_client_lib/lib/api_client.dart | 98 +++--- .../lib/api_exception.dart | 1 - .../petstore_client_lib/lib/api_helper.dart | 54 +-- .../lib/auth/api_key_auth.dart | 1 - .../lib/auth/authentication.dart | 1 - .../lib/auth/http_basic_auth.dart | 10 +- .../lib/auth/http_bearer_auth.dart | 1 - .../petstore_client_lib/lib/auth/oauth.dart | 1 - .../lib/model/api_response.dart | 102 ++++-- .../lib/model/category.dart | 92 +++-- .../petstore_client_lib/lib/model/order.dart | 180 +++++++--- .../petstore_client_lib/lib/model/pet.dart | 170 ++++++--- .../petstore_client_lib/lib/model/tag.dart | 92 +++-- .../petstore_client_lib/lib/model/user.dart | 154 ++++++-- .../petstore_client_lib_fake/lib/api.dart | 1 - .../lib/api/another_fake_api.dart | 9 +- .../lib/api/default_api.dart | 7 +- .../lib/api/fake_api.dart | 119 ++++--- .../lib/api/fake_classname_tags123_api.dart | 9 +- .../lib/api/pet_api.dart | 49 ++- .../lib/api/store_api.dart | 23 +- .../lib/api/user_api.dart | 37 +- .../lib/api_client.dart | 102 +++--- .../lib/api_exception.dart | 1 - .../lib/api_helper.dart | 54 +-- .../lib/auth/api_key_auth.dart | 1 - .../lib/auth/authentication.dart | 1 - .../lib/auth/http_basic_auth.dart | 10 +- .../lib/auth/http_bearer_auth.dart | 1 - .../lib/auth/oauth.dart | 1 - .../model/additional_properties_class.dart | 88 +++-- .../lib/model/animal.dart | 85 +++-- .../lib/model/api_response.dart | 102 ++++-- .../model/array_of_array_of_number_only.dart | 84 +++-- .../lib/model/array_of_number_only.dart | 82 +++-- .../lib/model/array_test.dart | 108 +++--- .../lib/model/capitalization.dart | 134 +++++-- .../lib/model/cat.dart | 95 +++-- .../lib/model/cat_all_of.dart | 82 +++-- .../lib/model/category.dart | 87 +++-- .../lib/model/class_model.dart | 82 +++-- .../lib/model/deprecated_object.dart | 82 +++-- .../lib/model/dog.dart | 95 +++-- .../lib/model/dog_all_of.dart | 82 +++-- .../lib/model/enum_arrays.dart | 190 ++++++---- .../lib/model/enum_class.dart | 60 ++-- .../lib/model/enum_test.dart | 333 ++++++++++++------ .../lib/model/file_schema_test_class.dart | 88 +++-- .../lib/model/foo.dart | 80 +++-- .../lib/model/format_test.dart | 232 ++++++++---- .../lib/model/has_only_read_only.dart | 92 +++-- .../lib/model/health_check_result.dart | 76 ++-- .../lib/model/inline_response_default.dart | 80 +++-- .../lib/model/map_test.dart | 160 +++++---- ...rties_and_additional_properties_class.dart | 100 ++++-- .../lib/model/model200_response.dart | 92 +++-- .../lib/model/model_client.dart | 82 +++-- .../lib/model/model_file.dart | 82 +++-- .../lib/model/model_list.dart | 82 +++-- .../lib/model/model_return.dart | 82 +++-- .../lib/model/name.dart | 109 ++++-- .../lib/model/nullable_class.dart | 136 ++++--- .../lib/model/number_only.dart | 84 +++-- .../model/object_with_deprecated_fields.dart | 112 ++++-- .../lib/model/order.dart | 180 +++++++--- .../lib/model/outer_composite.dart | 104 ++++-- .../lib/model/outer_enum.dart | 60 ++-- .../lib/model/outer_enum_default_value.dart | 60 ++-- .../lib/model/outer_enum_integer.dart | 60 ++-- .../outer_enum_integer_default_value.dart | 60 ++-- .../outer_object_with_enum_property.dart | 77 ++-- .../lib/model/pet.dart | 170 ++++++--- .../lib/model/read_only_first.dart | 92 +++-- .../lib/model/special_model_name.dart | 82 +++-- .../lib/model/tag.dart | 92 +++-- .../lib/model/user.dart | 154 ++++++-- 80 files changed, 4303 insertions(+), 2024 deletions(-) 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 742bcfa11543..3855a2f4fac3 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // 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 ab2b4ede9442..9ad09e25db5f 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -29,7 +28,7 @@ class PetApi { final path = r'/pet'; // ignore: prefer_final_locals - Object? postBody = pet; + Object postBody = pet; final queryParams = []; final headerParams = {}; @@ -46,7 +45,7 @@ class PetApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -65,11 +64,11 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet; } - return Future.value(); + return null; } /// Deletes a pet @@ -109,7 +108,7 @@ class PetApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -150,7 +149,7 @@ class PetApi { final headerParams = {}; final formParams = {}; - queryParams.addAll(_convertParametersForCollectionFormat('csv', 'status', status)); + queryParams.addAll(_queryParams('csv', 'status', status)); const authNames = ['petstore_auth']; const contentTypes = []; @@ -163,7 +162,7 @@ class PetApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -184,14 +183,14 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { final responseBody = await _decodeBodyBytes(response); return (await apiClient.deserializeAsync(responseBody, 'List') as List) .cast() - .toList(growable: false); + .toList(); } - return Future?>.value(); + return null; } /// Finds Pets by tags @@ -215,7 +214,7 @@ class PetApi { final headerParams = {}; final formParams = {}; - queryParams.addAll(_convertParametersForCollectionFormat('csv', 'tags', tags)); + queryParams.addAll(_queryParams('csv', 'tags', tags)); const authNames = ['petstore_auth']; const contentTypes = []; @@ -228,7 +227,7 @@ class PetApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -249,14 +248,14 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { final responseBody = await _decodeBodyBytes(response); return (await apiClient.deserializeAsync(responseBody, 'List') as List) .cast() - .toList(growable: false); + .toList(); } - return Future?>.value(); + return null; } /// Find pet by ID @@ -292,7 +291,7 @@ class PetApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -313,11 +312,11 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet; } - return Future.value(); + return null; } /// Update an existing pet @@ -333,7 +332,7 @@ class PetApi { final path = r'/pet'; // ignore: prefer_final_locals - Object? postBody = pet; + Object postBody = pet; final queryParams = []; final headerParams = {}; @@ -350,7 +349,7 @@ class PetApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -369,11 +368,11 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet; } - return Future.value(); + return null; } /// Updates a pet in the store with form data @@ -419,7 +418,7 @@ class PetApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -494,7 +493,7 @@ class PetApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -519,10 +518,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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ApiResponse',) as ApiResponse; } - return Future.value(); + return null; } } 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 01464791d991..c9de8dd531c1 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -49,7 +48,7 @@ class StoreApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -96,7 +95,7 @@ class StoreApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -112,11 +111,11 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return Map.from(await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map'),); } - return Future?>.value(); + return null; } /// Find purchase order by ID @@ -152,7 +151,7 @@ class StoreApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -173,11 +172,11 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order; } - return Future.value(); + return null; } /// Place an order for a pet @@ -193,7 +192,7 @@ class StoreApi { final path = r'/store/order'; // ignore: prefer_final_locals - Object? postBody = order; + Object postBody = order; final queryParams = []; final headerParams = {}; @@ -210,7 +209,7 @@ class StoreApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -229,10 +228,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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order; } - return Future.value(); + return null; } } 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 f41934ab910a..2a30d3ec9278 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -31,7 +30,7 @@ class UserApi { final path = r'/user'; // ignore: prefer_final_locals - Object? postBody = user; + Object postBody = user; final queryParams = []; final headerParams = {}; @@ -48,7 +47,7 @@ class UserApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -81,7 +80,7 @@ class UserApi { final path = r'/user/createWithArray'; // ignore: prefer_final_locals - Object? postBody = user; + Object postBody = user; final queryParams = []; final headerParams = {}; @@ -98,7 +97,7 @@ class UserApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -129,7 +128,7 @@ class UserApi { final path = r'/user/createWithList'; // ignore: prefer_final_locals - Object? postBody = user; + Object postBody = user; final queryParams = []; final headerParams = {}; @@ -146,7 +145,7 @@ class UserApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -197,7 +196,7 @@ class UserApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -248,7 +247,7 @@ class UserApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -267,11 +266,11 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'User',) as User; } - return Future.value(); + return null; } /// Logs user into the system @@ -296,8 +295,8 @@ class UserApi { final headerParams = {}; final formParams = {}; - queryParams.addAll(_convertParametersForCollectionFormat('', 'username', username)); - queryParams.addAll(_convertParametersForCollectionFormat('', 'password', password)); + queryParams.addAll(_queryParams('', 'username', username)); + queryParams.addAll(_queryParams('', 'password', password)); const authNames = []; const contentTypes = []; @@ -310,7 +309,7 @@ class UserApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -332,11 +331,11 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'String',) as String; } - return Future.value(); + return null; } /// Logs out current logged in user session @@ -364,7 +363,7 @@ class UserApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -396,7 +395,7 @@ class UserApi { .replaceAll('{username}', username); // ignore: prefer_final_locals - Object? postBody = user; + Object postBody = user; final queryParams = []; final headerParams = {}; @@ -413,7 +412,7 @@ class UserApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } 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 04d2905bd531..ec06c4381935 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -11,7 +10,7 @@ part of openapi.api; class ApiClient { -ApiClient({this.basePath = 'http://petstore.swagger.io/v2'}) { + ApiClient({this.basePath = 'http://petstore.swagger.io/v2'}) { // Setup authentications (key: authentication name, value: authentication). _authentications[r'api_key'] = ApiKeyAuth('header', 'api_key'); _authentications[r'petstore_auth'] = OAuth(); @@ -58,31 +57,25 @@ ApiClient({this.basePath = 'http://petstore.swagger.io/v2'}) { Object? body, Map headerParams, Map formParams, - String? nullableContentType, + String? contentType, List authNames, ) async { _updateParamsForAuth(authNames, queryParams, headerParams); headerParams.addAll(_defaultHeaderMap); + if (contentType != null) { + headerParams['Content-Type'] = contentType; + } - final urlEncodedQueryParams = queryParams - .map((param) => '$param'); - - final queryString = urlEncodedQueryParams.isNotEmpty - ? '?${urlEncodedQueryParams.join('&')}' - : ''; - + final urlEncodedQueryParams = queryParams.map((param) => '$param'); + final queryString = urlEncodedQueryParams.isNotEmpty ? '?${urlEncodedQueryParams.join('&')}' : ''; final uri = Uri.parse('$basePath$path$queryString'); - if (nullableContentType != null) { - headerParams['Content-Type'] = nullableContentType; - } - try { // Special case for uploading a single file which isn't a 'multipart/form-data'. if ( - body is MultipartFile && (nullableContentType == null || - !nullableContentType.toLowerCase().startsWith('multipart/form-data')) + body is MultipartFile && (contentType == null || + !contentType.toLowerCase().startsWith('multipart/form-data')) ) { final request = StreamedRequest(method, uri); request.headers.addAll(headerParams); @@ -108,7 +101,7 @@ ApiClient({this.basePath = 'http://petstore.swagger.io/v2'}) { return Response.fromStream(response); } - final msgBody = nullableContentType == 'application/x-www-form-urlencoded' + final msgBody = contentType == 'application/x-www-form-urlencoded' ? formParams : await serializeAsync(body); final nullableHeaderParams = headerParams.isEmpty ? null : headerParams; @@ -121,27 +114,55 @@ ApiClient({this.basePath = 'http://petstore.swagger.io/v2'}) { case 'HEAD': return await _client.head(uri, headers: nullableHeaderParams,); case 'GET': return await _client.get(uri, headers: nullableHeaderParams,); } - } on SocketException catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'Socket operation failed: $method $path', e, trace,); - } on TlsException catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'TLS/SSL communication failed: $method $path', e, trace,); - } on IOException catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'I/O operation failed: $method $path', e, trace,); - } on ClientException catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'HTTP connection failed: $method $path', e, trace,); - } on Exception catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'Exception occurred: $method $path', e, trace,); + } on SocketException catch (error, trace) { + throw ApiException.withInner( + HttpStatus.badRequest, + 'Socket operation failed: $method $path', + error, + trace, + ); + } on TlsException catch (error, trace) { + throw ApiException.withInner( + HttpStatus.badRequest, + 'TLS/SSL communication failed: $method $path', + error, + trace, + ); + } on IOException catch (error, trace) { + throw ApiException.withInner( + HttpStatus.badRequest, + 'I/O operation failed: $method $path', + error, + trace, + ); + } on ClientException catch (error, trace) { + throw ApiException.withInner( + HttpStatus.badRequest, + 'HTTP connection failed: $method $path', + error, + trace, + ); + } on Exception catch (error, trace) { + throw ApiException.withInner( + HttpStatus.badRequest, + 'Exception occurred: $method $path', + error, + trace, + ); } - throw ApiException(HttpStatus.badRequest, 'Invalid HTTP operation: $method $path',); + throw ApiException( + HttpStatus.badRequest, + 'Invalid HTTP operation: $method $path', + ); } - Future deserializeAsync(String json, String targetType, {bool growable = false}) async => + Future deserializeAsync(String json, String targetType, {bool growable = false,}) 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 = false}) { + dynamic deserialize(String json, String targetType, {bool growable = false,}) { // Remove all spaces. Necessary for regular expressions as well. targetType = targetType.replaceAll(' ', ''); // ignore: parameter_assignments @@ -201,24 +222,21 @@ ApiClient({this.basePath = 'http://petstore.swagger.io/v2'}) { case 'User': return User.fromJson(value); default: - Match? match; - if (value is List && (match = _regList.firstMatch(targetType)) != null) { - targetType = match![1]!; // ignore: parameter_assignments + dynamic match; + if (value is List && (match = _regList.firstMatch(targetType)?.group(1)) != null) { return value - .map((dynamic v) => _deserialize(v, targetType, growable: growable)) + .map((dynamic v) => _deserialize(v, match, growable: growable,)) .toList(growable: growable); } - if (value is Set && (match = _regSet.firstMatch(targetType)) != null) { - targetType = match![1]!; // ignore: parameter_assignments + if (value is Set && (match = _regSet.firstMatch(targetType)?.group(1)) != null) { return value - .map((dynamic v) => _deserialize(v, targetType, growable: growable)) + .map((dynamic v) => _deserialize(v, match, growable: growable,)) .toSet(); } - if (value is Map && (match = _regMap.firstMatch(targetType)) != null) { - targetType = match![1]!; // ignore: parameter_assignments + if (value is Map && (match = _regMap.firstMatch(targetType)?.group(1)) != null) { return Map.fromIterables( value.keys.cast(), - value.values.map((dynamic v) => _deserialize(v, targetType, growable: growable)), + value.values.map((dynamic v) => _deserialize(v, match, growable: growable,)), ); } } 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 796f7f7ee74e..6ad46aec00fb 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // 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_helper.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_helper.dart index 4ffd040eb866..9d1c3e6a8602 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -21,32 +20,27 @@ class QueryParam { } // Ported from the Java version. -Iterable _convertParametersForCollectionFormat( - String? collectionFormat, - String? name, - dynamic value, -) { +Iterable _queryParams(String collectionFormat, String name, dynamic value,) { + // Assertions to run in debug mode only. + assert(name.isNotEmpty, 'Parameter cannot be an empty string.'); + final params = []; - // preconditions - if (name != null && name.isNotEmpty && value != null) { - if (value is List) { - if (collectionFormat == 'multi') { - return value.map((dynamic v) => QueryParam(name, parameterToString(v)),); - } + if (value is List) { + if (collectionFormat == 'multi') { + return value.map((dynamic v) => QueryParam(name, parameterToString(v)),); + } - // Default collection format is 'csv'. - if (collectionFormat == null || collectionFormat.isEmpty) { - // ignore: parameter_assignments - collectionFormat = 'csv'; - } + // Default collection format is 'csv'. + if (collectionFormat.isEmpty) { + collectionFormat = 'csv'; // ignore: parameter_assignments + } - final delimiter = _delimiters[collectionFormat] ?? ','; + final delimiter = _delimiters[collectionFormat] ?? ','; - params.add(QueryParam(name, value.map(parameterToString).join(delimiter)),); - } else { - params.add(QueryParam(name, parameterToString(value),)); - } + params.add(QueryParam(name, value.map(parameterToString).join(delimiter),)); + } else if (value != null) { + params.add(QueryParam(name, parameterToString(value))); } return params; @@ -68,10 +62,22 @@ String parameterToString(dynamic value) { Future _decodeBodyBytes(Response response) async { final contentType = response.headers['content-type']; return contentType != null && contentType.toLowerCase().startsWith('application/json') - ? utf8.decode(response.bodyBytes) + ? response.bodyBytes.isEmpty ? '' : 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]) { final dynamic value = map is Map ? map[key] : null; @@ -83,7 +89,7 @@ DateTime? mapDateTime(dynamic map, String key, [String? pattern]) { if (pattern == _dateEpochMarker) { millis = int.tryParse(value); } else { - return DateTime.parse(value); + return DateTime.tryParse(value); } } if (millis != null) { 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 2af78a62bcf0..65c42ea845ed 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // 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/authentication.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart index 49baf7c46a9c..7118eec2fb06 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // 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 4ac4528c27ca..8b8a844771dd 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -11,15 +10,12 @@ part of openapi.api; class HttpBasicAuth implements Authentication { - - HttpBasicAuth(this.username, this.password); - - String username; - String password; + String? username; + String? password; @override void applyToParams(List queryParams, Map headerParams) { - final credentials = '${username}:${password}'; + final credentials = '${username ?? ''}:${password ?? ''}'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; } } 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 07f105666dc0..4e993fbf9a5c 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // 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 66ec4cda0864..8bd8b745acf5 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // 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/model/api_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart index 794799e433a2..d0a510590675 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -18,11 +17,28 @@ class ApiResponse { this.message, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? code; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? type; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? message; @override @@ -33,9 +49,10 @@ class ApiResponse { @override int get hashCode => - code.hashCode + - type.hashCode + - message.hashCode; + // ignore: unnecessary_parenthesis + (code == null ? 0 : code!.hashCode) + + (type == null ? 0 : type!.hashCode) + + (message == null ? 0 : message!.hashCode); @override String toString() => 'ApiResponse[code=$code, type=$type, message=$message]'; @@ -57,41 +74,74 @@ 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(Map json) => ApiResponse( - code: json[r'code'] as int, - type: json[r'type'] as String, - message: json[r'message'] as String, - ); + static ApiResponse? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ApiResponse[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ApiResponse[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ApiResponse( + code: mapValueOfType(json, r'code'), + type: mapValueOfType(json, r'type'), + message: mapValueOfType(json, r'message'), + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => ApiResponse.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ApiResponse.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = ApiResponse.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ApiResponse.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of ApiResponse-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = ApiResponse.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ApiResponse.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 130eb41286df..30365a06d285 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -17,9 +16,20 @@ class Category { this.name, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? id; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? name; @override @@ -29,8 +39,9 @@ class Category { @override int get hashCode => - id.hashCode + - name.hashCode; + // ignore: unnecessary_parenthesis + (id == null ? 0 : id!.hashCode) + + (name == null ? 0 : name!.hashCode); @override String toString() => 'Category[id=$id, name=$name]'; @@ -49,40 +60,73 @@ 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(Map json) => Category( - id: json[r'id'] as int, - name: json[r'name'] as String, - ); + static Category? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Category[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Category[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Category( + id: mapValueOfType(json, r'id'), + name: mapValueOfType(json, r'name'), + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => Category.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Category.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = Category.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Category.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of Category-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = Category.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Category.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 e50090588764..51e75d68274e 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -21,19 +20,42 @@ class Order { this.complete = false, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? id; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? petId; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? quantity; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// DateTime? shipDate; /// Order Status OrderStatusEnum? status; - bool? complete; + bool complete; @override bool operator ==(Object other) => identical(this, other) || other is Order && @@ -46,12 +68,13 @@ class Order { @override int get hashCode => - id.hashCode + - petId.hashCode + - quantity.hashCode + - shipDate.hashCode + - status.hashCode + - complete.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.hashCode); @override String toString() => 'Order[id=$id, petId=$petId, quantity=$quantity, shipDate=$shipDate, status=$status, complete=$complete]'; @@ -73,54 +96,85 @@ class Order { if (status != null) { json[r'status'] = status; } - if (complete != null) { json[r'complete'] = complete; - } return json; } /// 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(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', '')!, + static Order? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Order[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Order[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Order( + id: mapValueOfType(json, r'id'), + petId: mapValueOfType(json, r'petId'), + quantity: mapValueOfType(json, r'quantity'), + shipDate: mapDateTime(json, r'shipDate', ''), status: OrderStatusEnum.fromJson(json[r'status']), - complete: json[r'complete'] as bool, - ); + complete: mapValueOfType(json, r'complete') ?? false, + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => Order.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Order.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = Order.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Order.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of Order-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = Order.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Order.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } /// Order Status @@ -129,12 +183,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 toString() => value; - String? toJson() => value; + String toJson() => value; static const placed = OrderStatusEnum._(r'placed'); static const approved = OrderStatusEnum._(r'approved'); @@ -147,13 +201,20 @@ class OrderStatusEnum { delivered, ]; - static OrderStatusEnum fromJson(dynamic value) => - OrderStatusEnumTypeTransformer().decode(value); - - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => OrderStatusEnum.fromJson(i as Map)).toList(growable: true == growable) - : []; + static OrderStatusEnum? fromJson(dynamic value) => OrderStatusEnumTypeTransformer().decode(value); + + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = OrderStatusEnum.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } } /// Transformation class that can [encode] an instance of [OrderStatusEnum] to String, @@ -163,22 +224,29 @@ 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 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; + /// 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 = true}) { + 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) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } } - throw ArgumentError('Unknown enum value to decode: $data'); + return null; } /// Singleton [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 48f0d97e6faa..237fc10663ec 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -21,16 +20,27 @@ class Pet { this.status, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? id; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// Category? category; String name; List photoUrls; - List? tags; + List tags; /// pet status in the store PetStatusEnum? status; @@ -46,12 +56,13 @@ class Pet { @override int get hashCode => - id.hashCode + - category.hashCode + - name.hashCode + - photoUrls.hashCode + - tags.hashCode + - status.hashCode; + // ignore: unnecessary_parenthesis + (id == null ? 0 : id!.hashCode) + + (category == null ? 0 : category!.hashCode) + + (name.hashCode) + + (photoUrls.hashCode) + + (tags.hashCode) + + (status == null ? 0 : status!.hashCode); @override String toString() => 'Pet[id=$id, category=$category, name=$name, photoUrls=$photoUrls, tags=$tags, status=$status]'; @@ -66,9 +77,7 @@ class Pet { } json[r'name'] = name; json[r'photoUrls'] = photoUrls; - if (tags != null) { json[r'tags'] = tags; - } if (status != null) { json[r'status'] = status; } @@ -78,47 +87,82 @@ 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(Map json) => Pet( - id: json[r'id'] as int, + static Pet? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Pet[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Pet[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Pet( + id: mapValueOfType(json, r'id'), category: Category.fromJson(json[r'category']), - name: json[r'name'] as String, + name: mapValueOfType(json, r'name')!, photoUrls: json[r'photoUrls'] is List - ? (json[r'photoUrls'] as List).cast() - : [], - tags: Tag.listFromJson(json[r'tags']), + ? (json[r'photoUrls'] as List).cast() + : const [], + tags: Tag.listFromJson(json[r'tags']) ?? const [], status: PetStatusEnum.fromJson(json[r'status']), - ); + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => Pet.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Pet.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = Pet.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Pet.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of Pet-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = Pet.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Pet.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'name', + 'photoUrls', + }; } /// pet status in the store @@ -127,12 +171,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 toString() => value; - String? toJson() => value; + String toJson() => value; static const available = PetStatusEnum._(r'available'); static const pending = PetStatusEnum._(r'pending'); @@ -145,13 +189,20 @@ class PetStatusEnum { sold, ]; - static PetStatusEnum fromJson(dynamic value) => - PetStatusEnumTypeTransformer().decode(value); - - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => PetStatusEnum.fromJson(i as Map)).toList(growable: true == growable) - : []; + static PetStatusEnum? fromJson(dynamic value) => PetStatusEnumTypeTransformer().decode(value); + + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = PetStatusEnum.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } } /// Transformation class that can [encode] an instance of [PetStatusEnum] to String, @@ -161,22 +212,29 @@ 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 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; + /// 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 = true}) { + 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) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } } - throw ArgumentError('Unknown enum value to decode: $data'); + return null; } /// Singleton [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 6966abac0d1f..a6692553e7b6 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -17,9 +16,20 @@ class Tag { this.name, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? id; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? name; @override @@ -29,8 +39,9 @@ class Tag { @override int get hashCode => - id.hashCode + - name.hashCode; + // ignore: unnecessary_parenthesis + (id == null ? 0 : id!.hashCode) + + (name == null ? 0 : name!.hashCode); @override String toString() => 'Tag[id=$id, name=$name]'; @@ -49,40 +60,73 @@ 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(Map json) => Tag( - id: json[r'id'] as int, - name: json[r'name'] as String, - ); + static Tag? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Tag[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Tag[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Tag( + id: mapValueOfType(json, r'id'), + name: mapValueOfType(json, r'name'), + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => Tag.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Tag.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = Tag.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Tag.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of Tag-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = Tag.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Tag.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 7324ba6d01b8..83cf14e866ca 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -23,22 +22,69 @@ class User { this.userStatus, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? id; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? username; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? firstName; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? lastName; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? email; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? password; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? phone; /// User Status + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? userStatus; @override @@ -54,14 +100,15 @@ class User { @override int get hashCode => - id.hashCode + - username.hashCode + - firstName.hashCode + - lastName.hashCode + - email.hashCode + - password.hashCode + - phone.hashCode + - userStatus.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); @override String toString() => 'User[id=$id, username=$username, firstName=$firstName, lastName=$lastName, email=$email, password=$password, phone=$phone, userStatus=$userStatus]'; @@ -98,46 +145,79 @@ 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(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 User? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "User[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "User[$key]" has a null value in JSON.'); + }); + return true; + }()); + + 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 = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = User.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = User.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = User.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of User-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = User.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = User.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 48f61a0d5f5d..0bd28563760c 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // 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 696a992c9740..1a48ff34ce86 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -31,7 +30,7 @@ class AnotherFakeApi { final path = r'/another-fake/dummy'; // ignore: prefer_final_locals - Object? postBody = modelClient; + Object postBody = modelClient; final queryParams = []; final headerParams = {}; @@ -48,7 +47,7 @@ class AnotherFakeApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -69,10 +68,10 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ModelClient',) as ModelClient; } - return Future.value(); + return null; } } 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 a2f1704f6dc8..14341ee5fc7d 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -39,7 +38,7 @@ class DefaultApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -52,10 +51,10 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'InlineResponseDefault',) as InlineResponseDefault; } - return Future.value(); + return null; } } 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 a4e0bc4dcf5d..430195af11a2 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -41,7 +40,7 @@ class FakeApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -55,11 +54,11 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'HealthCheckResult',) as HealthCheckResult; } - return Future.value(); + return null; } /// test http signature authentication @@ -81,14 +80,14 @@ class FakeApi { final path = r'/fake/http-signature-test'; // ignore: prefer_final_locals - Object? postBody = pet; + Object postBody = pet; final queryParams = []; final headerParams = {}; final formParams = {}; if (query1 != null) { - queryParams.addAll(_convertParametersForCollectionFormat('', 'query_1', query1)); + queryParams.addAll(_queryParams('', 'query_1', query1)); } if (header1 != null) { @@ -106,7 +105,7 @@ class FakeApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -143,7 +142,7 @@ class FakeApi { final path = r'/fake/outer/boolean'; // ignore: prefer_final_locals - Object? postBody = body; + Object postBody = body; final queryParams = []; final headerParams = {}; @@ -160,7 +159,7 @@ class FakeApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -179,11 +178,11 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'bool',) as bool; } - return Future.value(); + return null; } /// Test serialization of object with outer number type @@ -199,7 +198,7 @@ class FakeApi { final path = r'/fake/outer/composite'; // ignore: prefer_final_locals - Object? postBody = outerComposite; + Object postBody = outerComposite; final queryParams = []; final headerParams = {}; @@ -216,7 +215,7 @@ class FakeApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -235,11 +234,11 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'OuterComposite',) as OuterComposite; } - return Future.value(); + return null; } /// Test serialization of outer number types @@ -255,7 +254,7 @@ class FakeApi { final path = r'/fake/outer/number'; // ignore: prefer_final_locals - Object? postBody = body; + Object postBody = body; final queryParams = []; final headerParams = {}; @@ -272,7 +271,7 @@ class FakeApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -291,11 +290,11 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'num',) as num; } - return Future.value(); + return null; } /// Test serialization of outer string types @@ -311,7 +310,7 @@ class FakeApi { final path = r'/fake/outer/string'; // ignore: prefer_final_locals - Object? postBody = body; + Object postBody = body; final queryParams = []; final headerParams = {}; @@ -328,7 +327,7 @@ class FakeApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -347,11 +346,11 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'String',) as String; } - return Future.value(); + return null; } /// Test serialization of enum (int) properties with examples @@ -367,7 +366,7 @@ class FakeApi { final path = r'/fake/property/enum-int'; // ignore: prefer_final_locals - Object? postBody = outerObjectWithEnumProperty; + Object postBody = outerObjectWithEnumProperty; final queryParams = []; final headerParams = {}; @@ -384,7 +383,7 @@ class FakeApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -403,11 +402,11 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'OuterObjectWithEnumProperty',) as OuterObjectWithEnumProperty; } - return Future.value(); + return null; } /// For this test, the body has to be a binary file. @@ -423,7 +422,7 @@ class FakeApi { final path = r'/fake/body-with-binary'; // ignore: prefer_final_locals - Object? postBody = body; + Object postBody = body; final queryParams = []; final headerParams = {}; @@ -440,7 +439,7 @@ class FakeApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -470,7 +469,7 @@ class FakeApi { final path = r'/fake/body-with-file-schema'; // ignore: prefer_final_locals - Object? postBody = fileSchemaTestClass; + Object postBody = fileSchemaTestClass; final queryParams = []; final headerParams = {}; @@ -487,7 +486,7 @@ class FakeApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -515,13 +514,13 @@ class FakeApi { final path = r'/fake/body-with-query-params'; // ignore: prefer_final_locals - Object? postBody = user; + Object postBody = user; final queryParams = []; final headerParams = {}; final formParams = {}; - queryParams.addAll(_convertParametersForCollectionFormat('', 'query', query)); + queryParams.addAll(_queryParams('', 'query', query)); const authNames = []; const contentTypes = ['application/json']; @@ -534,7 +533,7 @@ class FakeApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -566,7 +565,7 @@ class FakeApi { final path = r'/fake'; // ignore: prefer_final_locals - Object? postBody = modelClient; + Object postBody = modelClient; final queryParams = []; final headerParams = {}; @@ -583,7 +582,7 @@ class FakeApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -604,11 +603,11 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ModelClient',) as ModelClient; } - return Future.value(); + return null; } /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -721,7 +720,7 @@ class FakeApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -823,16 +822,16 @@ class FakeApi { final formParams = {}; if (enumQueryStringArray != null) { - queryParams.addAll(_convertParametersForCollectionFormat('multi', 'enum_query_string_array', enumQueryStringArray)); + queryParams.addAll(_queryParams('multi', 'enum_query_string_array', enumQueryStringArray)); } if (enumQueryString != null) { - queryParams.addAll(_convertParametersForCollectionFormat('', 'enum_query_string', enumQueryString)); + queryParams.addAll(_queryParams('', 'enum_query_string', enumQueryString)); } if (enumQueryInteger != null) { - queryParams.addAll(_convertParametersForCollectionFormat('', 'enum_query_integer', enumQueryInteger)); + queryParams.addAll(_queryParams('', 'enum_query_integer', enumQueryInteger)); } if (enumQueryDouble != null) { - queryParams.addAll(_convertParametersForCollectionFormat('', 'enum_query_double', enumQueryDouble)); + queryParams.addAll(_queryParams('', 'enum_query_double', enumQueryDouble)); } if (enumHeaderStringArray != null) { @@ -859,7 +858,7 @@ class FakeApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -936,13 +935,13 @@ class FakeApi { final headerParams = {}; final formParams = {}; - queryParams.addAll(_convertParametersForCollectionFormat('', 'required_string_group', requiredStringGroup)); - queryParams.addAll(_convertParametersForCollectionFormat('', 'required_int64_group', requiredInt64Group)); + queryParams.addAll(_queryParams('', 'required_string_group', requiredStringGroup)); + queryParams.addAll(_queryParams('', 'required_int64_group', requiredInt64Group)); if (stringGroup != null) { - queryParams.addAll(_convertParametersForCollectionFormat('', 'string_group', stringGroup)); + queryParams.addAll(_queryParams('', 'string_group', stringGroup)); } if (int64Group != null) { - queryParams.addAll(_convertParametersForCollectionFormat('', 'int64_group', int64Group)); + queryParams.addAll(_queryParams('', 'int64_group', int64Group)); } headerParams[r'required_boolean_group'] = parameterToString(requiredBooleanGroup); @@ -961,7 +960,7 @@ class FakeApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -1009,7 +1008,7 @@ class FakeApi { final path = r'/fake/inline-additionalProperties'; // ignore: prefer_final_locals - Object? postBody = requestBody; + Object postBody = requestBody; final queryParams = []; final headerParams = {}; @@ -1026,7 +1025,7 @@ class FakeApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -1083,7 +1082,7 @@ class FakeApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -1134,15 +1133,15 @@ class FakeApi { final headerParams = {}; final formParams = {}; - queryParams.addAll(_convertParametersForCollectionFormat('pipes', 'pipe', pipe)); - queryParams.addAll(_convertParametersForCollectionFormat('csv', 'ioutil', ioutil)); - queryParams.addAll(_convertParametersForCollectionFormat('ssv', 'http', http)); - queryParams.addAll(_convertParametersForCollectionFormat('csv', 'url', url)); - queryParams.addAll(_convertParametersForCollectionFormat('multi', 'context', context)); + queryParams.addAll(_queryParams('pipes', 'pipe', pipe)); + queryParams.addAll(_queryParams('csv', 'ioutil', ioutil)); + queryParams.addAll(_queryParams('ssv', 'http', http)); + queryParams.addAll(_queryParams('csv', 'url', url)); + queryParams.addAll(_queryParams('multi', 'context', context)); if (language != null) { - queryParams.addAll(_convertParametersForCollectionFormat('', 'language', language)); + queryParams.addAll(_queryParams('', 'language', language)); } - queryParams.addAll(_convertParametersForCollectionFormat('', 'allowEmpty', allowEmpty)); + queryParams.addAll(_queryParams('', 'allowEmpty', allowEmpty)); const authNames = []; const contentTypes = []; @@ -1155,7 +1154,7 @@ class FakeApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } 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 1aea15751582..f38494828deb 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -31,7 +30,7 @@ class FakeClassnameTags123Api { final path = r'/fake_classname_test'; // ignore: prefer_final_locals - Object? postBody = modelClient; + Object postBody = modelClient; final queryParams = []; final headerParams = {}; @@ -48,7 +47,7 @@ class FakeClassnameTags123Api { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -69,10 +68,10 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ModelClient',) as ModelClient; } - return Future.value(); + return null; } } 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 c843f5483148..8804a8301bc7 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -29,7 +28,7 @@ class PetApi { final path = r'/pet'; // ignore: prefer_final_locals - Object? postBody = pet; + Object postBody = pet; final queryParams = []; final headerParams = {}; @@ -46,7 +45,7 @@ class PetApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -101,7 +100,7 @@ class PetApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -142,7 +141,7 @@ class PetApi { final headerParams = {}; final formParams = {}; - queryParams.addAll(_convertParametersForCollectionFormat('csv', 'status', status)); + queryParams.addAll(_queryParams('csv', 'status', status)); const authNames = ['petstore_auth']; const contentTypes = []; @@ -155,7 +154,7 @@ class PetApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -176,14 +175,14 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { final responseBody = await _decodeBodyBytes(response); return (await apiClient.deserializeAsync(responseBody, 'List') as List) .cast() - .toList(growable: false); + .toList(); } - return Future?>.value(); + return null; } /// Finds Pets by tags @@ -207,7 +206,7 @@ class PetApi { final headerParams = {}; final formParams = {}; - queryParams.addAll(_convertParametersForCollectionFormat('csv', 'tags', tags)); + queryParams.addAll(_queryParams('csv', 'tags', tags)); const authNames = ['petstore_auth']; const contentTypes = []; @@ -220,7 +219,7 @@ class PetApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -241,14 +240,14 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { final responseBody = await _decodeBodyBytes(response); return (await apiClient.deserializeAsync(responseBody, 'Set') as List) .cast() .toSet(); } - return Future?>.value(); + return null; } /// Find pet by ID @@ -284,7 +283,7 @@ class PetApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -305,11 +304,11 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet; } - return Future.value(); + return null; } /// Update an existing pet @@ -325,7 +324,7 @@ class PetApi { final path = r'/pet'; // ignore: prefer_final_locals - Object? postBody = pet; + Object postBody = pet; final queryParams = []; final headerParams = {}; @@ -342,7 +341,7 @@ class PetApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -403,7 +402,7 @@ class PetApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -478,7 +477,7 @@ class PetApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -503,11 +502,11 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ApiResponse',) as ApiResponse; } - return Future.value(); + return null; } /// uploads an image (required) @@ -561,7 +560,7 @@ class PetApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -586,10 +585,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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ApiResponse',) as ApiResponse; } - return Future.value(); + return null; } } 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 04538db15516..f8f122c6bfda 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -49,7 +48,7 @@ class StoreApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -96,7 +95,7 @@ class StoreApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -112,11 +111,11 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return Map.from(await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map'),); } - return Future?>.value(); + return null; } /// Find purchase order by ID @@ -152,7 +151,7 @@ class StoreApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -173,11 +172,11 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order; } - return Future.value(); + return null; } /// Place an order for a pet @@ -193,7 +192,7 @@ class StoreApi { final path = r'/store/order'; // ignore: prefer_final_locals - Object? postBody = order; + Object postBody = order; final queryParams = []; final headerParams = {}; @@ -210,7 +209,7 @@ class StoreApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -229,10 +228,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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order; } - return Future.value(); + return null; } } 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 a3570017a603..c1b5b30b25db 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -31,7 +30,7 @@ class UserApi { final path = r'/user'; // ignore: prefer_final_locals - Object? postBody = user; + Object postBody = user; final queryParams = []; final headerParams = {}; @@ -48,7 +47,7 @@ class UserApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -81,7 +80,7 @@ class UserApi { final path = r'/user/createWithArray'; // ignore: prefer_final_locals - Object? postBody = user; + Object postBody = user; final queryParams = []; final headerParams = {}; @@ -98,7 +97,7 @@ class UserApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -129,7 +128,7 @@ class UserApi { final path = r'/user/createWithList'; // ignore: prefer_final_locals - Object? postBody = user; + Object postBody = user; final queryParams = []; final headerParams = {}; @@ -146,7 +145,7 @@ class UserApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -197,7 +196,7 @@ class UserApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -248,7 +247,7 @@ class UserApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -267,11 +266,11 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'User',) as User; } - return Future.value(); + return null; } /// Logs user into the system @@ -296,8 +295,8 @@ class UserApi { final headerParams = {}; final formParams = {}; - queryParams.addAll(_convertParametersForCollectionFormat('', 'username', username)); - queryParams.addAll(_convertParametersForCollectionFormat('', 'password', password)); + queryParams.addAll(_queryParams('', 'username', username)); + queryParams.addAll(_queryParams('', 'password', password)); const authNames = []; const contentTypes = []; @@ -310,7 +309,7 @@ class UserApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -332,11 +331,11 @@ 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.statusCode != HttpStatus.noContent) { + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'String',) as String; } - return Future.value(); + return null; } /// Logs out current logged in user session @@ -364,7 +363,7 @@ class UserApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } @@ -396,7 +395,7 @@ class UserApi { .replaceAll('{username}', username); // ignore: prefer_final_locals - Object? postBody = user; + Object postBody = user; final queryParams = []; final headerParams = {}; @@ -413,7 +412,7 @@ class UserApi { postBody, headerParams, formParams, - contentTypes.isEmpty ? null : contentTypes[0], + contentTypes.isEmpty ? null : contentTypes.first, authNames, ); } 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 cfcd2ab8bf8c..a4ae1c93d737 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -11,12 +10,12 @@ part of openapi.api; class ApiClient { -ApiClient({this.basePath = 'http://petstore.swagger.io:80/v2'}) { + ApiClient({this.basePath = 'http://petstore.swagger.io:80/v2'}) { // Setup authentications (key: authentication name, value: authentication). _authentications[r'api_key'] = ApiKeyAuth('header', 'api_key'); _authentications[r'api_key_query'] = ApiKeyAuth('query', 'api_key_query'); - _authentications[r'bearer_test'] = httpBearerAuth ?? HttpBearerAuth(); - _authentications[r'http_basic_test'] = HttpBasicAuth('user', 'password'); + _authentications[r'bearer_test'] = HttpBearerAuth(); + _authentications[r'http_basic_test'] = HttpBasicAuth(); _authentications[r'petstore_auth'] = OAuth(); } @@ -61,31 +60,25 @@ ApiClient({this.basePath = 'http://petstore.swagger.io:80/v2'}) { Object? body, Map headerParams, Map formParams, - String? nullableContentType, + String? contentType, List authNames, ) async { _updateParamsForAuth(authNames, queryParams, headerParams); headerParams.addAll(_defaultHeaderMap); + if (contentType != null) { + headerParams['Content-Type'] = contentType; + } - final urlEncodedQueryParams = queryParams - .map((param) => '$param'); - - final queryString = urlEncodedQueryParams.isNotEmpty - ? '?${urlEncodedQueryParams.join('&')}' - : ''; - + final urlEncodedQueryParams = queryParams.map((param) => '$param'); + final queryString = urlEncodedQueryParams.isNotEmpty ? '?${urlEncodedQueryParams.join('&')}' : ''; final uri = Uri.parse('$basePath$path$queryString'); - if (nullableContentType != null) { - headerParams['Content-Type'] = nullableContentType; - } - try { // Special case for uploading a single file which isn't a 'multipart/form-data'. if ( - body is MultipartFile && (nullableContentType == null || - !nullableContentType.toLowerCase().startsWith('multipart/form-data')) + body is MultipartFile && (contentType == null || + !contentType.toLowerCase().startsWith('multipart/form-data')) ) { final request = StreamedRequest(method, uri); request.headers.addAll(headerParams); @@ -111,7 +104,7 @@ ApiClient({this.basePath = 'http://petstore.swagger.io:80/v2'}) { return Response.fromStream(response); } - final msgBody = nullableContentType == 'application/x-www-form-urlencoded' + final msgBody = contentType == 'application/x-www-form-urlencoded' ? formParams : await serializeAsync(body); final nullableHeaderParams = headerParams.isEmpty ? null : headerParams; @@ -124,27 +117,55 @@ ApiClient({this.basePath = 'http://petstore.swagger.io:80/v2'}) { case 'HEAD': return await _client.head(uri, headers: nullableHeaderParams,); case 'GET': return await _client.get(uri, headers: nullableHeaderParams,); } - } on SocketException catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'Socket operation failed: $method $path', e, trace,); - } on TlsException catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'TLS/SSL communication failed: $method $path', e, trace,); - } on IOException catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'I/O operation failed: $method $path', e, trace,); - } on ClientException catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'HTTP connection failed: $method $path', e, trace,); - } on Exception catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'Exception occurred: $method $path', e, trace,); + } on SocketException catch (error, trace) { + throw ApiException.withInner( + HttpStatus.badRequest, + 'Socket operation failed: $method $path', + error, + trace, + ); + } on TlsException catch (error, trace) { + throw ApiException.withInner( + HttpStatus.badRequest, + 'TLS/SSL communication failed: $method $path', + error, + trace, + ); + } on IOException catch (error, trace) { + throw ApiException.withInner( + HttpStatus.badRequest, + 'I/O operation failed: $method $path', + error, + trace, + ); + } on ClientException catch (error, trace) { + throw ApiException.withInner( + HttpStatus.badRequest, + 'HTTP connection failed: $method $path', + error, + trace, + ); + } on Exception catch (error, trace) { + throw ApiException.withInner( + HttpStatus.badRequest, + 'Exception occurred: $method $path', + error, + trace, + ); } - throw ApiException(HttpStatus.badRequest, 'Invalid HTTP operation: $method $path',); + throw ApiException( + HttpStatus.badRequest, + 'Invalid HTTP operation: $method $path', + ); } - Future deserializeAsync(String json, String targetType, {bool growable = false}) async => + Future deserializeAsync(String json, String targetType, {bool growable = false,}) 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 = false}) { + dynamic deserialize(String json, String targetType, {bool growable = false,}) { // Remove all spaces. Necessary for regular expressions as well. targetType = targetType.replaceAll(' ', ''); // ignore: parameter_assignments @@ -284,24 +305,21 @@ ApiClient({this.basePath = 'http://petstore.swagger.io:80/v2'}) { case 'User': return User.fromJson(value); default: - Match? match; - if (value is List && (match = _regList.firstMatch(targetType)) != null) { - targetType = match![1]!; // ignore: parameter_assignments + dynamic match; + if (value is List && (match = _regList.firstMatch(targetType)?.group(1)) != null) { return value - .map((dynamic v) => _deserialize(v, targetType, growable: growable)) + .map((dynamic v) => _deserialize(v, match, growable: growable,)) .toList(growable: growable); } - if (value is Set && (match = _regSet.firstMatch(targetType)) != null) { - targetType = match![1]!; // ignore: parameter_assignments + if (value is Set && (match = _regSet.firstMatch(targetType)?.group(1)) != null) { return value - .map((dynamic v) => _deserialize(v, targetType, growable: growable)) + .map((dynamic v) => _deserialize(v, match, growable: growable,)) .toSet(); } - if (value is Map && (match = _regMap.firstMatch(targetType)) != null) { - targetType = match![1]!; // ignore: parameter_assignments + if (value is Map && (match = _regMap.firstMatch(targetType)?.group(1)) != null) { return Map.fromIterables( value.keys.cast(), - value.values.map((dynamic v) => _deserialize(v, targetType, growable: growable)), + value.values.map((dynamic v) => _deserialize(v, match, growable: growable,)), ); } } 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 796f7f7ee74e..6ad46aec00fb 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // 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_helper.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_helper.dart index ff718ceadf09..285f35b44059 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -21,32 +20,27 @@ class QueryParam { } // Ported from the Java version. -Iterable _convertParametersForCollectionFormat( - String? collectionFormat, - String? name, - dynamic value, -) { +Iterable _queryParams(String collectionFormat, String name, dynamic value,) { + // Assertions to run in debug mode only. + assert(name.isNotEmpty, 'Parameter cannot be an empty string.'); + final params = []; - // preconditions - if (name != null && name.isNotEmpty && value != null) { - if (value is List) { - if (collectionFormat == 'multi') { - return value.map((dynamic v) => QueryParam(name, parameterToString(v)),); - } + if (value is List) { + if (collectionFormat == 'multi') { + return value.map((dynamic v) => QueryParam(name, parameterToString(v)),); + } - // Default collection format is 'csv'. - if (collectionFormat == null || collectionFormat.isEmpty) { - // ignore: parameter_assignments - collectionFormat = 'csv'; - } + // Default collection format is 'csv'. + if (collectionFormat.isEmpty) { + collectionFormat = 'csv'; // ignore: parameter_assignments + } - final delimiter = _delimiters[collectionFormat] ?? ','; + final delimiter = _delimiters[collectionFormat] ?? ','; - params.add(QueryParam(name, value.map(parameterToString).join(delimiter)),); - } else { - params.add(QueryParam(name, parameterToString(value),)); - } + params.add(QueryParam(name, value.map(parameterToString).join(delimiter),)); + } else if (value != null) { + params.add(QueryParam(name, parameterToString(value))); } return params; @@ -83,10 +77,22 @@ String parameterToString(dynamic value) { Future _decodeBodyBytes(Response response) async { final contentType = response.headers['content-type']; return contentType != null && contentType.toLowerCase().startsWith('application/json') - ? utf8.decode(response.bodyBytes) + ? response.bodyBytes.isEmpty ? '' : 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]) { final dynamic value = map is Map ? map[key] : null; @@ -98,7 +104,7 @@ DateTime? mapDateTime(dynamic map, String key, [String? pattern]) { if (pattern == _dateEpochMarker) { millis = int.tryParse(value); } else { - return DateTime.parse(value); + return DateTime.tryParse(value); } } if (millis != null) { 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 2af78a62bcf0..65c42ea845ed 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // 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/authentication.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/authentication.dart index 49baf7c46a9c..7118eec2fb06 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // 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 4ac4528c27ca..8b8a844771dd 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -11,15 +10,12 @@ part of openapi.api; class HttpBasicAuth implements Authentication { - - HttpBasicAuth(this.username, this.password); - - String username; - String password; + String? username; + String? password; @override void applyToParams(List queryParams, Map headerParams) { - final credentials = '${username}:${password}'; + final credentials = '${username ?? ''}:${password ?? ''}'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; } } 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 07f105666dc0..4e993fbf9a5c 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // 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 66ec4cda0864..8bd8b745acf5 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // 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/model/additional_properties_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/additional_properties_class.dart index ceb0f35cb930..8b2d400877fb 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -17,10 +16,9 @@ class AdditionalPropertiesClass { this.mapOfMapProperty = const {}, }); + Map mapProperty; - Map? mapProperty; - - Map>? mapOfMapProperty; + Map> mapOfMapProperty; @override bool operator ==(Object other) => identical(this, other) || other is AdditionalPropertiesClass && @@ -29,60 +27,90 @@ class AdditionalPropertiesClass { @override int get hashCode => - mapProperty.hashCode + - mapOfMapProperty.hashCode; + // ignore: unnecessary_parenthesis + (mapProperty.hashCode) + + (mapOfMapProperty.hashCode); @override String toString() => 'AdditionalPropertiesClass[mapProperty=$mapProperty, mapOfMapProperty=$mapOfMapProperty]'; Map toJson() { final json = {}; - if (mapProperty != null) { json[r'map_property'] = mapProperty; - } - if (mapOfMapProperty != null) { json[r'map_of_map_property'] = mapOfMapProperty; - } return json; } /// 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(Map json) => AdditionalPropertiesClass( - mapProperty: json[r'map_property'] as Map, - mapOfMapProperty: json[r'map_of_map_property'] as Map>, - ); + static AdditionalPropertiesClass? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "AdditionalPropertiesClass[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "AdditionalPropertiesClass[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return AdditionalPropertiesClass( + mapProperty: mapCastOfType(json, r'map_property') ?? const {}, + mapOfMapProperty: mapCastOfType(json, r'map_of_map_property') ?? const {}, + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => AdditionalPropertiesClass.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = AdditionalPropertiesClass.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = AdditionalPropertiesClass.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = AdditionalPropertiesClass.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of AdditionalPropertiesClass-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = AdditionalPropertiesClass.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = AdditionalPropertiesClass.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 15e84c725f1d..b74c7f1b0bd1 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -17,10 +16,9 @@ class Animal { this.color = 'red', }); - String className; - String? color; + String color; @override bool operator ==(Object other) => identical(this, other) || other is Animal && @@ -29,8 +27,9 @@ class Animal { @override int get hashCode => - className.hashCode + - color.hashCode; + // ignore: unnecessary_parenthesis + (className.hashCode) + + (color.hashCode); @override String toString() => 'Animal[className=$className, color=$color]'; @@ -38,49 +37,81 @@ class Animal { Map toJson() { final json = {}; json[r'className'] = className; - if (color != null) { json[r'color'] = color; - } return json; } /// 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(Map json) => Animal( - className: json[r'className'] as String, - color: json[r'color'] as String, - ); + static Animal? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Animal[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Animal[$key]" has a null value in JSON.'); + }); + return true; + }()); - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => Animal.fromJson(i as Map)).toList(growable: true == growable) - : []; + return Animal( + className: mapValueOfType(json, r'className')!, + color: mapValueOfType(json, r'color') ?? 'red', + ); + } + return null; + } + + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Animal.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = Animal.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Animal.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of Animal-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = Animal.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Animal.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'className', + }; } 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 794799e433a2..d0a510590675 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -18,11 +17,28 @@ class ApiResponse { this.message, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? code; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? type; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? message; @override @@ -33,9 +49,10 @@ class ApiResponse { @override int get hashCode => - code.hashCode + - type.hashCode + - message.hashCode; + // ignore: unnecessary_parenthesis + (code == null ? 0 : code!.hashCode) + + (type == null ? 0 : type!.hashCode) + + (message == null ? 0 : message!.hashCode); @override String toString() => 'ApiResponse[code=$code, type=$type, message=$message]'; @@ -57,41 +74,74 @@ 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(Map json) => ApiResponse( - code: json[r'code'] as int, - type: json[r'type'] as String, - message: json[r'message'] as String, - ); + static ApiResponse? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ApiResponse[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ApiResponse[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ApiResponse( + code: mapValueOfType(json, r'code'), + type: mapValueOfType(json, r'type'), + message: mapValueOfType(json, r'message'), + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => ApiResponse.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ApiResponse.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = ApiResponse.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ApiResponse.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of ApiResponse-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = ApiResponse.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ApiResponse.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 32ae30aaacac..c1a98403c51a 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,8 +15,7 @@ class ArrayOfArrayOfNumberOnly { this.arrayArrayNumber = const [], }); - - List>? arrayArrayNumber; + List> arrayArrayNumber; @override bool operator ==(Object other) => identical(this, other) || other is ArrayOfArrayOfNumberOnly && @@ -25,59 +23,91 @@ class ArrayOfArrayOfNumberOnly { @override int get hashCode => - arrayArrayNumber.hashCode; + // ignore: unnecessary_parenthesis + (arrayArrayNumber.hashCode); @override String toString() => 'ArrayOfArrayOfNumberOnly[arrayArrayNumber=$arrayArrayNumber]'; Map toJson() { final json = {}; - if (arrayArrayNumber != null) { json[r'ArrayArrayNumber'] = arrayArrayNumber; - } return json; } /// 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(Map json) => ArrayOfArrayOfNumberOnly( + static ArrayOfArrayOfNumberOnly? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ArrayOfArrayOfNumberOnly[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ArrayOfArrayOfNumberOnly[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ArrayOfArrayOfNumberOnly( arrayArrayNumber: json[r'ArrayArrayNumber'] is List ? (json[r'ArrayArrayNumber'] as List).map( - (e) => e == null ? [] : (e as List).cast() - ).toList(growable: false) - : [], - ); + (e) => e == null ? null : (e as List).cast() + ).toList() + : null, + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => ArrayOfArrayOfNumberOnly.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ArrayOfArrayOfNumberOnly.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = ArrayOfArrayOfNumberOnly.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ArrayOfArrayOfNumberOnly.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of ArrayOfArrayOfNumberOnly-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = ArrayOfArrayOfNumberOnly.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ArrayOfArrayOfNumberOnly.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 ca95a3ac9a59..5f01774ae31b 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,8 +15,7 @@ class ArrayOfNumberOnly { this.arrayNumber = const [], }); - - List? arrayNumber; + List arrayNumber; @override bool operator ==(Object other) => identical(this, other) || other is ArrayOfNumberOnly && @@ -25,57 +23,89 @@ class ArrayOfNumberOnly { @override int get hashCode => - arrayNumber.hashCode; + // ignore: unnecessary_parenthesis + (arrayNumber.hashCode); @override String toString() => 'ArrayOfNumberOnly[arrayNumber=$arrayNumber]'; Map toJson() { final json = {}; - if (arrayNumber != null) { json[r'ArrayNumber'] = arrayNumber; - } return json; } /// 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(Map json) => ArrayOfNumberOnly( + static ArrayOfNumberOnly? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ArrayOfNumberOnly[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ArrayOfNumberOnly[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ArrayOfNumberOnly( arrayNumber: json[r'ArrayNumber'] is List - ? (json[r'ArrayNumber'] as List).cast() - : [], - ); + ? (json[r'ArrayNumber'] as List).cast() + : const [], + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => ArrayOfNumberOnly.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ArrayOfNumberOnly.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = ArrayOfNumberOnly.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ArrayOfNumberOnly.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of ArrayOfNumberOnly-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = ArrayOfNumberOnly.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ArrayOfNumberOnly.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 2a356c1d4872..d6a63ad1fd12 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -18,12 +17,11 @@ class ArrayTest { this.arrayArrayOfModel = const [], }); + List arrayOfString; - List? arrayOfString; + List> arrayArrayOfInteger; - List>? arrayArrayOfInteger; - - List>? arrayArrayOfModel; + List> arrayArrayOfModel; @override bool operator ==(Object other) => identical(this, other) || other is ArrayTest && @@ -33,75 +31,103 @@ class ArrayTest { @override int get hashCode => - arrayOfString.hashCode + - arrayArrayOfInteger.hashCode + - arrayArrayOfModel.hashCode; + // ignore: unnecessary_parenthesis + (arrayOfString.hashCode) + + (arrayArrayOfInteger.hashCode) + + (arrayArrayOfModel.hashCode); @override String toString() => 'ArrayTest[arrayOfString=$arrayOfString, arrayArrayOfInteger=$arrayArrayOfInteger, arrayArrayOfModel=$arrayArrayOfModel]'; Map toJson() { final json = {}; - if (arrayOfString != null) { json[r'array_of_string'] = arrayOfString; - } - if (arrayArrayOfInteger != null) { json[r'array_array_of_integer'] = arrayArrayOfInteger; - } - if (arrayArrayOfModel != null) { json[r'array_array_of_model'] = arrayArrayOfModel; - } return json; } /// 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(Map json) => ArrayTest( + static ArrayTest? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ArrayTest[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ArrayTest[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ArrayTest( arrayOfString: json[r'array_of_string'] is List - ? (json[r'array_of_string'] as List).cast() - : [], + ? (json[r'array_of_string'] as List).cast() + : const [], arrayArrayOfInteger: json[r'array_array_of_integer'] is List ? (json[r'array_array_of_integer'] as List).map( - (e) => e == null ? [] : (e as List).cast() - ).toList(growable: false) - : [], + (e) => e == null ? null : (e as List).cast() + ).toList() + : null, arrayArrayOfModel: json[r'array_array_of_model'] is List - ? (json[r'array_array_of_model'] as List).map>( - (final j) => ReadOnlyFirst.listFromJson(j) - ).toList(growable: false) - : [], - ); + ? (json[r'array_array_of_model'] as List).map( + ReadOnlyFirst.listFromJson(json[r'array_array_of_model']) + ).toList() + : null, + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => ArrayTest.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ArrayTest.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = ArrayTest.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ArrayTest.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of ArrayTest-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = ArrayTest.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ArrayTest.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 381599788e03..afa1150a769a 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -21,18 +20,53 @@ class Capitalization { this.ATT_NAME, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? smallCamel; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? capitalCamel; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? smallSnake; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? capitalSnake; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? sCAETHFlowPoints; /// Name of the pet + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? ATT_NAME; @override @@ -46,12 +80,13 @@ class Capitalization { @override int get hashCode => - smallCamel.hashCode + - capitalCamel.hashCode + - smallSnake.hashCode + - capitalSnake.hashCode + - sCAETHFlowPoints.hashCode + - ATT_NAME.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); @override String toString() => 'Capitalization[smallCamel=$smallCamel, capitalCamel=$capitalCamel, smallSnake=$smallSnake, capitalSnake=$capitalSnake, sCAETHFlowPoints=$sCAETHFlowPoints, ATT_NAME=$ATT_NAME]'; @@ -82,44 +117,77 @@ 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(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 Capitalization? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Capitalization[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Capitalization[$key]" has a null value in JSON.'); + }); + return true; + }()); + + 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 = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Capitalization.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = Capitalization.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Capitalization.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of Capitalization-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = Capitalization.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Capitalization.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 7203bef0ce94..cdf9f3c06a96 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -18,11 +17,16 @@ class Cat { this.declawed, }); - String className; - String? color; + String color; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// bool? declawed; @override @@ -33,9 +37,10 @@ class Cat { @override int get hashCode => - className.hashCode + - color.hashCode + - declawed.hashCode; + // ignore: unnecessary_parenthesis + (className.hashCode) + + (color.hashCode) + + (declawed == null ? 0 : declawed!.hashCode); @override String toString() => 'Cat[className=$className, color=$color, declawed=$declawed]'; @@ -43,9 +48,7 @@ class Cat { Map toJson() { final json = {}; json[r'className'] = className; - if (color != null) { json[r'color'] = color; - } if (declawed != null) { json[r'declawed'] = declawed; } @@ -55,41 +58,75 @@ 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(Map json) => Cat( - className: json[r'className'] as String, - color: json[r'color'] as String, - declawed: json[r'declawed'] as bool, - ); + static Cat? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Cat[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Cat[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Cat( + className: mapValueOfType(json, r'className')!, + color: mapValueOfType(json, r'color') ?? 'red', + declawed: mapValueOfType(json, r'declawed'), + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => Cat.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Cat.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = Cat.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Cat.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of Cat-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = Cat.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Cat.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'className', + }; } 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 e2ff24127f1e..6f1d094ba43e 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +15,12 @@ class CatAllOf { this.declawed, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// bool? declawed; @override @@ -25,7 +29,8 @@ class CatAllOf { @override int get hashCode => - declawed.hashCode; + // ignore: unnecessary_parenthesis + (declawed == null ? 0 : declawed!.hashCode); @override String toString() => 'CatAllOf[declawed=$declawed]'; @@ -41,39 +46,72 @@ 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(Map json) => CatAllOf( - declawed: json[r'declawed'] as bool, - ); + static CatAllOf? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "CatAllOf[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "CatAllOf[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return CatAllOf( + declawed: mapValueOfType(json, r'declawed'), + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => CatAllOf.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = CatAllOf.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = CatAllOf.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = CatAllOf.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of CatAllOf-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = CatAllOf.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = CatAllOf.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 6f3ab498059b..21b2dc04b724 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -17,7 +16,12 @@ class Category { this.name = 'default-name', }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? id; String name; @@ -29,8 +33,9 @@ class Category { @override int get hashCode => - id.hashCode + - name.hashCode; + // ignore: unnecessary_parenthesis + (id == null ? 0 : id!.hashCode) + + (name.hashCode); @override String toString() => 'Category[id=$id, name=$name]'; @@ -47,40 +52,74 @@ 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(Map json) => Category( - id: json[r'id'] as int, - name: json[r'name'] as String, - ); + static Category? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Category[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Category[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Category( + id: mapValueOfType(json, r'id'), + name: mapValueOfType(json, r'name')!, + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => Category.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Category.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = Category.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Category.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of Category-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = Category.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Category.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'name', + }; } 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 c6228fdd53e2..b48d331d7f65 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +15,12 @@ class ClassModel { this.class_, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? class_; @override @@ -25,7 +29,8 @@ class ClassModel { @override int get hashCode => - class_.hashCode; + // ignore: unnecessary_parenthesis + (class_ == null ? 0 : class_!.hashCode); @override String toString() => 'ClassModel[class_=$class_]'; @@ -41,39 +46,72 @@ 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(Map json) => ClassModel( - class_: json[r'_class'] as String, - ); + static ClassModel? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ClassModel[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ClassModel[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ClassModel( + class_: mapValueOfType(json, r'_class'), + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => ClassModel.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ClassModel.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = ClassModel.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ClassModel.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of ClassModel-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = ClassModel.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ClassModel.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 ec364b6d7480..16c356c56ab7 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +15,12 @@ class DeprecatedObject { this.name, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? name; @override @@ -25,7 +29,8 @@ class DeprecatedObject { @override int get hashCode => - name.hashCode; + // ignore: unnecessary_parenthesis + (name == null ? 0 : name!.hashCode); @override String toString() => 'DeprecatedObject[name=$name]'; @@ -41,39 +46,72 @@ 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(Map json) => DeprecatedObject( - name: json[r'name'] as String, - ); + static DeprecatedObject? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "DeprecatedObject[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "DeprecatedObject[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return DeprecatedObject( + name: mapValueOfType(json, r'name'), + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => DeprecatedObject.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = DeprecatedObject.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = DeprecatedObject.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = DeprecatedObject.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of DeprecatedObject-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = DeprecatedObject.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = DeprecatedObject.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 1398b41bbd6c..89e16680e2f5 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -18,11 +17,16 @@ class Dog { this.breed, }); - String className; - String? color; + String color; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? breed; @override @@ -33,9 +37,10 @@ class Dog { @override int get hashCode => - className.hashCode + - color.hashCode + - breed.hashCode; + // ignore: unnecessary_parenthesis + (className.hashCode) + + (color.hashCode) + + (breed == null ? 0 : breed!.hashCode); @override String toString() => 'Dog[className=$className, color=$color, breed=$breed]'; @@ -43,9 +48,7 @@ class Dog { Map toJson() { final json = {}; json[r'className'] = className; - if (color != null) { json[r'color'] = color; - } if (breed != null) { json[r'breed'] = breed; } @@ -55,41 +58,75 @@ 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(Map json) => Dog( - className: json[r'className'] as String, - color: json[r'color'] as String, - breed: json[r'breed'] as String, - ); + static Dog? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Dog[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Dog[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Dog( + className: mapValueOfType(json, r'className')!, + color: mapValueOfType(json, r'color') ?? 'red', + breed: mapValueOfType(json, r'breed'), + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => Dog.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Dog.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = Dog.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Dog.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of Dog-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = Dog.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Dog.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'className', + }; } 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 bc338a878082..e3ef7f5ee20a 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +15,12 @@ class DogAllOf { this.breed, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? breed; @override @@ -25,7 +29,8 @@ class DogAllOf { @override int get hashCode => - breed.hashCode; + // ignore: unnecessary_parenthesis + (breed == null ? 0 : breed!.hashCode); @override String toString() => 'DogAllOf[breed=$breed]'; @@ -41,39 +46,72 @@ 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(Map json) => DogAllOf( - breed: json[r'breed'] as String, - ); + static DogAllOf? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "DogAllOf[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "DogAllOf[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return DogAllOf( + breed: mapValueOfType(json, r'breed'), + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => DogAllOf.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = DogAllOf.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = DogAllOf.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = DogAllOf.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of DogAllOf-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = DogAllOf.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = DogAllOf.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 da344a268419..58975b438c98 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -17,10 +16,9 @@ class EnumArrays { this.arrayEnum = const [], }); - EnumArraysJustSymbolEnum? justSymbol; - List? arrayEnum; + List arrayEnum; @override bool operator ==(Object other) => identical(this, other) || other is EnumArrays && @@ -29,8 +27,9 @@ class EnumArrays { @override int get hashCode => - justSymbol.hashCode + - arrayEnum.hashCode; + // ignore: unnecessary_parenthesis + (justSymbol == null ? 0 : justSymbol!.hashCode) + + (arrayEnum.hashCode); @override String toString() => 'EnumArrays[justSymbol=$justSymbol, arrayEnum=$arrayEnum]'; @@ -40,50 +39,81 @@ class EnumArrays { if (justSymbol != null) { json[r'just_symbol'] = justSymbol; } - if (arrayEnum != null) { json[r'array_enum'] = arrayEnum; - } return json; } /// 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(Map json) => EnumArrays( + static EnumArrays? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "EnumArrays[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "EnumArrays[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return EnumArrays( justSymbol: EnumArraysJustSymbolEnum.fromJson(json[r'just_symbol']), - arrayEnum: EnumArraysArrayEnumEnum.listFromJson(json[r'array_enum']), - ); + arrayEnum: EnumArraysArrayEnumEnum.listFromJson(json[r'array_enum']) ?? const [], + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => EnumArrays.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = EnumArrays.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = EnumArrays.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = EnumArrays.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of EnumArrays-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = EnumArrays.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = EnumArrays.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } @@ -92,12 +122,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 toString() => value; - String? toJson() => value; + String toJson() => value; static const greaterThanEqual = EnumArraysJustSymbolEnum._(r'>='); static const dollar = EnumArraysJustSymbolEnum._(r'$'); @@ -108,13 +138,20 @@ class EnumArraysJustSymbolEnum { dollar, ]; - static EnumArraysJustSymbolEnum fromJson(dynamic value) => - EnumArraysJustSymbolEnumTypeTransformer().decode(value); - - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => EnumArraysJustSymbolEnum.fromJson(i as Map)).toList(growable: true == growable) - : []; + static EnumArraysJustSymbolEnum? fromJson(dynamic value) => EnumArraysJustSymbolEnumTypeTransformer().decode(value); + + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = EnumArraysJustSymbolEnum.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } } /// Transformation class that can [encode] an instance of [EnumArraysJustSymbolEnum] to String, @@ -124,19 +161,28 @@ 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 the [dynamic value][data] cannot be decoded successfully, then an [UnimplementedError] is thrown. - EnumArraysJustSymbolEnum decode(dynamic data) { - if (data == r'>=') { - return EnumArraysJustSymbolEnum.greaterThanEqual; - } - if (data == r'$') { - return EnumArraysJustSymbolEnum.dollar; + /// 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 = true}) { + if (data != null) { + switch (data.toString()) { + case r'>=': return EnumArraysJustSymbolEnum.greaterThanEqual; + case r'$': return EnumArraysJustSymbolEnum.dollar; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } } - throw ArgumentError('Unknown enum value to decode: $data'); + return null; } /// Singleton [EnumArraysJustSymbolEnumTypeTransformer] instance. @@ -150,12 +196,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 toString() => value; - String? toJson() => value; + String toJson() => value; static const fish = EnumArraysArrayEnumEnum._(r'fish'); static const crab = EnumArraysArrayEnumEnum._(r'crab'); @@ -166,13 +212,20 @@ class EnumArraysArrayEnumEnum { crab, ]; - static EnumArraysArrayEnumEnum fromJson(dynamic value) => - EnumArraysArrayEnumEnumTypeTransformer().decode(value); - - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => EnumArraysArrayEnumEnum.fromJson(i as Map)).toList(growable: true == growable) - : []; + static EnumArraysArrayEnumEnum? fromJson(dynamic value) => EnumArraysArrayEnumEnumTypeTransformer().decode(value); + + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = EnumArraysArrayEnumEnum.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } } /// Transformation class that can [encode] an instance of [EnumArraysArrayEnumEnum] to String, @@ -182,19 +235,28 @@ 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 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; + /// 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 = true}) { + if (data != null) { + switch (data.toString()) { + case r'fish': return EnumArraysArrayEnumEnum.fish; + case r'crab': return EnumArraysArrayEnumEnum.crab; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } } - throw ArgumentError('Unknown enum value to decode: $data'); + return null; } /// Singleton [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 3b72c0674936..1a698721c688 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,12 +15,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 toString() => value; - String? toJson() => value; + String toJson() => value; static const abc = EnumClass._(r'_abc'); static const efg = EnumClass._(r'-efg'); @@ -34,13 +33,20 @@ class EnumClass { leftParenthesisXyzRightParenthesis, ]; - static EnumClass fromJson(dynamic value) => - EnumClassTypeTransformer().decode(value); - - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => EnumClass.fromJson(i as Map)).toList(growable: true == growable) - : []; + static EnumClass? fromJson(dynamic value) => EnumClassTypeTransformer().decode(value); + + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = EnumClass.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } } /// Transformation class that can [encode] an instance of [EnumClass] to String, @@ -50,23 +56,29 @@ 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 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; - } - if (data == r'(xyz)') { - return EnumClass.leftParenthesisXyzRightParenthesis; + /// 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 = true}) { + 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) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } } - throw ArgumentError('Unknown enum value to decode: $data'); - + return null; } /// Singleton [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 d5583315294a..cf3a4828c8fd 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -23,7 +22,6 @@ class EnumTest { this.outerEnumIntegerDefaultValue, }); - EnumTestEnumStringEnum? enumString; EnumTestEnumStringRequiredEnum enumStringRequired; @@ -34,10 +32,28 @@ class EnumTest { OuterEnum? outerEnum; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// OuterEnumInteger? outerEnumInteger; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// OuterEnumDefaultValue? outerEnumDefaultValue; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue; @override @@ -53,14 +69,15 @@ class EnumTest { @override int get hashCode => - enumString.hashCode + - enumStringRequired.hashCode + - enumInteger.hashCode + - enumNumber.hashCode + - outerEnum.hashCode + - outerEnumInteger.hashCode + - outerEnumDefaultValue.hashCode + - outerEnumIntegerDefaultValue.hashCode; + // ignore: unnecessary_parenthesis + (enumString == null ? 0 : enumString!.hashCode) + + (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); @override String toString() => 'EnumTest[enumString=$enumString, enumStringRequired=$enumStringRequired, enumInteger=$enumInteger, enumNumber=$enumNumber, outerEnum=$outerEnum, outerEnumInteger=$outerEnumInteger, outerEnumDefaultValue=$outerEnumDefaultValue, outerEnumIntegerDefaultValue=$outerEnumIntegerDefaultValue]'; @@ -95,47 +112,81 @@ 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(Map json) => EnumTest( + static EnumTest? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "EnumTest[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "EnumTest[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return EnumTest( enumString: EnumTestEnumStringEnum.fromJson(json[r'enum_string']), - enumStringRequired: EnumTestEnumStringRequiredEnum.fromJson(json[r'enum_string_required']), + enumStringRequired: EnumTestEnumStringRequiredEnum.fromJson(json[r'enum_string_required'])!, enumInteger: EnumTestEnumIntegerEnum.fromJson(json[r'enum_integer']), enumNumber: EnumTestEnumNumberEnum.fromJson(json[r'enum_number']), outerEnum: OuterEnum.fromJson(json[r'outerEnum']), outerEnumInteger: OuterEnumInteger.fromJson(json[r'outerEnumInteger']), outerEnumDefaultValue: OuterEnumDefaultValue.fromJson(json[r'outerEnumDefaultValue']), outerEnumIntegerDefaultValue: OuterEnumIntegerDefaultValue.fromJson(json[r'outerEnumIntegerDefaultValue']), - ); + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => EnumTest.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = EnumTest.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = EnumTest.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = EnumTest.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of EnumTest-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = EnumTest.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = EnumTest.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'enum_string_required', + }; } @@ -144,12 +195,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 toString() => value; - String? toJson() => value; + String toJson() => value; static const UPPER = EnumTestEnumStringEnum._(r'UPPER'); static const lower = EnumTestEnumStringEnum._(r'lower'); @@ -162,13 +213,20 @@ class EnumTestEnumStringEnum { empty, ]; - static EnumTestEnumStringEnum fromJson(dynamic value) => - EnumTestEnumStringEnumTypeTransformer().decode(value); - - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => EnumTestEnumStringEnum.fromJson(i as Map)).toList(growable: true == growable) - : []; + static EnumTestEnumStringEnum? fromJson(dynamic value) => EnumTestEnumStringEnumTypeTransformer().decode(value); + + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = EnumTestEnumStringEnum.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } } /// Transformation class that can [encode] an instance of [EnumTestEnumStringEnum] to String, @@ -178,22 +236,29 @@ 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 the [dynamic value][data] cannot be decoded successfully, then an [UnimplementedError] is thrown. - EnumTestEnumStringEnum decode(dynamic data) { - if (data == r'UPPER') { - return EnumTestEnumStringEnum.UPPER; - } - if (data == r'lower') { - return EnumTestEnumStringEnum.lower; - } - if (data == r'') { - return EnumTestEnumStringEnum.empty; + /// 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 = true}) { + 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) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } } - throw ArgumentError('Unknown enum value to decode: $data'); + return null; } /// Singleton [EnumTestEnumStringEnumTypeTransformer] instance. @@ -207,12 +272,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 toString() => value; - String? toJson() => value; + String toJson() => value; static const UPPER = EnumTestEnumStringRequiredEnum._(r'UPPER'); static const lower = EnumTestEnumStringRequiredEnum._(r'lower'); @@ -225,13 +290,20 @@ class EnumTestEnumStringRequiredEnum { empty, ]; - static EnumTestEnumStringRequiredEnum fromJson(dynamic value) => - EnumTestEnumStringRequiredEnumTypeTransformer().decode(value); - - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => EnumTestEnumStringRequiredEnum.fromJson(i as Map)).toList(growable: true == growable) - : []; + static EnumTestEnumStringRequiredEnum? fromJson(dynamic value) => EnumTestEnumStringRequiredEnumTypeTransformer().decode(value); + + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = EnumTestEnumStringRequiredEnum.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } } /// Transformation class that can [encode] an instance of [EnumTestEnumStringRequiredEnum] to String, @@ -241,22 +313,29 @@ 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 the [dynamic value][data] cannot be decoded successfully, then an [UnimplementedError] is thrown. - EnumTestEnumStringRequiredEnum decode(dynamic data) { - if (data == r'UPPER') { - return EnumTestEnumStringRequiredEnum.UPPER; - } - if (data == r'lower') { - return EnumTestEnumStringRequiredEnum.lower; - } - if (data == r'') { - return EnumTestEnumStringRequiredEnum.empty; + /// 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 = true}) { + 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) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } } - throw ArgumentError('Unknown enum value to decode: $data'); + return null; } /// Singleton [EnumTestEnumStringRequiredEnumTypeTransformer] instance. @@ -270,12 +349,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(); + String toString() => value.toString(); - int? toJson() => value; + int toJson() => value; static const number1 = EnumTestEnumIntegerEnum._(1); static const numberNegative1 = EnumTestEnumIntegerEnum._(-1); @@ -286,13 +365,20 @@ class EnumTestEnumIntegerEnum { numberNegative1, ]; - static EnumTestEnumIntegerEnum fromJson(dynamic value) => - EnumTestEnumIntegerEnumTypeTransformer().decode(value); - - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => EnumTestEnumIntegerEnum.fromJson(i as Map)).toList(growable: true == growable) - : []; + static EnumTestEnumIntegerEnum? fromJson(dynamic value) => EnumTestEnumIntegerEnumTypeTransformer().decode(value); + + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = EnumTestEnumIntegerEnum.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } } /// Transformation class that can [encode] an instance of [EnumTestEnumIntegerEnum] to int, @@ -302,19 +388,28 @@ 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 the [dynamic value][data] cannot be decoded successfully, then an [UnimplementedError] is thrown. - EnumTestEnumIntegerEnum decode(dynamic data) { - if (data == 1) { - return EnumTestEnumIntegerEnum.number1; - } - if (data == -1) { - return EnumTestEnumIntegerEnum.numberNegative1; + /// 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 = true}) { + if (data != null) { + switch (data.toString()) { + case 1: return EnumTestEnumIntegerEnum.number1; + case -1: return EnumTestEnumIntegerEnum.numberNegative1; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } } - throw ArgumentError('Unknown enum value to decode: $data'); + return null; } /// Singleton [EnumTestEnumIntegerEnumTypeTransformer] instance. @@ -328,12 +423,12 @@ 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(); + String toString() => value.toString(); - double? toJson() => value; + double toJson() => value; static const number1Period1 = EnumTestEnumNumberEnum._('1.1'); static const numberNegative1Period2 = EnumTestEnumNumberEnum._('-1.2'); @@ -344,13 +439,20 @@ class EnumTestEnumNumberEnum { numberNegative1Period2, ]; - static EnumTestEnumNumberEnum fromJson(dynamic value) => - EnumTestEnumNumberEnumTypeTransformer().decode(value); - - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => EnumTestEnumNumberEnum.fromJson(i as Map)).toList(growable: true == growable) - : []; + static EnumTestEnumNumberEnum? fromJson(dynamic value) => EnumTestEnumNumberEnumTypeTransformer().decode(value); + + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = EnumTestEnumNumberEnum.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } } /// Transformation class that can [encode] an instance of [EnumTestEnumNumberEnum] to double, @@ -360,19 +462,28 @@ 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 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; + /// 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 = true}) { + if (data != null) { + switch (data.toString()) { + case '1.1': return EnumTestEnumNumberEnum.number1Period1; + case '-1.2': return EnumTestEnumNumberEnum.numberNegative1Period2; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } } - throw ArgumentError('Unknown enum value to decode: $data'); + return null; } /// Singleton [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 5406ef54b4ec..2419ab26e619 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -17,10 +16,15 @@ class FileSchemaTestClass { this.files = const [], }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// ModelFile? file; - List? files; + List files; @override bool operator ==(Object other) => identical(this, other) || other is FileSchemaTestClass && @@ -29,8 +33,9 @@ class FileSchemaTestClass { @override int get hashCode => - file.hashCode + - files.hashCode; + // ignore: unnecessary_parenthesis + (file == null ? 0 : file!.hashCode) + + (files.hashCode); @override String toString() => 'FileSchemaTestClass[file=$file, files=$files]'; @@ -40,49 +45,80 @@ class FileSchemaTestClass { if (file != null) { json[r'file'] = file; } - if (files != null) { json[r'files'] = files; - } return json; } /// 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(Map json) => FileSchemaTestClass( + static FileSchemaTestClass? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "FileSchemaTestClass[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "FileSchemaTestClass[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return FileSchemaTestClass( file: ModelFile.fromJson(json[r'file']), - files: ModelFile.listFromJson(json[r'files']), - ); + files: ModelFile.listFromJson(json[r'files']) ?? const [], + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => FileSchemaTestClass.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = FileSchemaTestClass.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = FileSchemaTestClass.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = FileSchemaTestClass.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of FileSchemaTestClass-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = FileSchemaTestClass.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = FileSchemaTestClass.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 0cea19939846..cfd55f075792 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,8 +15,7 @@ class Foo { this.bar = 'bar', }); - - String? bar; + String bar; @override bool operator ==(Object other) => identical(this, other) || other is Foo && @@ -25,55 +23,87 @@ class Foo { @override int get hashCode => - bar.hashCode; + // ignore: unnecessary_parenthesis + (bar.hashCode); @override String toString() => 'Foo[bar=$bar]'; Map toJson() { final json = {}; - if (bar != null) { json[r'bar'] = bar; - } return json; } /// 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(Map json) => Foo( - bar: json[r'bar'] as String, - ); + static Foo? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Foo[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Foo[$key]" has a null value in JSON.'); + }); + return true; + }()); - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => Foo.fromJson(i as Map)).toList(growable: true == growable) - : []; + return Foo( + bar: mapValueOfType(json, r'bar') ?? 'bar', + ); + } + return null; + } + + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Foo.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = Foo.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Foo.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of Foo-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = Foo.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Foo.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 cae3f0f39fcd..3f1e22bbedd8 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -31,49 +30,120 @@ class FormatTest { this.patternWithDigitsAndDelimiter, }); - - // minimum: 10 - // maximum: 100 + /// Minimum value: 10 + /// Maximum value: 100 + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? integer; - // minimum: 20 - // maximum: 200 + /// Minimum value: 20 + /// Maximum value: 200 + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? int32; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? int64; - // minimum: 32.1 - // maximum: 543.2 + /// Minimum value: 32.1 + /// Maximum value: 543.2 num number; - // minimum: 54.3 - // maximum: 987.6 + /// Minimum value: 54.3 + /// Maximum value: 987.6 + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// double? float; - // minimum: 67.8 - // maximum: 123.4 + /// Minimum value: 67.8 + /// Maximum value: 123.4 + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// double? double_; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// double? decimal; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? string; String byte; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// MultipartFile? binary; DateTime date; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// DateTime? dateTime; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? uuid; String password; /// A string that is a 10 digit number. Can have leading zeros. + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? patternWithDigits; /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? patternWithDigitsAndDelimiter; @override @@ -97,22 +167,23 @@ class FormatTest { @override int get 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; + // ignore: unnecessary_parenthesis + (integer == null ? 0 : integer!.hashCode) + + (int32 == null ? 0 : int32!.hashCode) + + (int64 == null ? 0 : int64!.hashCode) + + (number.hashCode) + + (float == null ? 0 : float!.hashCode) + + (double_ == null ? 0 : double_!.hashCode) + + (decimal == null ? 0 : decimal!.hashCode) + + (string == null ? 0 : string!.hashCode) + + (byte.hashCode) + + (binary == null ? 0 : binary!.hashCode) + + (date.hashCode) + + (dateTime == null ? 0 : dateTime!.hashCode) + + (uuid == null ? 0 : uuid!.hashCode) + + (password.hashCode) + + (patternWithDigits == null ? 0 : patternWithDigits!.hashCode) + + (patternWithDigitsAndDelimiter == null ? 0 : 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]'; @@ -165,54 +236,93 @@ 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(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, + static FormatTest? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "FormatTest[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "FormatTest[$key]" has a null value in JSON.'); + }); + return true; + }()); + + 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')!, binary: null, // No support for decoding binary content from JSON date: mapDateTime(json, r'date', '')!, - dateTime: mapDateTime(json, r'dateTime', '')!, - 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(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => FormatTest.fromJson(i as Map)).toList(growable: true == growable) - : []; + 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; + } + + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = FormatTest.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = FormatTest.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = FormatTest.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of FormatTest-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = FormatTest.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = FormatTest.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'number', + 'byte', + 'date', + 'password', + }; } 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 c931608c5142..155783429759 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -17,9 +16,20 @@ class HasOnlyReadOnly { this.foo, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? bar; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? foo; @override @@ -29,8 +39,9 @@ class HasOnlyReadOnly { @override int get hashCode => - bar.hashCode + - foo.hashCode; + // ignore: unnecessary_parenthesis + (bar == null ? 0 : bar!.hashCode) + + (foo == null ? 0 : foo!.hashCode); @override String toString() => 'HasOnlyReadOnly[bar=$bar, foo=$foo]'; @@ -49,40 +60,73 @@ 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(Map json) => HasOnlyReadOnly( - bar: json[r'bar'] as String, - foo: json[r'foo'] as String, - ); + static HasOnlyReadOnly? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "HasOnlyReadOnly[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "HasOnlyReadOnly[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return HasOnlyReadOnly( + bar: mapValueOfType(json, r'bar'), + foo: mapValueOfType(json, r'foo'), + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => HasOnlyReadOnly.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = HasOnlyReadOnly.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = HasOnlyReadOnly.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = HasOnlyReadOnly.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of HasOnlyReadOnly-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = HasOnlyReadOnly.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = HasOnlyReadOnly.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 9bd6a6bf1315..bfb8613328bf 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +15,6 @@ class HealthCheckResult { this.nullableMessage, }); - String? nullableMessage; @override @@ -25,7 +23,8 @@ class HealthCheckResult { @override int get hashCode => - nullableMessage.hashCode; + // ignore: unnecessary_parenthesis + (nullableMessage == null ? 0 : nullableMessage!.hashCode); @override String toString() => 'HealthCheckResult[nullableMessage=$nullableMessage]'; @@ -41,39 +40,72 @@ 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(Map json) => HealthCheckResult( - nullableMessage: json[r'NullableMessage'] as String, - ); + static HealthCheckResult? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "HealthCheckResult[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "HealthCheckResult[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return HealthCheckResult( + nullableMessage: mapValueOfType(json, r'NullableMessage'), + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => HealthCheckResult.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = HealthCheckResult.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = HealthCheckResult.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = HealthCheckResult.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of HealthCheckResult-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = HealthCheckResult.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = HealthCheckResult.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 5cadde36e695..bc59ba52bf32 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +15,12 @@ class InlineResponseDefault { this.string, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// Foo? string; @override @@ -25,7 +29,8 @@ class InlineResponseDefault { @override int get hashCode => - string.hashCode; + // ignore: unnecessary_parenthesis + (string == null ? 0 : string!.hashCode); @override String toString() => 'InlineResponseDefault[string=$string]'; @@ -41,39 +46,72 @@ 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(Map json) => InlineResponseDefault( + static InlineResponseDefault? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "InlineResponseDefault[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "InlineResponseDefault[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return InlineResponseDefault( string: Foo.fromJson(json[r'string']), - ); + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => InlineResponseDefault.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = InlineResponseDefault.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = InlineResponseDefault.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = InlineResponseDefault.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of InlineResponseDefault-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = InlineResponseDefault.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = InlineResponseDefault.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 428a03fae1e3..47108988485c 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -19,14 +18,13 @@ class MapTest { this.indirectMap = const {}, }); + Map> mapMapOfString; - Map>? mapMapOfString; + Map mapOfEnumString; - Map? mapOfEnumString; + Map directMap; - Map? directMap; - - Map? indirectMap; + Map indirectMap; @override bool operator ==(Object other) => identical(this, other) || other is MapTest && @@ -37,71 +35,97 @@ class MapTest { @override int get hashCode => - mapMapOfString.hashCode + - mapOfEnumString.hashCode + - directMap.hashCode + - indirectMap.hashCode; + // ignore: unnecessary_parenthesis + (mapMapOfString.hashCode) + + (mapOfEnumString.hashCode) + + (directMap.hashCode) + + (indirectMap.hashCode); @override String toString() => 'MapTest[mapMapOfString=$mapMapOfString, mapOfEnumString=$mapOfEnumString, directMap=$directMap, indirectMap=$indirectMap]'; Map toJson() { final json = {}; - if (mapMapOfString != null) { json[r'map_map_of_string'] = mapMapOfString; - } - if (mapOfEnumString != null) { json[r'map_of_enum_string'] = mapOfEnumString; - } - if (directMap != null) { json[r'direct_map'] = directMap; - } - if (indirectMap != null) { json[r'indirect_map'] = indirectMap; - } return json; } /// 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(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 MapTest? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "MapTest[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "MapTest[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return MapTest( + mapMapOfString: mapCastOfType(json, r'map_map_of_string') ?? const {}, + mapOfEnumString: mapCastOfType(json, r'map_of_enum_string') ?? const {}, + directMap: mapCastOfType(json, r'direct_map') ?? const {}, + indirectMap: mapCastOfType(json, r'indirect_map') ?? const {}, + ); + } + return null; + } + + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = MapTest.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = MapTest.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = MapTest.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of MapTest-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = MapTest.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = MapTest.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } @@ -110,12 +134,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 toString() => value; - String? toJson() => value; + String toJson() => value; static const UPPER = MapTestMapOfEnumStringEnum._(r'UPPER'); static const lower = MapTestMapOfEnumStringEnum._(r'lower'); @@ -126,13 +150,20 @@ class MapTestMapOfEnumStringEnum { lower, ]; - static MapTestMapOfEnumStringEnum fromJson(dynamic value) => - MapTestMapOfEnumStringEnumTypeTransformer().decode(value); - - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => MapTestMapOfEnumStringEnum.fromJson(i as Map)).toList(growable: true == growable) - : []; + static MapTestMapOfEnumStringEnum? fromJson(dynamic value) => MapTestMapOfEnumStringEnumTypeTransformer().decode(value); + + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = MapTestMapOfEnumStringEnum.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } } /// Transformation class that can [encode] an instance of [MapTestMapOfEnumStringEnum] to String, @@ -142,19 +173,28 @@ 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 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; + /// 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 = true}) { + if (data != null) { + switch (data.toString()) { + case r'UPPER': return MapTestMapOfEnumStringEnum.UPPER; + case r'lower': return MapTestMapOfEnumStringEnum.lower; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } } - throw ArgumentError('Unknown enum value to decode: $data'); + return null; } /// Singleton [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 d487bd73cdda..d90d9adcf810 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -18,12 +17,23 @@ class MixedPropertiesAndAdditionalPropertiesClass { this.map = const {}, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? uuid; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// DateTime? dateTime; - Map? map; + Map map; @override bool operator ==(Object other) => identical(this, other) || other is MixedPropertiesAndAdditionalPropertiesClass && @@ -33,9 +43,10 @@ class MixedPropertiesAndAdditionalPropertiesClass { @override int get hashCode => - uuid.hashCode + - dateTime.hashCode + - map.hashCode; + // ignore: unnecessary_parenthesis + (uuid == null ? 0 : uuid!.hashCode) + + (dateTime == null ? 0 : dateTime!.hashCode) + + (map.hashCode); @override String toString() => 'MixedPropertiesAndAdditionalPropertiesClass[uuid=$uuid, dateTime=$dateTime, map=$map]'; @@ -48,50 +59,81 @@ class MixedPropertiesAndAdditionalPropertiesClass { if (dateTime != null) { json[r'dateTime'] = dateTime!.toUtc().toIso8601String(); } - if (map != null) { json[r'map'] = map; - } return json; } /// 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(Map json) => MixedPropertiesAndAdditionalPropertiesClass( - uuid: json[r'uuid'] as String, - dateTime: mapDateTime(json, r'dateTime', '')!, - map: json[r'map'] as Map, - ); + static MixedPropertiesAndAdditionalPropertiesClass? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "MixedPropertiesAndAdditionalPropertiesClass[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "MixedPropertiesAndAdditionalPropertiesClass[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return MixedPropertiesAndAdditionalPropertiesClass( + uuid: mapValueOfType(json, r'uuid'), + dateTime: mapDateTime(json, r'dateTime', ''), + map: mapValueOfType>(json, r'map') ?? const {}, + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => MixedPropertiesAndAdditionalPropertiesClass.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = MixedPropertiesAndAdditionalPropertiesClass.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = MixedPropertiesAndAdditionalPropertiesClass.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = MixedPropertiesAndAdditionalPropertiesClass.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of MixedPropertiesAndAdditionalPropertiesClass-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = MixedPropertiesAndAdditionalPropertiesClass.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = MixedPropertiesAndAdditionalPropertiesClass.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 e514e69f6619..03e079eec9e0 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -17,9 +16,20 @@ class Model200Response { this.class_, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? name; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? class_; @override @@ -29,8 +39,9 @@ class Model200Response { @override int get hashCode => - name.hashCode + - class_.hashCode; + // ignore: unnecessary_parenthesis + (name == null ? 0 : name!.hashCode) + + (class_ == null ? 0 : class_!.hashCode); @override String toString() => 'Model200Response[name=$name, class_=$class_]'; @@ -49,40 +60,73 @@ 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(Map json) => Model200Response( - name: json[r'name'] as int, - class_: json[r'class'] as String, - ); + static Model200Response? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Model200Response[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Model200Response[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Model200Response( + name: mapValueOfType(json, r'name'), + class_: mapValueOfType(json, r'class'), + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => Model200Response.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Model200Response.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = Model200Response.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Model200Response.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of Model200Response-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = Model200Response.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Model200Response.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 a5a7c91c422b..9c374c36a9d5 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +15,12 @@ class ModelClient { this.client, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? client; @override @@ -25,7 +29,8 @@ class ModelClient { @override int get hashCode => - client.hashCode; + // ignore: unnecessary_parenthesis + (client == null ? 0 : client!.hashCode); @override String toString() => 'ModelClient[client=$client]'; @@ -41,39 +46,72 @@ 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(Map json) => ModelClient( - client: json[r'client'] as String, - ); + static ModelClient? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ModelClient[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ModelClient[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ModelClient( + client: mapValueOfType(json, r'client'), + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => ModelClient.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ModelClient.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = ModelClient.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ModelClient.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of ModelClient-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = ModelClient.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ModelClient.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 37437e1bbaff..2578c0a06f93 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,8 +15,13 @@ class ModelFile { this.sourceURI, }); - /// Test capitalization + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? sourceURI; @override @@ -26,7 +30,8 @@ class ModelFile { @override int get hashCode => - sourceURI.hashCode; + // ignore: unnecessary_parenthesis + (sourceURI == null ? 0 : sourceURI!.hashCode); @override String toString() => 'ModelFile[sourceURI=$sourceURI]'; @@ -42,39 +47,72 @@ 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(Map json) => ModelFile( - sourceURI: json[r'sourceURI'] as String, - ); + static ModelFile? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ModelFile[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ModelFile[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ModelFile( + sourceURI: mapValueOfType(json, r'sourceURI'), + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => ModelFile.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ModelFile.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = ModelFile.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ModelFile.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of ModelFile-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = ModelFile.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ModelFile.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 f1c1b8a57990..018054424d0c 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +15,12 @@ class ModelList { this.n123list, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? n123list; @override @@ -25,7 +29,8 @@ class ModelList { @override int get hashCode => - n123list.hashCode; + // ignore: unnecessary_parenthesis + (n123list == null ? 0 : n123list!.hashCode); @override String toString() => 'ModelList[n123list=$n123list]'; @@ -41,39 +46,72 @@ 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(Map json) => ModelList( - n123list: json[r'123-list'] as String, - ); + static ModelList? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ModelList[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ModelList[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ModelList( + n123list: mapValueOfType(json, r'123-list'), + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => ModelList.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ModelList.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = ModelList.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ModelList.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of ModelList-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = ModelList.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ModelList.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 aefd97aa3bef..ea8d243da5c0 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +15,12 @@ class ModelReturn { this.return_, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? return_; @override @@ -25,7 +29,8 @@ class ModelReturn { @override int get hashCode => - return_.hashCode; + // ignore: unnecessary_parenthesis + (return_ == null ? 0 : return_!.hashCode); @override String toString() => 'ModelReturn[return_=$return_]'; @@ -41,39 +46,72 @@ 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(Map json) => ModelReturn( - return_: json[r'return'] as int, - ); + static ModelReturn? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ModelReturn[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ModelReturn[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ModelReturn( + return_: mapValueOfType(json, r'return'), + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => ModelReturn.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ModelReturn.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = ModelReturn.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ModelReturn.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of ModelReturn-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = ModelReturn.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ModelReturn.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 669e8293df87..517fec3bb094 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -19,13 +18,30 @@ class Name { this.n123number, }); - int name; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? snakeCase; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? property; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? n123number; @override @@ -37,10 +53,11 @@ class Name { @override int get hashCode => - name.hashCode + - snakeCase.hashCode + - property.hashCode + - n123number.hashCode; + // ignore: unnecessary_parenthesis + (name.hashCode) + + (snakeCase == null ? 0 : snakeCase!.hashCode) + + (property == null ? 0 : property!.hashCode) + + (n123number == null ? 0 : n123number!.hashCode); @override String toString() => 'Name[name=$name, snakeCase=$snakeCase, property=$property, n123number=$n123number]'; @@ -63,42 +80,76 @@ 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(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 Name? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Name[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Name[$key]" has a null value in JSON.'); + }); + return true; + }()); + + 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 = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Name.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = Name.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Name.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of Name-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = Name.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Name.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'name', + }; } 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 a18a1debf5e8..9b532fea31e4 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -19,15 +18,14 @@ class NullableClass { this.stringProp, this.dateProp, this.datetimeProp, - this.arrayNullableProp, - this.arrayAndItemsNullableProp, + this.arrayNullableProp = const [], + this.arrayAndItemsNullableProp = const [], this.arrayItemsNullable = const [], - this.objectNullableProp, - this.objectAndItemsNullableProp, + this.objectNullableProp = const {}, + this.objectAndItemsNullableProp = const {}, this.objectItemsNullable = const {}, }); - int? integerProp; num? numberProp; @@ -44,13 +42,13 @@ class NullableClass { List? arrayAndItemsNullableProp; - List? arrayItemsNullable; + List arrayItemsNullable; Map? objectNullableProp; Map? objectAndItemsNullableProp; - Map? objectItemsNullable; + Map objectItemsNullable; @override bool operator ==(Object other) => identical(this, other) || other is NullableClass && @@ -69,18 +67,19 @@ class NullableClass { @override int get 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; + // 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.hashCode) + + (objectNullableProp == null ? 0 : objectNullableProp!.hashCode) + + (objectAndItemsNullableProp == null ? 0 : 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]'; @@ -111,68 +110,99 @@ class NullableClass { if (arrayAndItemsNullableProp != null) { json[r'array_and_items_nullable_prop'] = arrayAndItemsNullableProp; } - if (arrayItemsNullable != null) { json[r'array_items_nullable'] = arrayItemsNullable; - } if (objectNullableProp != null) { json[r'object_nullable_prop'] = objectNullableProp; } if (objectAndItemsNullableProp != null) { json[r'object_and_items_nullable_prop'] = objectAndItemsNullableProp; } - if (objectItemsNullable != null) { json[r'object_items_nullable'] = objectItemsNullable; - } return json; } /// 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(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, + static NullableClass? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "NullableClass[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "NullableClass[$key]" has a null value in JSON.'); + }); + return true; + }()); + + 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'), 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: 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) - : []; + arrayNullableProp: Object.listFromJson(json[r'array_nullable_prop']) ?? const [], + arrayAndItemsNullableProp: Object.listFromJson(json[r'array_and_items_nullable_prop']) ?? const [], + arrayItemsNullable: Object.listFromJson(json[r'array_items_nullable']) ?? const [], + objectNullableProp: mapValueOfType>(json, r'object_nullable_prop') ?? const {}, + objectAndItemsNullableProp: mapValueOfType>(json, r'object_and_items_nullable_prop') ?? const {}, + objectItemsNullable: mapValueOfType>(json, r'object_items_nullable') ?? const {}, + ); + } + return null; + } + + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = NullableClass.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = NullableClass.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = NullableClass.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of NullableClass-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = NullableClass.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = NullableClass.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 cbbb4908f4ff..6f4fadfc0b26 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +15,12 @@ class NumberOnly { this.justNumber, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// num? justNumber; @override @@ -25,7 +29,8 @@ class NumberOnly { @override int get hashCode => - justNumber.hashCode; + // ignore: unnecessary_parenthesis + (justNumber == null ? 0 : justNumber!.hashCode); @override String toString() => 'NumberOnly[justNumber=$justNumber]'; @@ -41,39 +46,74 @@ 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(Map json) => NumberOnly( - justNumber: json[r'JustNumber'] as num, - ); + static NumberOnly? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "NumberOnly[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "NumberOnly[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return NumberOnly( + justNumber: json[r'JustNumber'] == null + ? null + : num.parse(json[r'JustNumber'].toString()), + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => NumberOnly.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = NumberOnly.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = NumberOnly.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = NumberOnly.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of NumberOnly-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = NumberOnly.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = NumberOnly.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 068a1b6d1db4..b4c15654d92d 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -19,14 +18,31 @@ class ObjectWithDeprecatedFields { this.bars = const [], }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? uuid; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// num? id; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// DeprecatedObject? deprecatedRef; - List? bars; + List bars; @override bool operator ==(Object other) => identical(this, other) || other is ObjectWithDeprecatedFields && @@ -37,10 +53,11 @@ class ObjectWithDeprecatedFields { @override int get hashCode => - uuid.hashCode + - id.hashCode + - deprecatedRef.hashCode + - bars.hashCode; + // ignore: unnecessary_parenthesis + (uuid == null ? 0 : uuid!.hashCode) + + (id == null ? 0 : id!.hashCode) + + (deprecatedRef == null ? 0 : deprecatedRef!.hashCode) + + (bars.hashCode); @override String toString() => 'ObjectWithDeprecatedFields[uuid=$uuid, id=$id, deprecatedRef=$deprecatedRef, bars=$bars]'; @@ -56,53 +73,86 @@ class ObjectWithDeprecatedFields { if (deprecatedRef != null) { json[r'deprecatedRef'] = deprecatedRef; } - if (bars != null) { json[r'bars'] = bars; - } return json; } /// 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(Map json) => ObjectWithDeprecatedFields( - uuid: json[r'uuid'] as String, - id: json[r'id'] as num, + static ObjectWithDeprecatedFields? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ObjectWithDeprecatedFields[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ObjectWithDeprecatedFields[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ObjectWithDeprecatedFields( + uuid: mapValueOfType(json, r'uuid'), + id: json[r'id'] == null + ? null + : num.parse(json[r'id'].toString()), deprecatedRef: DeprecatedObject.fromJson(json[r'deprecatedRef']), bars: json[r'bars'] is List - ? (json[r'bars'] as List).cast() - : [], - ); + ? (json[r'bars'] as List).cast() + : const [], + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => ObjectWithDeprecatedFields.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ObjectWithDeprecatedFields.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = ObjectWithDeprecatedFields.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ObjectWithDeprecatedFields.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of ObjectWithDeprecatedFields-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = ObjectWithDeprecatedFields.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ObjectWithDeprecatedFields.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 e50090588764..51e75d68274e 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -21,19 +20,42 @@ class Order { this.complete = false, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? id; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? petId; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? quantity; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// DateTime? shipDate; /// Order Status OrderStatusEnum? status; - bool? complete; + bool complete; @override bool operator ==(Object other) => identical(this, other) || other is Order && @@ -46,12 +68,13 @@ class Order { @override int get hashCode => - id.hashCode + - petId.hashCode + - quantity.hashCode + - shipDate.hashCode + - status.hashCode + - complete.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.hashCode); @override String toString() => 'Order[id=$id, petId=$petId, quantity=$quantity, shipDate=$shipDate, status=$status, complete=$complete]'; @@ -73,54 +96,85 @@ class Order { if (status != null) { json[r'status'] = status; } - if (complete != null) { json[r'complete'] = complete; - } return json; } /// 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(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', '')!, + static Order? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Order[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Order[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Order( + id: mapValueOfType(json, r'id'), + petId: mapValueOfType(json, r'petId'), + quantity: mapValueOfType(json, r'quantity'), + shipDate: mapDateTime(json, r'shipDate', ''), status: OrderStatusEnum.fromJson(json[r'status']), - complete: json[r'complete'] as bool, - ); + complete: mapValueOfType(json, r'complete') ?? false, + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => Order.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Order.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = Order.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Order.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of Order-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = Order.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Order.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } /// Order Status @@ -129,12 +183,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 toString() => value; - String? toJson() => value; + String toJson() => value; static const placed = OrderStatusEnum._(r'placed'); static const approved = OrderStatusEnum._(r'approved'); @@ -147,13 +201,20 @@ class OrderStatusEnum { delivered, ]; - static OrderStatusEnum fromJson(dynamic value) => - OrderStatusEnumTypeTransformer().decode(value); - - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => OrderStatusEnum.fromJson(i as Map)).toList(growable: true == growable) - : []; + static OrderStatusEnum? fromJson(dynamic value) => OrderStatusEnumTypeTransformer().decode(value); + + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = OrderStatusEnum.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } } /// Transformation class that can [encode] an instance of [OrderStatusEnum] to String, @@ -163,22 +224,29 @@ 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 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; + /// 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 = true}) { + 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) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } } - throw ArgumentError('Unknown enum value to decode: $data'); + return null; } /// Singleton [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 c9050d662aef..173aca4ffbc8 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -18,11 +17,28 @@ class OuterComposite { this.myBoolean, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// num? myNumber; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? myString; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// bool? myBoolean; @override @@ -33,9 +49,10 @@ class OuterComposite { @override int get hashCode => - myNumber.hashCode + - myString.hashCode + - myBoolean.hashCode; + // ignore: unnecessary_parenthesis + (myNumber == null ? 0 : myNumber!.hashCode) + + (myString == null ? 0 : myString!.hashCode) + + (myBoolean == null ? 0 : myBoolean!.hashCode); @override String toString() => 'OuterComposite[myNumber=$myNumber, myString=$myString, myBoolean=$myBoolean]'; @@ -57,41 +74,76 @@ 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(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 OuterComposite? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "OuterComposite[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "OuterComposite[$key]" has a null value in JSON.'); + }); + return true; + }()); + + 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 List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => OuterComposite.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = OuterComposite.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = OuterComposite.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = OuterComposite.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of OuterComposite-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = OuterComposite.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = OuterComposite.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 a146bf506cba..34749b198624 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,12 +15,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 toString() => value; - String? toJson() => value; + String toJson() => value; static const placed = OuterEnum._(r'placed'); static const approved = OuterEnum._(r'approved'); @@ -34,13 +33,20 @@ class OuterEnum { delivered, ]; - static OuterEnum fromJson(dynamic value) => - OuterEnumTypeTransformer().decode(value); - - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => OuterEnum.fromJson(i as Map)).toList(growable: true == growable) - : []; + static OuterEnum? fromJson(dynamic value) => OuterEnumTypeTransformer().decode(value); + + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = OuterEnum.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } } /// Transformation class that can [encode] an instance of [OuterEnum] to String, @@ -50,23 +56,29 @@ 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 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; - } - if (data == r'delivered') { - return OuterEnum.delivered; + /// 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 = true}) { + 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) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } } - throw ArgumentError('Unknown enum value to decode: $data'); - + return null; } /// Singleton [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 686667afa27e..d0498d7982ce 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,12 +15,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 toString() => value; - String? toJson() => value; + String toJson() => value; static const placed = OuterEnumDefaultValue._(r'placed'); static const approved = OuterEnumDefaultValue._(r'approved'); @@ -34,13 +33,20 @@ class OuterEnumDefaultValue { delivered, ]; - static OuterEnumDefaultValue fromJson(dynamic value) => - OuterEnumDefaultValueTypeTransformer().decode(value); - - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => OuterEnumDefaultValue.fromJson(i as Map)).toList(growable: true == growable) - : []; + static OuterEnumDefaultValue? fromJson(dynamic value) => OuterEnumDefaultValueTypeTransformer().decode(value); + + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = OuterEnumDefaultValue.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } } /// Transformation class that can [encode] an instance of [OuterEnumDefaultValue] to String, @@ -50,23 +56,29 @@ 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 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; - } - if (data == r'delivered') { - return OuterEnumDefaultValue.delivered; + /// 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 = true}) { + 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) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } } - throw ArgumentError('Unknown enum value to decode: $data'); - + return null; } /// Singleton [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 4f74ef2d264d..bff3d90d44fc 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,12 +15,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(); + String toString() => value.toString(); - int? toJson() => value; + int toJson() => value; static const number0 = OuterEnumInteger._(0); static const number1 = OuterEnumInteger._(1); @@ -34,13 +33,20 @@ class OuterEnumInteger { number2, ]; - static OuterEnumInteger fromJson(dynamic value) => - OuterEnumIntegerTypeTransformer().decode(value); - - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => OuterEnumInteger.fromJson(i as Map)).toList(growable: true == growable) - : []; + static OuterEnumInteger? fromJson(dynamic value) => OuterEnumIntegerTypeTransformer().decode(value); + + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = OuterEnumInteger.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } } /// Transformation class that can [encode] an instance of [OuterEnumInteger] to int, @@ -50,23 +56,29 @@ 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 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; - } - if (data == 2) { - return OuterEnumInteger.number2; + /// 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 = true}) { + if (data != null) { + switch (data.toString()) { + case 0: return OuterEnumInteger.number0; + case 1: return OuterEnumInteger.number1; + case 2: return OuterEnumInteger.number2; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } } - throw ArgumentError('Unknown enum value to decode: $data'); - + return null; } /// Singleton [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 65d61f66cc1b..750ccec8585b 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,12 +15,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(); + String toString() => value.toString(); - int? toJson() => value; + int toJson() => value; static const number0 = OuterEnumIntegerDefaultValue._(0); static const number1 = OuterEnumIntegerDefaultValue._(1); @@ -34,13 +33,20 @@ class OuterEnumIntegerDefaultValue { number2, ]; - static OuterEnumIntegerDefaultValue fromJson(dynamic value) => - OuterEnumIntegerDefaultValueTypeTransformer().decode(value); - - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => OuterEnumIntegerDefaultValue.fromJson(i as Map)).toList(growable: true == growable) - : []; + static OuterEnumIntegerDefaultValue? fromJson(dynamic value) => OuterEnumIntegerDefaultValueTypeTransformer().decode(value); + + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = OuterEnumIntegerDefaultValue.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } } /// Transformation class that can [encode] an instance of [OuterEnumIntegerDefaultValue] to int, @@ -50,23 +56,29 @@ 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 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; - } - if (data == 2) { - return OuterEnumIntegerDefaultValue.number2; + /// 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 = true}) { + if (data != null) { + switch (data.toString()) { + case 0: return OuterEnumIntegerDefaultValue.number0; + case 1: return OuterEnumIntegerDefaultValue.number1; + case 2: return OuterEnumIntegerDefaultValue.number2; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } } - throw ArgumentError('Unknown enum value to decode: $data'); - + return null; } /// Singleton [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 68bb42944050..617b6a22f24f 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +15,6 @@ class OuterObjectWithEnumProperty { required this.value, }); - OuterEnumInteger value; @override @@ -25,7 +23,8 @@ class OuterObjectWithEnumProperty { @override int get hashCode => - value.hashCode; + // ignore: unnecessary_parenthesis + (value.hashCode); @override String toString() => 'OuterObjectWithEnumProperty[value=$value]'; @@ -39,39 +38,73 @@ 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(Map json) => OuterObjectWithEnumProperty( - value: OuterEnumInteger.fromJson(json[r'value']), - ); + static OuterObjectWithEnumProperty? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "OuterObjectWithEnumProperty[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "OuterObjectWithEnumProperty[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return OuterObjectWithEnumProperty( + value: OuterEnumInteger.fromJson(json[r'value'])!, + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => OuterObjectWithEnumProperty.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = OuterObjectWithEnumProperty.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = OuterObjectWithEnumProperty.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = OuterObjectWithEnumProperty.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of OuterObjectWithEnumProperty-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = OuterObjectWithEnumProperty.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = OuterObjectWithEnumProperty.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'value', + }; } 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 f8b0e5ba16a1..e79cfbef245a 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -21,16 +20,27 @@ class Pet { this.status, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? id; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// Category? category; String name; Set photoUrls; - List? tags; + List tags; /// pet status in the store PetStatusEnum? status; @@ -46,12 +56,13 @@ class Pet { @override int get hashCode => - id.hashCode + - category.hashCode + - name.hashCode + - photoUrls.hashCode + - tags.hashCode + - status.hashCode; + // ignore: unnecessary_parenthesis + (id == null ? 0 : id!.hashCode) + + (category == null ? 0 : category!.hashCode) + + (name.hashCode) + + (photoUrls.hashCode) + + (tags.hashCode) + + (status == null ? 0 : status!.hashCode); @override String toString() => 'Pet[id=$id, category=$category, name=$name, photoUrls=$photoUrls, tags=$tags, status=$status]'; @@ -66,9 +77,7 @@ class Pet { } json[r'name'] = name; json[r'photoUrls'] = photoUrls; - if (tags != null) { json[r'tags'] = tags; - } if (status != null) { json[r'status'] = status; } @@ -78,47 +87,82 @@ 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(Map json) => Pet( - id: json[r'id'] as int, + static Pet? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Pet[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Pet[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Pet( + id: mapValueOfType(json, r'id'), category: Category.fromJson(json[r'category']), - name: json[r'name'] as String, + name: mapValueOfType(json, r'name')!, photoUrls: json[r'photoUrls'] is Set - ? (json[r'photoUrls'] as Set).cast() - : {}, - tags: Tag.listFromJson(json[r'tags']), + ? (json[r'photoUrls'] as Set).cast() + : const {}, + tags: Tag.listFromJson(json[r'tags']) ?? const [], status: PetStatusEnum.fromJson(json[r'status']), - ); + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => Pet.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Pet.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = Pet.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Pet.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of Pet-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = Pet.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Pet.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'name', + 'photoUrls', + }; } /// pet status in the store @@ -127,12 +171,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 toString() => value; - String? toJson() => value; + String toJson() => value; static const available = PetStatusEnum._(r'available'); static const pending = PetStatusEnum._(r'pending'); @@ -145,13 +189,20 @@ class PetStatusEnum { sold, ]; - static PetStatusEnum fromJson(dynamic value) => - PetStatusEnumTypeTransformer().decode(value); - - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => PetStatusEnum.fromJson(i as Map)).toList(growable: true == growable) - : []; + static PetStatusEnum? fromJson(dynamic value) => PetStatusEnumTypeTransformer().decode(value); + + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = PetStatusEnum.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } } /// Transformation class that can [encode] an instance of [PetStatusEnum] to String, @@ -161,22 +212,29 @@ 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 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; + /// 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 = true}) { + 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) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } } - throw ArgumentError('Unknown enum value to decode: $data'); + return null; } /// Singleton [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 bdfb3ede8aa0..f3c239be4863 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -17,9 +16,20 @@ class ReadOnlyFirst { this.baz, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? bar; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? baz; @override @@ -29,8 +39,9 @@ class ReadOnlyFirst { @override int get hashCode => - bar.hashCode + - baz.hashCode; + // ignore: unnecessary_parenthesis + (bar == null ? 0 : bar!.hashCode) + + (baz == null ? 0 : baz!.hashCode); @override String toString() => 'ReadOnlyFirst[bar=$bar, baz=$baz]'; @@ -49,40 +60,73 @@ 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(Map json) => ReadOnlyFirst( - bar: json[r'bar'] as String, - baz: json[r'baz'] as String, - ); + static ReadOnlyFirst? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ReadOnlyFirst[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ReadOnlyFirst[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ReadOnlyFirst( + bar: mapValueOfType(json, r'bar'), + baz: mapValueOfType(json, r'baz'), + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => ReadOnlyFirst.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ReadOnlyFirst.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = ReadOnlyFirst.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ReadOnlyFirst.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of ReadOnlyFirst-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = ReadOnlyFirst.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ReadOnlyFirst.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 743c6a17313f..154d463a6202 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -16,7 +15,12 @@ class SpecialModelName { this.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; @override @@ -25,7 +29,8 @@ class SpecialModelName { @override int get hashCode => - dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket.hashCode; + // ignore: unnecessary_parenthesis + (dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket == null ? 0 : dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket!.hashCode); @override String toString() => 'SpecialModelName[dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket=$dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket]'; @@ -41,39 +46,72 @@ 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(Map json) => SpecialModelName( - dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket: json[r'$special[property.name]'] as int, - ); + static SpecialModelName? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "SpecialModelName[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "SpecialModelName[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return SpecialModelName( + dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket: mapValueOfType(json, r'$special[property.name]'), + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => SpecialModelName.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = SpecialModelName.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = SpecialModelName.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = SpecialModelName.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of SpecialModelName-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = SpecialModelName.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = SpecialModelName.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 6966abac0d1f..a6692553e7b6 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -17,9 +16,20 @@ class Tag { this.name, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? id; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? name; @override @@ -29,8 +39,9 @@ class Tag { @override int get hashCode => - id.hashCode + - name.hashCode; + // ignore: unnecessary_parenthesis + (id == null ? 0 : id!.hashCode) + + (name == null ? 0 : name!.hashCode); @override String toString() => 'Tag[id=$id, name=$name]'; @@ -49,40 +60,73 @@ 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(Map json) => Tag( - id: json[r'id'] as int, - name: json[r'name'] as String, - ); + static Tag? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Tag[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Tag[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Tag( + id: mapValueOfType(json, r'id'), + name: mapValueOfType(json, r'name'), + ); + } + return null; + } - static List listFromJson(List json, {bool? growable,}) => - json.isNotEmpty - ? json.map((i) => Tag.fromJson(i as Map)).toList(growable: true == growable) - : []; + static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Tag.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = Tag.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Tag.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of Tag-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = Tag.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Tag.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } 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 7324ba6d01b8..83cf14e866ca 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,6 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // -// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -23,22 +22,69 @@ class User { this.userStatus, }); - + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? id; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? username; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? firstName; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? lastName; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? email; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? password; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// String? phone; /// User Status + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// int? userStatus; @override @@ -54,14 +100,15 @@ class User { @override int get hashCode => - id.hashCode + - username.hashCode + - firstName.hashCode + - lastName.hashCode + - email.hashCode + - password.hashCode + - phone.hashCode + - userStatus.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); @override String toString() => 'User[id=$id, username=$username, firstName=$firstName, lastName=$lastName, email=$email, password=$password, phone=$phone, userStatus=$userStatus]'; @@ -98,46 +145,79 @@ 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(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 User? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "User[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "User[$key]" has a null value in JSON.'); + }); + return true; + }()); + + 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 = false, bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = User.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + } static Map mapFromJson(dynamic json) { final map = {}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) => map[key] = User.fromJson(value)); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = User.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } } return map; } // maps a json object with a list of User-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool? growable,}) { + static Map> mapListFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json - .cast() - .forEach((key, dynamic value) { - map[key] = User.listFromJson( - value, - growable: growable, - ); - }); + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = User.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } } return map; } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; } From 9f1e6a7f8fce353b9633c4860c5c07ad454f2251 Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Sat, 18 Dec 2021 21:40:31 +0100 Subject: [PATCH 31/39] Remove extra code to sync with agilob's pr. --- .../src/main/resources/dart2/api_test.mustache | 2 +- .../main/resources/dart2/auth/http_basic_auth.mustache | 8 +++++--- .../src/main/resources/dart2/header.mustache | 1 + .../src/main/resources/dart2/model_test.mustache | 2 +- .../dart2/serialization/native/native_class.mustache | 8 ++++---- .../dart2/serialization/native/native_enum.mustache | 4 ++-- .../serialization/native/native_enum_inline.mustache | 4 ++-- 7 files changed, 16 insertions(+), 13 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/dart2/api_test.mustache b/modules/openapi-generator/src/main/resources/dart2/api_test.mustache index 319945b2c3b5..6873ba0f9d4d 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_test.mustache @@ -6,7 +6,7 @@ import 'package:test/test.dart'; /// tests for {{{classname}}} void main() { - final instance = {{{classname}}}(); + // final instance = {{{classname}}}(); group('tests for {{{classname}}}', () { {{#operation}} 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 2f6a542f5d54..07a7d8a11c1c 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,12 +1,14 @@ {{>header}} {{>part_of}} class HttpBasicAuth implements Authentication { - String? username; - String? password; + HttpBasicAuth(this.username, this.password); + + String username; + String password; @override void applyToParams(List queryParams, Map headerParams) { - final credentials = '${username ?? ''}:${password ?? ''}'; + final credentials = '$username:$password'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; } } diff --git a/modules/openapi-generator/src/main/resources/dart2/header.mustache b/modules/openapi-generator/src/main/resources/dart2/header.mustache index 8dc8b6d982fe..3799d9d04658 100644 --- a/modules/openapi-generator/src/main/resources/dart2/header.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/header.mustache @@ -1,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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 index 5d4f1c161c52..1a074d47b71d 100644 --- a/modules/openapi-generator/src/main/resources/dart2/model_test.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/model_test.mustache @@ -7,7 +7,7 @@ import 'package:test/test.dart'; // tests for {{{classname}}} void main() { {{^isEnum}} - final instance = {{{classname}}}(); + // final instance = {{{classname}}}(); {{/isEnum}} group('test {{{classname}}}', () { 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 28417765b150..e6a680201fe7 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 @@ -225,7 +225,7 @@ class {{{classname}}} { return null; } - static List<{{{classname}}}>? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List<{{{classname}}}>? listFromJson(dynamic json, {bool growable = false,}) { final result = <{{{classname}}}>[]; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -235,7 +235,7 @@ class {{{classname}}} { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -253,12 +253,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = {{{classname}}}.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = {{{classname}}}.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 4c4300334d47..6f4b8a62eda9 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 @@ -28,7 +28,7 @@ class {{{classname}}} { static {{{classname}}}? fromJson(dynamic value) => {{{classname}}}TypeTransformer().decode(value); - static List<{{{classname}}}>? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List<{{{classname}}}>? listFromJson(dynamic json, {bool growable = false,}) { final result = <{{{classname}}}>[]; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -38,7 +38,7 @@ class {{{classname}}} { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } } 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 3eedbee1bc57..b434d2d018ff 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 @@ -28,7 +28,7 @@ class {{{enumName}}} { static {{{enumName}}}? fromJson(dynamic value) => {{{enumName}}}TypeTransformer().decode(value); - static List<{{{enumName}}}>? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List<{{{enumName}}}>? listFromJson(dynamic json, {bool growable = false,}) { final result = <{{{enumName}}}>[]; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -38,7 +38,7 @@ class {{{enumName}}} { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } } From ebd0fae57e3a72e8df9147ff16b0a711560a715d Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Sat, 18 Dec 2021 21:43:49 +0100 Subject: [PATCH 32/39] Regenerated Petstore source code. --- .../dart2/petstore_client_lib/lib/api.dart | 1 + .../petstore_client_lib/lib/api/pet_api.dart | 1 + .../lib/api/store_api.dart | 1 + .../petstore_client_lib/lib/api/user_api.dart | 1 + .../petstore_client_lib/lib/api_client.dart | 1 + .../lib/api_exception.dart | 1 + .../petstore_client_lib/lib/api_helper.dart | 1 + .../lib/auth/api_key_auth.dart | 1 + .../lib/auth/authentication.dart | 1 + .../lib/auth/http_basic_auth.dart | 9 ++++--- .../lib/auth/http_bearer_auth.dart | 1 + .../petstore_client_lib/lib/auth/oauth.dart | 1 + .../lib/model/api_response.dart | 9 ++++--- .../lib/model/category.dart | 9 ++++--- .../petstore_client_lib/lib/model/order.dart | 13 +++++----- .../petstore_client_lib/lib/model/pet.dart | 13 +++++----- .../petstore_client_lib/lib/model/tag.dart | 9 ++++--- .../petstore_client_lib/lib/model/user.dart | 9 ++++--- .../petstore_client_lib_fake/lib/api.dart | 1 + .../lib/api/another_fake_api.dart | 1 + .../lib/api/default_api.dart | 1 + .../lib/api/fake_api.dart | 1 + .../lib/api/fake_classname_tags123_api.dart | 1 + .../lib/api/pet_api.dart | 1 + .../lib/api/store_api.dart | 1 + .../lib/api/user_api.dart | 1 + .../lib/api_client.dart | 1 + .../lib/api_exception.dart | 1 + .../lib/api_helper.dart | 1 + .../lib/auth/api_key_auth.dart | 1 + .../lib/auth/authentication.dart | 1 + .../lib/auth/http_basic_auth.dart | 9 ++++--- .../lib/auth/http_bearer_auth.dart | 1 + .../lib/auth/oauth.dart | 1 + .../model/additional_properties_class.dart | 9 ++++--- .../lib/model/animal.dart | 9 ++++--- .../lib/model/api_response.dart | 9 ++++--- .../model/array_of_array_of_number_only.dart | 9 ++++--- .../lib/model/array_of_number_only.dart | 9 ++++--- .../lib/model/array_test.dart | 9 ++++--- .../lib/model/capitalization.dart | 9 ++++--- .../lib/model/cat.dart | 9 ++++--- .../lib/model/cat_all_of.dart | 9 ++++--- .../lib/model/category.dart | 9 ++++--- .../lib/model/class_model.dart | 9 ++++--- .../lib/model/deprecated_object.dart | 9 ++++--- .../lib/model/dog.dart | 9 ++++--- .../lib/model/dog_all_of.dart | 9 ++++--- .../lib/model/enum_arrays.dart | 17 +++++++------ .../lib/model/enum_class.dart | 5 ++-- .../lib/model/enum_test.dart | 25 ++++++++++--------- .../lib/model/file_schema_test_class.dart | 9 ++++--- .../lib/model/foo.dart | 9 ++++--- .../lib/model/format_test.dart | 9 ++++--- .../lib/model/has_only_read_only.dart | 9 ++++--- .../lib/model/health_check_result.dart | 9 ++++--- .../lib/model/inline_response_default.dart | 9 ++++--- .../lib/model/map_test.dart | 13 +++++----- ...rties_and_additional_properties_class.dart | 9 ++++--- .../lib/model/model200_response.dart | 9 ++++--- .../lib/model/model_client.dart | 9 ++++--- .../lib/model/model_file.dart | 9 ++++--- .../lib/model/model_list.dart | 9 ++++--- .../lib/model/model_return.dart | 9 ++++--- .../lib/model/name.dart | 9 ++++--- .../lib/model/nullable_class.dart | 9 ++++--- .../lib/model/number_only.dart | 9 ++++--- .../model/object_with_deprecated_fields.dart | 9 ++++--- .../lib/model/order.dart | 13 +++++----- .../lib/model/outer_composite.dart | 9 ++++--- .../lib/model/outer_enum.dart | 5 ++-- .../lib/model/outer_enum_default_value.dart | 5 ++-- .../lib/model/outer_enum_integer.dart | 5 ++-- .../outer_enum_integer_default_value.dart | 5 ++-- .../outer_object_with_enum_property.dart | 9 ++++--- .../lib/model/pet.dart | 13 +++++----- .../lib/model/read_only_first.dart | 9 ++++--- .../lib/model/special_model_name.dart | 9 ++++--- .../lib/model/tag.dart | 9 ++++--- .../lib/model/user.dart | 9 ++++--- 80 files changed, 310 insertions(+), 226 deletions(-) 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 3855a2f4fac3..742bcfa11543 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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 9ad09e25db5f..f5c3c0b4f49e 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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/store_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart index c9de8dd531c1..78320021f571 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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/user_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart index 2a30d3ec9278..12c33b767432 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart index ec06c4381935..3efae0775a54 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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_exception.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_exception.dart index 6ad46aec00fb..796f7f7ee74e 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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_helper.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_helper.dart index 9d1c3e6a8602..d6adb1798250 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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/api_key_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart index 65c42ea845ed..2af78a62bcf0 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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/authentication.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart index 7118eec2fb06..49baf7c46a9c 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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 8b8a844771dd..503c796a5636 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -10,12 +11,14 @@ part of openapi.api; class HttpBasicAuth implements Authentication { - String? username; - String? password; + HttpBasicAuth(this.username, this.password); + + String username; + String password; @override void applyToParams(List queryParams, Map headerParams) { - final credentials = '${username ?? ''}:${password ?? ''}'; + final credentials = '$username:$password'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; } } 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 4e993fbf9a5c..07f105666dc0 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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 8bd8b745acf5..66ec4cda0864 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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/model/api_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart index d0a510590675..6042baea5514 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -98,7 +99,7 @@ class ApiResponse { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -108,7 +109,7 @@ class ApiResponse { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -126,12 +127,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = ApiResponse.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = ApiResponse.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 30365a06d285..f4a572dffc73 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -83,7 +84,7 @@ class Category { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -93,7 +94,7 @@ class Category { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -111,12 +112,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = Category.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = Category.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 51e75d68274e..ad84a894e8db 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -130,7 +131,7 @@ class Order { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -140,7 +141,7 @@ class Order { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -158,12 +159,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = Order.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = Order.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } @@ -203,7 +204,7 @@ class OrderStatusEnum { static OrderStatusEnum? fromJson(dynamic value) => OrderStatusEnumTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -213,7 +214,7 @@ class OrderStatusEnum { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } } 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 237fc10663ec..62856ddace32 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -116,7 +117,7 @@ class Pet { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -126,7 +127,7 @@ class Pet { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -144,12 +145,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = Pet.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = Pet.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } @@ -191,7 +192,7 @@ class PetStatusEnum { static PetStatusEnum? fromJson(dynamic value) => PetStatusEnumTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -201,7 +202,7 @@ class PetStatusEnum { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } } 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 a6692553e7b6..71b8799d1cb1 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -83,7 +84,7 @@ class Tag { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -93,7 +94,7 @@ class Tag { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -111,12 +112,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = Tag.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = Tag.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 83cf14e866ca..0b10d4fe7c23 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -174,7 +175,7 @@ class User { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -184,7 +185,7 @@ class User { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -202,12 +203,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = User.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = User.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 0bd28563760c..48f61a0d5f5d 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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 1a48ff34ce86..261fa0b26dab 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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/default_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart index 14341ee5fc7d..02c22bfa2d9f 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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/fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart index 430195af11a2..be763b2522a9 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart index f38494828deb..dc040d413e2d 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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/pet_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart index 8804a8301bc7..c9f9150e6ca2 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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/store_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/store_api.dart index f8f122c6bfda..1b6774ba5800 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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/user_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/user_api.dart index c1b5b30b25db..0fdd9c4249d8 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart index a4ae1c93d737..8277ac92e7ca 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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_exception.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_exception.dart index 6ad46aec00fb..796f7f7ee74e 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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_helper.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_helper.dart index 285f35b44059..1aaf1dae8eb3 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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/api_key_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/api_key_auth.dart index 65c42ea845ed..2af78a62bcf0 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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/authentication.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/authentication.dart index 7118eec2fb06..49baf7c46a9c 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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 8b8a844771dd..503c796a5636 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -10,12 +11,14 @@ part of openapi.api; class HttpBasicAuth implements Authentication { - String? username; - String? password; + HttpBasicAuth(this.username, this.password); + + String username; + String password; @override void applyToParams(List queryParams, Map headerParams) { - final credentials = '${username ?? ''}:${password ?? ''}'; + final credentials = '$username:$password'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; } } 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 4e993fbf9a5c..07f105666dc0 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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 8bd8b745acf5..66ec4cda0864 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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/model/additional_properties_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/additional_properties_class.dart index 8b2d400877fb..e82b8265bf59 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -67,7 +68,7 @@ class AdditionalPropertiesClass { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -77,7 +78,7 @@ class AdditionalPropertiesClass { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -95,12 +96,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = AdditionalPropertiesClass.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = AdditionalPropertiesClass.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 b74c7f1b0bd1..2d279e07c494 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -67,7 +68,7 @@ class Animal { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -77,7 +78,7 @@ class Animal { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -95,12 +96,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = Animal.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = Animal.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 d0a510590675..6042baea5514 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -98,7 +99,7 @@ class ApiResponse { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -108,7 +109,7 @@ class ApiResponse { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -126,12 +127,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = ApiResponse.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = ApiResponse.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 c1a98403c51a..4314803a3ba5 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -64,7 +65,7 @@ class ArrayOfArrayOfNumberOnly { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -74,7 +75,7 @@ class ArrayOfArrayOfNumberOnly { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -92,12 +93,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = ArrayOfArrayOfNumberOnly.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = ArrayOfArrayOfNumberOnly.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 5f01774ae31b..8e9d6784f804 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -62,7 +63,7 @@ class ArrayOfNumberOnly { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -72,7 +73,7 @@ class ArrayOfNumberOnly { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -90,12 +91,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = ArrayOfNumberOnly.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = ArrayOfNumberOnly.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 d6a63ad1fd12..a914c04ee52a 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -84,7 +85,7 @@ class ArrayTest { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -94,7 +95,7 @@ class ArrayTest { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -112,12 +113,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = ArrayTest.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = ArrayTest.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 afa1150a769a..3e781d44c727 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -144,7 +145,7 @@ class Capitalization { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -154,7 +155,7 @@ class Capitalization { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -172,12 +173,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = Capitalization.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = Capitalization.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 cdf9f3c06a96..f5b639d8e342 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -82,7 +83,7 @@ class Cat { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -92,7 +93,7 @@ class Cat { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -110,12 +111,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = Cat.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = Cat.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 6f1d094ba43e..608082b26ad7 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -68,7 +69,7 @@ class CatAllOf { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -78,7 +79,7 @@ class CatAllOf { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -96,12 +97,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = CatAllOf.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = CatAllOf.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 21b2dc04b724..9b77fed5e7cb 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -75,7 +76,7 @@ class Category { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -85,7 +86,7 @@ class Category { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -103,12 +104,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = Category.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = Category.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 b48d331d7f65..8335e5810968 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -68,7 +69,7 @@ class ClassModel { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -78,7 +79,7 @@ class ClassModel { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -96,12 +97,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = ClassModel.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = ClassModel.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 16c356c56ab7..b8a5b443cc7e 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -68,7 +69,7 @@ class DeprecatedObject { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -78,7 +79,7 @@ class DeprecatedObject { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -96,12 +97,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = DeprecatedObject.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = DeprecatedObject.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 89e16680e2f5..8ec20b96c81a 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -82,7 +83,7 @@ class Dog { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -92,7 +93,7 @@ class Dog { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -110,12 +111,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = Dog.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = Dog.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 e3ef7f5ee20a..03d52a6cb2f9 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -68,7 +69,7 @@ class DogAllOf { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -78,7 +79,7 @@ class DogAllOf { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -96,12 +97,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = DogAllOf.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = DogAllOf.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 58975b438c98..ad8bff240a14 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -69,7 +70,7 @@ class EnumArrays { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -79,7 +80,7 @@ class EnumArrays { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -97,12 +98,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = EnumArrays.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = EnumArrays.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } @@ -140,7 +141,7 @@ class EnumArraysJustSymbolEnum { static EnumArraysJustSymbolEnum? fromJson(dynamic value) => EnumArraysJustSymbolEnumTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -150,7 +151,7 @@ class EnumArraysJustSymbolEnum { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } } @@ -214,7 +215,7 @@ class EnumArraysArrayEnumEnum { static EnumArraysArrayEnumEnum? fromJson(dynamic value) => EnumArraysArrayEnumEnumTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -224,7 +225,7 @@ class EnumArraysArrayEnumEnum { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } } 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 1a698721c688..ad0fee194896 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -35,7 +36,7 @@ class EnumClass { static EnumClass? fromJson(dynamic value) => EnumClassTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -45,7 +46,7 @@ class EnumClass { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } } 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 cf3a4828c8fd..06ff55540f79 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -141,7 +142,7 @@ class EnumTest { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -151,7 +152,7 @@ class EnumTest { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -169,12 +170,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = EnumTest.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = EnumTest.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } @@ -215,7 +216,7 @@ class EnumTestEnumStringEnum { static EnumTestEnumStringEnum? fromJson(dynamic value) => EnumTestEnumStringEnumTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -225,7 +226,7 @@ class EnumTestEnumStringEnum { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } } @@ -292,7 +293,7 @@ class EnumTestEnumStringRequiredEnum { static EnumTestEnumStringRequiredEnum? fromJson(dynamic value) => EnumTestEnumStringRequiredEnumTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -302,7 +303,7 @@ class EnumTestEnumStringRequiredEnum { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } } @@ -367,7 +368,7 @@ class EnumTestEnumIntegerEnum { static EnumTestEnumIntegerEnum? fromJson(dynamic value) => EnumTestEnumIntegerEnumTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -377,7 +378,7 @@ class EnumTestEnumIntegerEnum { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } } @@ -441,7 +442,7 @@ class EnumTestEnumNumberEnum { static EnumTestEnumNumberEnum? fromJson(dynamic value) => EnumTestEnumNumberEnumTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -451,7 +452,7 @@ class EnumTestEnumNumberEnum { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } } 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 2419ab26e619..0f53a5ed1f92 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -75,7 +76,7 @@ class FileSchemaTestClass { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -85,7 +86,7 @@ class FileSchemaTestClass { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -103,12 +104,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = FileSchemaTestClass.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = FileSchemaTestClass.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 cfd55f075792..4fd3f08d59a8 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -60,7 +61,7 @@ class Foo { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -70,7 +71,7 @@ class Foo { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -88,12 +89,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = Foo.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = Foo.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 3f1e22bbedd8..48f039432af4 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -275,7 +276,7 @@ class FormatTest { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -285,7 +286,7 @@ class FormatTest { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -303,12 +304,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = FormatTest.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = FormatTest.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 155783429759..8d6811c7d9b2 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -83,7 +84,7 @@ class HasOnlyReadOnly { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -93,7 +94,7 @@ class HasOnlyReadOnly { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -111,12 +112,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = HasOnlyReadOnly.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = HasOnlyReadOnly.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 bfb8613328bf..94c1561bd548 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -62,7 +63,7 @@ class HealthCheckResult { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -72,7 +73,7 @@ class HealthCheckResult { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -90,12 +91,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = HealthCheckResult.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = HealthCheckResult.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 bc59ba52bf32..d66b3546637a 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -68,7 +69,7 @@ class InlineResponseDefault { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -78,7 +79,7 @@ class InlineResponseDefault { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -96,12 +97,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = InlineResponseDefault.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = InlineResponseDefault.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 47108988485c..5afcb48e86fa 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -81,7 +82,7 @@ class MapTest { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -91,7 +92,7 @@ class MapTest { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -109,12 +110,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = MapTest.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = MapTest.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } @@ -152,7 +153,7 @@ class MapTestMapOfEnumStringEnum { static MapTestMapOfEnumStringEnum? fromJson(dynamic value) => MapTestMapOfEnumStringEnumTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -162,7 +163,7 @@ class MapTestMapOfEnumStringEnum { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } } 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 d90d9adcf810..599c817a66ad 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -90,7 +91,7 @@ class MixedPropertiesAndAdditionalPropertiesClass { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -100,7 +101,7 @@ class MixedPropertiesAndAdditionalPropertiesClass { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -118,12 +119,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = MixedPropertiesAndAdditionalPropertiesClass.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = MixedPropertiesAndAdditionalPropertiesClass.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 03e079eec9e0..de257edc7cc9 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -83,7 +84,7 @@ class Model200Response { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -93,7 +94,7 @@ class Model200Response { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -111,12 +112,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = Model200Response.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = Model200Response.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 9c374c36a9d5..d48d030c9d06 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -68,7 +69,7 @@ class ModelClient { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -78,7 +79,7 @@ class ModelClient { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -96,12 +97,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = ModelClient.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = ModelClient.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 2578c0a06f93..dc0f89b1c4f9 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -69,7 +70,7 @@ class ModelFile { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -79,7 +80,7 @@ class ModelFile { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -97,12 +98,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = ModelFile.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = ModelFile.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 018054424d0c..d079e6aa221d 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -68,7 +69,7 @@ class ModelList { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -78,7 +79,7 @@ class ModelList { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -96,12 +97,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = ModelList.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = ModelList.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 ea8d243da5c0..3042ac8b3af5 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -68,7 +69,7 @@ class ModelReturn { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -78,7 +79,7 @@ class ModelReturn { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -96,12 +97,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = ModelReturn.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = ModelReturn.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 517fec3bb094..10461ccba2b6 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -105,7 +106,7 @@ class Name { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -115,7 +116,7 @@ class Name { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -133,12 +134,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = Name.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = Name.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 9b532fea31e4..2f3d55046fed 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -159,7 +160,7 @@ class NullableClass { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -169,7 +170,7 @@ class NullableClass { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -187,12 +188,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = NullableClass.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = NullableClass.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 6f4fadfc0b26..2a927dc41d6a 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -70,7 +71,7 @@ class NumberOnly { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -80,7 +81,7 @@ class NumberOnly { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -98,12 +99,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = NumberOnly.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = NumberOnly.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 b4c15654d92d..924aaeaafae4 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -109,7 +110,7 @@ class ObjectWithDeprecatedFields { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -119,7 +120,7 @@ class ObjectWithDeprecatedFields { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -137,12 +138,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = ObjectWithDeprecatedFields.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = ObjectWithDeprecatedFields.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 51e75d68274e..ad84a894e8db 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -130,7 +131,7 @@ class Order { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -140,7 +141,7 @@ class Order { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -158,12 +159,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = Order.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = Order.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } @@ -203,7 +204,7 @@ class OrderStatusEnum { static OrderStatusEnum? fromJson(dynamic value) => OrderStatusEnumTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -213,7 +214,7 @@ class OrderStatusEnum { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } } 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 173aca4ffbc8..c60b3d287a12 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -100,7 +101,7 @@ class OuterComposite { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -110,7 +111,7 @@ class OuterComposite { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -128,12 +129,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = OuterComposite.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = OuterComposite.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 34749b198624..79990cc426ae 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -35,7 +36,7 @@ class OuterEnum { static OuterEnum? fromJson(dynamic value) => OuterEnumTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -45,7 +46,7 @@ class OuterEnum { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } } 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 d0498d7982ce..710bffc01d65 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -35,7 +36,7 @@ class OuterEnumDefaultValue { static OuterEnumDefaultValue? fromJson(dynamic value) => OuterEnumDefaultValueTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -45,7 +46,7 @@ class OuterEnumDefaultValue { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } } 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 bff3d90d44fc..7d0f2e371b11 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -35,7 +36,7 @@ class OuterEnumInteger { static OuterEnumInteger? fromJson(dynamic value) => OuterEnumIntegerTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -45,7 +46,7 @@ class OuterEnumInteger { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } } 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 750ccec8585b..f82ae23497b3 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -35,7 +36,7 @@ class OuterEnumIntegerDefaultValue { static OuterEnumIntegerDefaultValue? fromJson(dynamic value) => OuterEnumIntegerDefaultValueTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -45,7 +46,7 @@ class OuterEnumIntegerDefaultValue { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } } 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 617b6a22f24f..8b9b76380e6d 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -60,7 +61,7 @@ class OuterObjectWithEnumProperty { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -70,7 +71,7 @@ class OuterObjectWithEnumProperty { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -88,12 +89,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = OuterObjectWithEnumProperty.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = OuterObjectWithEnumProperty.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 e79cfbef245a..e9a89d7b51b9 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -116,7 +117,7 @@ class Pet { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -126,7 +127,7 @@ class Pet { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -144,12 +145,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = Pet.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = Pet.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } @@ -191,7 +192,7 @@ class PetStatusEnum { static PetStatusEnum? fromJson(dynamic value) => PetStatusEnumTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -201,7 +202,7 @@ class PetStatusEnum { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } } 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 f3c239be4863..6cda0773d11d 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -83,7 +84,7 @@ class ReadOnlyFirst { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -93,7 +94,7 @@ class ReadOnlyFirst { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -111,12 +112,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = ReadOnlyFirst.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = ReadOnlyFirst.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 154d463a6202..bdfecbd2e7de 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -68,7 +69,7 @@ class SpecialModelName { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -78,7 +79,7 @@ class SpecialModelName { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -96,12 +97,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = SpecialModelName.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = SpecialModelName.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 a6692553e7b6..71b8799d1cb1 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -83,7 +84,7 @@ class Tag { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -93,7 +94,7 @@ class Tag { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -111,12 +112,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = Tag.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = Tag.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } 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 83cf14e866ca..0b10d4fe7c23 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,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first @@ -174,7 +175,7 @@ class User { return null; } - static List? listFromJson(dynamic json, {bool emptyIsNull = false, bool growable = false,}) { + static List? listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -184,7 +185,7 @@ class User { } } } - return emptyIsNull && result.isEmpty ? null : result.toList(growable: growable); + return result.toList(growable: growable); } static Map mapFromJson(dynamic json) { @@ -202,12 +203,12 @@ 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 = false, bool growable = false,}) { + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = User.listFromJson(entry.value, emptyIsNull: emptyIsNull, growable: growable,); + final value = User.listFromJson(entry.value, growable: growable,); if (value != null) { map[entry.key] = value; } From e6219c73d11ac9344ff316b9bcf985a0beb3e68f Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Sun, 19 Dec 2021 22:37:49 +0100 Subject: [PATCH 33/39] Fix a couple of reported bugs. --- .../src/main/resources/dart2/api.mustache | 2 +- .../src/main/resources/dart2/auth/header.mustache | 1 + .../main/resources/dart2/auth/http_basic_auth.mustache | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/dart2/api.mustache b/modules/openapi-generator/src/main/resources/dart2/api.mustache index 0b2a05ce9690..2ce04e81f0eb 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api.mustache @@ -55,7 +55,7 @@ class {{{classname}}} { .replaceAll({{=<% %>=}}'{<% baseName %>}'<%={{ }}=%>, {{{paramName}}}{{^isString}}.toString(){{/isString}}){{/pathParams}}; // ignore: prefer_final_locals - Object{{^bodyParam}}?{{/bodyParam}} postBody{{#bodyParam}} = {{{paramName}}}{{/bodyParam}}; + Object? postBody{{#bodyParam}} = {{{paramName}}}{{/bodyParam}}; final queryParams = []; final 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 8dc8b6d982fe..3799d9d04658 100644 --- a/modules/openapi-generator/src/main/resources/dart2/auth/header.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/auth/header.mustache @@ -1,6 +1,7 @@ // // AUTO-GENERATED FILE, DO NOT MODIFY! // +// @dart=2.12 // 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 07a7d8a11c1c..60db7475706e 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,14 +1,14 @@ {{>header}} {{>part_of}} class HttpBasicAuth implements Authentication { - HttpBasicAuth(this.username, this.password); + HttpBasicAuth({this.username, this.password}); - String username; - String password; + String? username; + String? password; @override void applyToParams(List queryParams, Map headerParams) { - final credentials = '$username:$password'; + final credentials = '${username ?? ''}:${password ?? ''}'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; } } From a989e61805d1c61e304ae1f33b9f92ebb13dd2d4 Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Sun, 19 Dec 2021 22:40:06 +0100 Subject: [PATCH 34/39] Regenerated Petstore source code. --- .../petstore_client_lib/lib/api/pet_api.dart | 4 ++-- .../lib/api/store_api.dart | 2 +- .../petstore_client_lib/lib/api/user_api.dart | 8 +++---- .../lib/auth/http_basic_auth.dart | 8 +++---- .../lib/api/another_fake_api.dart | 2 +- .../lib/api/fake_api.dart | 22 +++++++++---------- .../lib/api/fake_classname_tags123_api.dart | 2 +- .../lib/api/pet_api.dart | 4 ++-- .../lib/api/store_api.dart | 2 +- .../lib/api/user_api.dart | 8 +++---- .../lib/auth/http_basic_auth.dart | 8 +++---- 11 files changed, 35 insertions(+), 35 deletions(-) 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 f5c3c0b4f49e..b4ee176a9262 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 @@ -29,7 +29,7 @@ class PetApi { final path = r'/pet'; // ignore: prefer_final_locals - Object postBody = pet; + Object? postBody = pet; final queryParams = []; final headerParams = {}; @@ -333,7 +333,7 @@ class PetApi { final path = r'/pet'; // ignore: prefer_final_locals - Object postBody = pet; + Object? postBody = pet; final queryParams = []; final headerParams = {}; 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 78320021f571..dff1442125db 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 @@ -193,7 +193,7 @@ class StoreApi { final path = r'/store/order'; // ignore: prefer_final_locals - Object postBody = order; + Object? postBody = order; final queryParams = []; final headerParams = {}; 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 12c33b767432..a479e0b1dd32 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 @@ -31,7 +31,7 @@ class UserApi { final path = r'/user'; // ignore: prefer_final_locals - Object postBody = user; + Object? postBody = user; final queryParams = []; final headerParams = {}; @@ -81,7 +81,7 @@ class UserApi { final path = r'/user/createWithArray'; // ignore: prefer_final_locals - Object postBody = user; + Object? postBody = user; final queryParams = []; final headerParams = {}; @@ -129,7 +129,7 @@ class UserApi { final path = r'/user/createWithList'; // ignore: prefer_final_locals - Object postBody = user; + Object? postBody = user; final queryParams = []; final headerParams = {}; @@ -396,7 +396,7 @@ class UserApi { .replaceAll('{username}', username); // ignore: prefer_final_locals - Object postBody = user; + Object? postBody = user; final queryParams = []; final headerParams = {}; 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 503c796a5636..0044aef94b22 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 @@ -11,14 +11,14 @@ part of openapi.api; class HttpBasicAuth implements Authentication { - HttpBasicAuth(this.username, this.password); + HttpBasicAuth({this.username, this.password}); - String username; - String password; + String? username; + String? password; @override void applyToParams(List queryParams, Map headerParams) { - final credentials = '$username:$password'; + final credentials = '${username ?? ''}:${password ?? ''}'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; } } 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 261fa0b26dab..f03350c4dfff 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 @@ -31,7 +31,7 @@ class AnotherFakeApi { final path = r'/another-fake/dummy'; // ignore: prefer_final_locals - Object postBody = modelClient; + Object? postBody = modelClient; final queryParams = []; final headerParams = {}; 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 be763b2522a9..9d260e34f124 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 @@ -81,7 +81,7 @@ class FakeApi { final path = r'/fake/http-signature-test'; // ignore: prefer_final_locals - Object postBody = pet; + Object? postBody = pet; final queryParams = []; final headerParams = {}; @@ -143,7 +143,7 @@ class FakeApi { final path = r'/fake/outer/boolean'; // ignore: prefer_final_locals - Object postBody = body; + Object? postBody = body; final queryParams = []; final headerParams = {}; @@ -199,7 +199,7 @@ class FakeApi { final path = r'/fake/outer/composite'; // ignore: prefer_final_locals - Object postBody = outerComposite; + Object? postBody = outerComposite; final queryParams = []; final headerParams = {}; @@ -255,7 +255,7 @@ class FakeApi { final path = r'/fake/outer/number'; // ignore: prefer_final_locals - Object postBody = body; + Object? postBody = body; final queryParams = []; final headerParams = {}; @@ -311,7 +311,7 @@ class FakeApi { final path = r'/fake/outer/string'; // ignore: prefer_final_locals - Object postBody = body; + Object? postBody = body; final queryParams = []; final headerParams = {}; @@ -367,7 +367,7 @@ class FakeApi { final path = r'/fake/property/enum-int'; // ignore: prefer_final_locals - Object postBody = outerObjectWithEnumProperty; + Object? postBody = outerObjectWithEnumProperty; final queryParams = []; final headerParams = {}; @@ -423,7 +423,7 @@ class FakeApi { final path = r'/fake/body-with-binary'; // ignore: prefer_final_locals - Object postBody = body; + Object? postBody = body; final queryParams = []; final headerParams = {}; @@ -470,7 +470,7 @@ class FakeApi { final path = r'/fake/body-with-file-schema'; // ignore: prefer_final_locals - Object postBody = fileSchemaTestClass; + Object? postBody = fileSchemaTestClass; final queryParams = []; final headerParams = {}; @@ -515,7 +515,7 @@ class FakeApi { final path = r'/fake/body-with-query-params'; // ignore: prefer_final_locals - Object postBody = user; + Object? postBody = user; final queryParams = []; final headerParams = {}; @@ -566,7 +566,7 @@ class FakeApi { final path = r'/fake'; // ignore: prefer_final_locals - Object postBody = modelClient; + Object? postBody = modelClient; final queryParams = []; final headerParams = {}; @@ -1009,7 +1009,7 @@ class FakeApi { final path = r'/fake/inline-additionalProperties'; // ignore: prefer_final_locals - Object postBody = requestBody; + Object? postBody = requestBody; final queryParams = []; final headerParams = {}; 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 dc040d413e2d..158c127195bf 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 @@ -31,7 +31,7 @@ class FakeClassnameTags123Api { final path = r'/fake_classname_test'; // ignore: prefer_final_locals - Object postBody = modelClient; + Object? postBody = modelClient; final queryParams = []; final headerParams = {}; 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 c9f9150e6ca2..a91754608983 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 @@ -29,7 +29,7 @@ class PetApi { final path = r'/pet'; // ignore: prefer_final_locals - Object postBody = pet; + Object? postBody = pet; final queryParams = []; final headerParams = {}; @@ -325,7 +325,7 @@ class PetApi { final path = r'/pet'; // ignore: prefer_final_locals - Object postBody = pet; + Object? postBody = pet; final queryParams = []; final headerParams = {}; 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 1b6774ba5800..3cb580f1e197 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 @@ -193,7 +193,7 @@ class StoreApi { final path = r'/store/order'; // ignore: prefer_final_locals - Object postBody = order; + Object? postBody = order; final queryParams = []; final headerParams = {}; 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 0fdd9c4249d8..7cc0b7e18224 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 @@ -31,7 +31,7 @@ class UserApi { final path = r'/user'; // ignore: prefer_final_locals - Object postBody = user; + Object? postBody = user; final queryParams = []; final headerParams = {}; @@ -81,7 +81,7 @@ class UserApi { final path = r'/user/createWithArray'; // ignore: prefer_final_locals - Object postBody = user; + Object? postBody = user; final queryParams = []; final headerParams = {}; @@ -129,7 +129,7 @@ class UserApi { final path = r'/user/createWithList'; // ignore: prefer_final_locals - Object postBody = user; + Object? postBody = user; final queryParams = []; final headerParams = {}; @@ -396,7 +396,7 @@ class UserApi { .replaceAll('{username}', username); // ignore: prefer_final_locals - Object postBody = user; + Object? postBody = user; final queryParams = []; final headerParams = {}; 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 503c796a5636..0044aef94b22 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 @@ -11,14 +11,14 @@ part of openapi.api; class HttpBasicAuth implements Authentication { - HttpBasicAuth(this.username, this.password); + HttpBasicAuth({this.username, this.password}); - String username; - String password; + String? username; + String? password; @override void applyToParams(List queryParams, Map headerParams) { - final credentials = '$username:$password'; + final credentials = '${username ?? ''}:${password ?? ''}'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; } } From 07d2f918a21a6601d8917764c5c54f2076f8ce2a Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Mon, 20 Dec 2021 13:56:08 +0100 Subject: [PATCH 35/39] Make properties non-nullable. --- .../dart2/auth/api_key_auth.mustache | 30 +++++++++++-------- .../dart2/auth/http_basic_auth.mustache | 15 ++++++---- .../dart2/auth/http_bearer_auth.mustache | 20 ++++++++++--- .../main/resources/dart2/auth/oauth.mustache | 7 +++-- 4 files changed, 47 insertions(+), 25 deletions(-) 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 82cba34e95ea..e80ab2a2c377 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,23 +6,27 @@ 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) { - final value = apiKeyPrefix == null ? apiKey : '$apiKeyPrefix $apiKey'; + apiKeyPrefix = apiKeyPrefix.trim(); - if (location == 'query' && value != null) { - queryParams.add(QueryParam(paramName, value)); - } else if (location == 'header' && value != null) { - headerParams[paramName] = value; - } else if (location == 'cookie' && value != null) { - headerParams.update( - 'Cookie', - (existingCookie) => '$existingCookie; $paramName=$value', - ifAbsent: () => '$paramName=$value', - ); + final paramValue = (apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey').trim(); + + if (paramValue.isNotEmpty) { + if (location == 'query') { + queryParams.add(QueryParam(paramName, paramValue)); + } else if (location == 'header') { + headerParams[paramName] = paramValue; + } else if (location == 'cookie') { + headerParams.update( + 'Cookie', + (existingCookie) => '$existingCookie; $paramName=$paramValue', + ifAbsent: () => '$paramName=$paramValue', + ); + } } } } 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 60db7475706e..5189b80c6d24 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,14 +1,19 @@ {{>header}} {{>part_of}} class HttpBasicAuth implements Authentication { - HttpBasicAuth({this.username, this.password}); + HttpBasicAuth({this.username = '', this.password = ''}); - String? username; - String? password; + String username; + String password; @override void applyToParams(List queryParams, Map headerParams) { - final credentials = '${username ?? ''}:${password ?? ''}'; - headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; + username = username.trim(); + password = password.trim(); + + if (username.isNotEmpty && password.isNotEmpty) { + final credentials = '$username:$password'; + headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; + } } } diff --git a/modules/openapi-generator/src/main/resources/dart2/auth/http_bearer_auth.mustache b/modules/openapi-generator/src/main/resources/dart2/auth/http_bearer_auth.mustache index 1260ff9c99d0..d5e79ef6c8f7 100644 --- a/modules/openapi-generator/src/main/resources/dart2/auth/http_bearer_auth.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/auth/http_bearer_auth.mustache @@ -11,19 +11,31 @@ class HttpBearerAuth implements Authentication { set accessToken(dynamic accessToken) { if (accessToken is! String && accessToken is! HttpBearerAuthProvider) { - throw ArgumentError('Type of Bearer accessToken should be a String or a String Function().'); + throw ArgumentError('accessToken value must be either a String or a String Function().'); } _accessToken = accessToken; } @override void applyToParams(List queryParams, Map headerParams) { + if (_accessToken == null) { + return; + } + + String accessToken; + if (_accessToken is String) { - headerParams['Authorization'] = 'Bearer $_accessToken'; + accessToken = _accessToken; } else if (_accessToken is HttpBearerAuthProvider) { - headerParams['Authorization'] = 'Bearer ${_accessToken()}'; + accessToken = _accessToken!(); } else { - throw ArgumentError('Type of Bearer accessToken should be a String or a String Function().'); + return; + } + + accessToken = accessToken.trim(); + + if (accessToken.isNotEmpty) { + headerParams['Authorization'] = 'Bearer $accessToken'; } } } 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 464fe2d43ef1..5b7f7fe41f1c 100644 --- a/modules/openapi-generator/src/main/resources/dart2/auth/oauth.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/auth/oauth.mustache @@ -1,13 +1,14 @@ {{>header}} {{>part_of}} class OAuth implements Authentication { - OAuth({this.accessToken}); + OAuth({this.accessToken = ''}); - String? accessToken; + String accessToken; @override void applyToParams(List queryParams, Map headerParams) { - if (accessToken != null) { + accessToken = accessToken.trim(); + if (accessToken.isNotEmpty) { headerParams['Authorization'] = 'Bearer $accessToken'; } } From 4adb2043608a459e3a740733b9370ccd15238192 Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Mon, 20 Dec 2021 13:58:30 +0100 Subject: [PATCH 36/39] Regenerated Petstore source code. --- .../lib/auth/api_key_auth.dart | 32 +++++++++++-------- .../lib/auth/http_basic_auth.dart | 15 ++++++--- .../lib/auth/http_bearer_auth.dart | 20 +++++++++--- .../petstore_client_lib/lib/auth/oauth.dart | 7 ++-- .../lib/auth/api_key_auth.dart | 32 +++++++++++-------- .../lib/auth/http_basic_auth.dart | 15 ++++++--- .../lib/auth/http_bearer_auth.dart | 20 +++++++++--- .../lib/auth/oauth.dart | 7 ++-- 8 files changed, 96 insertions(+), 52 deletions(-) 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 2af78a62bcf0..fc4efa388b41 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 @@ -16,23 +16,27 @@ 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) { - final value = apiKeyPrefix == null ? apiKey : '$apiKeyPrefix $apiKey'; - - if (location == 'query' && value != null) { - queryParams.add(QueryParam(paramName, value)); - } else if (location == 'header' && value != null) { - headerParams[paramName] = value; - } else if (location == 'cookie' && value != null) { - headerParams.update( - 'Cookie', - (existingCookie) => '$existingCookie; $paramName=$value', - ifAbsent: () => '$paramName=$value', - ); + apiKeyPrefix = apiKeyPrefix.trim(); + + final paramValue = (apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey').trim(); + + if (paramValue.isNotEmpty) { + if (location == 'query') { + queryParams.add(QueryParam(paramName, paramValue)); + } else if (location == 'header') { + headerParams[paramName] = paramValue; + } else if (location == 'cookie') { + headerParams.update( + 'Cookie', + (existingCookie) => '$existingCookie; $paramName=$paramValue', + ifAbsent: () => '$paramName=$paramValue', + ); + } } } } 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 0044aef94b22..559da5914e42 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 @@ -11,14 +11,19 @@ part of openapi.api; class HttpBasicAuth implements Authentication { - HttpBasicAuth({this.username, this.password}); + HttpBasicAuth({this.username = '', this.password = ''}); - String? username; - String? password; + String username; + String password; @override void applyToParams(List queryParams, Map headerParams) { - final credentials = '${username ?? ''}:${password ?? ''}'; - headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; + username = username.trim(); + password = password.trim(); + + if (username.isNotEmpty && password.isNotEmpty) { + final credentials = '$username:$password'; + headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; + } } } 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 07f105666dc0..fbc72db3e53d 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 @@ -21,19 +21,31 @@ class HttpBearerAuth implements Authentication { set accessToken(dynamic accessToken) { if (accessToken is! String && accessToken is! HttpBearerAuthProvider) { - throw ArgumentError('Type of Bearer accessToken should be a String or a String Function().'); + throw ArgumentError('accessToken value must be either a String or a String Function().'); } _accessToken = accessToken; } @override void applyToParams(List queryParams, Map headerParams) { + if (_accessToken == null) { + return; + } + + String accessToken; + if (_accessToken is String) { - headerParams['Authorization'] = 'Bearer $_accessToken'; + accessToken = _accessToken; } else if (_accessToken is HttpBearerAuthProvider) { - headerParams['Authorization'] = 'Bearer ${_accessToken()}'; + accessToken = _accessToken!(); } else { - throw ArgumentError('Type of Bearer accessToken should be a String or a String Function().'); + return; + } + + accessToken = accessToken.trim(); + + if (accessToken.isNotEmpty) { + headerParams['Authorization'] = 'Bearer $accessToken'; } } } 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 66ec4cda0864..78f97a4afe68 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 @@ -11,13 +11,14 @@ part of openapi.api; class OAuth implements Authentication { - OAuth({this.accessToken}); + OAuth({this.accessToken = ''}); - String? accessToken; + String accessToken; @override void applyToParams(List queryParams, Map headerParams) { - if (accessToken != null) { + accessToken = accessToken.trim(); + if (accessToken.isNotEmpty) { headerParams['Authorization'] = 'Bearer $accessToken'; } } 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 2af78a62bcf0..fc4efa388b41 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 @@ -16,23 +16,27 @@ 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) { - final value = apiKeyPrefix == null ? apiKey : '$apiKeyPrefix $apiKey'; - - if (location == 'query' && value != null) { - queryParams.add(QueryParam(paramName, value)); - } else if (location == 'header' && value != null) { - headerParams[paramName] = value; - } else if (location == 'cookie' && value != null) { - headerParams.update( - 'Cookie', - (existingCookie) => '$existingCookie; $paramName=$value', - ifAbsent: () => '$paramName=$value', - ); + apiKeyPrefix = apiKeyPrefix.trim(); + + final paramValue = (apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey').trim(); + + if (paramValue.isNotEmpty) { + if (location == 'query') { + queryParams.add(QueryParam(paramName, paramValue)); + } else if (location == 'header') { + headerParams[paramName] = paramValue; + } else if (location == 'cookie') { + headerParams.update( + 'Cookie', + (existingCookie) => '$existingCookie; $paramName=$paramValue', + ifAbsent: () => '$paramName=$paramValue', + ); + } } } } 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 0044aef94b22..559da5914e42 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 @@ -11,14 +11,19 @@ part of openapi.api; class HttpBasicAuth implements Authentication { - HttpBasicAuth({this.username, this.password}); + HttpBasicAuth({this.username = '', this.password = ''}); - String? username; - String? password; + String username; + String password; @override void applyToParams(List queryParams, Map headerParams) { - final credentials = '${username ?? ''}:${password ?? ''}'; - headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; + username = username.trim(); + password = password.trim(); + + if (username.isNotEmpty && password.isNotEmpty) { + final credentials = '$username:$password'; + headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; + } } } 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 07f105666dc0..fbc72db3e53d 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 @@ -21,19 +21,31 @@ class HttpBearerAuth implements Authentication { set accessToken(dynamic accessToken) { if (accessToken is! String && accessToken is! HttpBearerAuthProvider) { - throw ArgumentError('Type of Bearer accessToken should be a String or a String Function().'); + throw ArgumentError('accessToken value must be either a String or a String Function().'); } _accessToken = accessToken; } @override void applyToParams(List queryParams, Map headerParams) { + if (_accessToken == null) { + return; + } + + String accessToken; + if (_accessToken is String) { - headerParams['Authorization'] = 'Bearer $_accessToken'; + accessToken = _accessToken; } else if (_accessToken is HttpBearerAuthProvider) { - headerParams['Authorization'] = 'Bearer ${_accessToken()}'; + accessToken = _accessToken!(); } else { - throw ArgumentError('Type of Bearer accessToken should be a String or a String Function().'); + return; + } + + accessToken = accessToken.trim(); + + if (accessToken.isNotEmpty) { + headerParams['Authorization'] = 'Bearer $accessToken'; } } } 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 66ec4cda0864..78f97a4afe68 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 @@ -11,13 +11,14 @@ part of openapi.api; class OAuth implements Authentication { - OAuth({this.accessToken}); + OAuth({this.accessToken = ''}); - String? accessToken; + String accessToken; @override void applyToParams(List queryParams, Map headerParams) { - if (accessToken != null) { + accessToken = accessToken.trim(); + if (accessToken.isNotEmpty) { headerParams['Authorization'] = 'Bearer $accessToken'; } } From 5493205bb3cbe71f30ce478506ee60b8ac2bde23 Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Mon, 20 Dec 2021 19:44:46 +0100 Subject: [PATCH 37/39] Do not trim user input before submitting. --- .../src/main/resources/dart2/auth/api_key_auth.mustache | 4 +--- .../src/main/resources/dart2/auth/http_basic_auth.mustache | 3 --- .../src/main/resources/dart2/auth/http_bearer_auth.mustache | 2 -- .../src/main/resources/dart2/auth/oauth.mustache | 1 - 4 files changed, 1 insertion(+), 9 deletions(-) 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 e80ab2a2c377..b4f5a4587246 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 @@ -11,9 +11,7 @@ class ApiKeyAuth implements Authentication { @override void applyToParams(List queryParams, Map headerParams) { - apiKeyPrefix = apiKeyPrefix.trim(); - - final paramValue = (apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey').trim(); + final paramValue = apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey'; if (paramValue.isNotEmpty) { if (location == 'query') { 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 5189b80c6d24..544219733921 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 @@ -8,9 +8,6 @@ class HttpBasicAuth implements Authentication { @override void applyToParams(List queryParams, Map headerParams) { - username = username.trim(); - password = password.trim(); - if (username.isNotEmpty && password.isNotEmpty) { final credentials = '$username:$password'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; diff --git a/modules/openapi-generator/src/main/resources/dart2/auth/http_bearer_auth.mustache b/modules/openapi-generator/src/main/resources/dart2/auth/http_bearer_auth.mustache index d5e79ef6c8f7..7c480c5e81d3 100644 --- a/modules/openapi-generator/src/main/resources/dart2/auth/http_bearer_auth.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/auth/http_bearer_auth.mustache @@ -32,8 +32,6 @@ class HttpBearerAuth implements Authentication { return; } - accessToken = accessToken.trim(); - if (accessToken.isNotEmpty) { headerParams['Authorization'] = 'Bearer $accessToken'; } 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 5b7f7fe41f1c..c5c64d522184 100644 --- a/modules/openapi-generator/src/main/resources/dart2/auth/oauth.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/auth/oauth.mustache @@ -7,7 +7,6 @@ class OAuth implements Authentication { @override void applyToParams(List queryParams, Map headerParams) { - accessToken = accessToken.trim(); if (accessToken.isNotEmpty) { headerParams['Authorization'] = 'Bearer $accessToken'; } From d647733bdef6f02ffcda40c43eecb59792eb9a52 Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Mon, 20 Dec 2021 20:31:22 +0100 Subject: [PATCH 38/39] Regenerate Petstore source code. --- .../dart2/petstore_client_lib/lib/auth/api_key_auth.dart | 4 +--- .../dart2/petstore_client_lib/lib/auth/http_basic_auth.dart | 3 --- .../dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart | 2 -- .../petstore/dart2/petstore_client_lib/lib/auth/oauth.dart | 1 - .../dart2/petstore_client_lib_fake/lib/auth/api_key_auth.dart | 4 +--- .../petstore_client_lib_fake/lib/auth/http_basic_auth.dart | 3 --- .../petstore_client_lib_fake/lib/auth/http_bearer_auth.dart | 2 -- .../dart2/petstore_client_lib_fake/lib/auth/oauth.dart | 1 - 8 files changed, 2 insertions(+), 18 deletions(-) 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 fc4efa388b41..e304eda321ee 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 @@ -21,9 +21,7 @@ class ApiKeyAuth implements Authentication { @override void applyToParams(List queryParams, Map headerParams) { - apiKeyPrefix = apiKeyPrefix.trim(); - - final paramValue = (apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey').trim(); + final paramValue = apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey'; if (paramValue.isNotEmpty) { if (location == 'query') { 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 559da5914e42..81abd7185f2d 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 @@ -18,9 +18,6 @@ class HttpBasicAuth implements Authentication { @override void applyToParams(List queryParams, Map headerParams) { - username = username.trim(); - password = password.trim(); - if (username.isNotEmpty && password.isNotEmpty) { final credentials = '$username:$password'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; 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 fbc72db3e53d..213f3483b8fb 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 @@ -42,8 +42,6 @@ class HttpBearerAuth implements Authentication { return; } - accessToken = accessToken.trim(); - if (accessToken.isNotEmpty) { headerParams['Authorization'] = 'Bearer $accessToken'; } 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 78f97a4afe68..e9b87cffb052 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 @@ -17,7 +17,6 @@ class OAuth implements Authentication { @override void applyToParams(List queryParams, Map headerParams) { - accessToken = accessToken.trim(); if (accessToken.isNotEmpty) { headerParams['Authorization'] = 'Bearer $accessToken'; } 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 fc4efa388b41..e304eda321ee 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 @@ -21,9 +21,7 @@ class ApiKeyAuth implements Authentication { @override void applyToParams(List queryParams, Map headerParams) { - apiKeyPrefix = apiKeyPrefix.trim(); - - final paramValue = (apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey').trim(); + final paramValue = apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey'; if (paramValue.isNotEmpty) { if (location == 'query') { 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 559da5914e42..81abd7185f2d 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 @@ -18,9 +18,6 @@ class HttpBasicAuth implements Authentication { @override void applyToParams(List queryParams, Map headerParams) { - username = username.trim(); - password = password.trim(); - if (username.isNotEmpty && password.isNotEmpty) { final credentials = '$username:$password'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; 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 fbc72db3e53d..213f3483b8fb 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 @@ -42,8 +42,6 @@ class HttpBearerAuth implements Authentication { return; } - accessToken = accessToken.trim(); - if (accessToken.isNotEmpty) { headerParams['Authorization'] = 'Bearer $accessToken'; } 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 78f97a4afe68..e9b87cffb052 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 @@ -17,7 +17,6 @@ class OAuth implements Authentication { @override void applyToParams(List queryParams, Map headerParams) { - accessToken = accessToken.trim(); if (accessToken.isNotEmpty) { headerParams['Authorization'] = 'Bearer $accessToken'; } From 268366563ba9ba4b3ec62ab361d190a13757849e Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Mon, 20 Dec 2021 20:31:22 +0100 Subject: [PATCH 39/39] Regenerate Petstore source code. --- .../dart2/petstore_client_lib/lib/auth/api_key_auth.dart | 4 +--- .../dart2/petstore_client_lib/lib/auth/http_basic_auth.dart | 3 --- .../dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart | 2 -- .../petstore/dart2/petstore_client_lib/lib/auth/oauth.dart | 1 - .../dart2/petstore_client_lib_fake/lib/auth/api_key_auth.dart | 4 +--- .../petstore_client_lib_fake/lib/auth/http_basic_auth.dart | 3 --- .../petstore_client_lib_fake/lib/auth/http_bearer_auth.dart | 2 -- .../dart2/petstore_client_lib_fake/lib/auth/oauth.dart | 1 - 8 files changed, 2 insertions(+), 18 deletions(-) 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 fc4efa388b41..e304eda321ee 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 @@ -21,9 +21,7 @@ class ApiKeyAuth implements Authentication { @override void applyToParams(List queryParams, Map headerParams) { - apiKeyPrefix = apiKeyPrefix.trim(); - - final paramValue = (apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey').trim(); + final paramValue = apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey'; if (paramValue.isNotEmpty) { if (location == 'query') { 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 559da5914e42..81abd7185f2d 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 @@ -18,9 +18,6 @@ class HttpBasicAuth implements Authentication { @override void applyToParams(List queryParams, Map headerParams) { - username = username.trim(); - password = password.trim(); - if (username.isNotEmpty && password.isNotEmpty) { final credentials = '$username:$password'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; 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 fbc72db3e53d..213f3483b8fb 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 @@ -42,8 +42,6 @@ class HttpBearerAuth implements Authentication { return; } - accessToken = accessToken.trim(); - if (accessToken.isNotEmpty) { headerParams['Authorization'] = 'Bearer $accessToken'; } 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 78f97a4afe68..e9b87cffb052 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 @@ -17,7 +17,6 @@ class OAuth implements Authentication { @override void applyToParams(List queryParams, Map headerParams) { - accessToken = accessToken.trim(); if (accessToken.isNotEmpty) { headerParams['Authorization'] = 'Bearer $accessToken'; } 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 fc4efa388b41..e304eda321ee 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 @@ -21,9 +21,7 @@ class ApiKeyAuth implements Authentication { @override void applyToParams(List queryParams, Map headerParams) { - apiKeyPrefix = apiKeyPrefix.trim(); - - final paramValue = (apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey').trim(); + final paramValue = apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey'; if (paramValue.isNotEmpty) { if (location == 'query') { 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 559da5914e42..81abd7185f2d 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 @@ -18,9 +18,6 @@ class HttpBasicAuth implements Authentication { @override void applyToParams(List queryParams, Map headerParams) { - username = username.trim(); - password = password.trim(); - if (username.isNotEmpty && password.isNotEmpty) { final credentials = '$username:$password'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; 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 fbc72db3e53d..213f3483b8fb 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 @@ -42,8 +42,6 @@ class HttpBearerAuth implements Authentication { return; } - accessToken = accessToken.trim(); - if (accessToken.isNotEmpty) { headerParams['Authorization'] = 'Bearer $accessToken'; } 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 78f97a4afe68..e9b87cffb052 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 @@ -17,7 +17,6 @@ class OAuth implements Authentication { @override void applyToParams(List queryParams, Map headerParams) { - accessToken = accessToken.trim(); if (accessToken.isNotEmpty) { headerParams['Authorization'] = 'Bearer $accessToken'; }